Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

qqq_rota.c File Reference

#include "mrilib.h"
#include <string.h>

Go to the source code of this file.


Defines

#define ERR   fprintf(stderr,"Illegal parameter!\n")

Functions

int main (int argc, char *argv[])

Define Documentation

#define ERR   fprintf(stderr,"Illegal parameter!\n")
 


Function Documentation

int main int    argc,
char *    argv[]
 

\** File : SUMA.c

Author:
: Ziad Saad Date : Thu Dec 27 16:21:01 EST 2001
Purpose :

Input paramters :

Parameters:
param  Usage : SUMA ( )
Returns :
Returns:
Support :
See also:
OpenGL prog. Guide 3rd edition , varray.c from book's sample code
Side effects :

Definition at line 4 of file qqq_rota.c.

References argc, COX_cpu_time(), MRI_IMAGE::kind, MRI_BICUBIC, MRI_BILINEAR, MRI_FOURIER, mri_free(), MRI_IS_2D, mri_read_just_one(), mri_rota_variable(), mri_to_float(), and strtod().

00005 {
00006    MRI_IMAGE *imin , *imwarp ;
00007    float aa , bb , phi ;
00008    char * cp ;
00009    int kk , nopt , almode = MRI_BICUBIC ;
00010    double ct ;
00011    int qq ;
00012 
00013    if( argc < 6 || strncmp(argv[1],"-help",5) == 0 ){
00014       printf( "Usage: imrotate [-linear | -Fourier] dx dy phi input_image output_image\n"
00015               "Shifts and rotates an image:\n"
00016               "  dx pixels rightwards (not necessarily an integer)\n"
00017               "  dy pixels downwards\n"
00018               "  phi degrees clockwise\n"
00019               "  -linear means to use bilinear interpolation (default is bicubic)\n"
00020               "  -Fourier means to use Fourier interpolaion\n"
00021               "Values outside the input_image are taken to be zero.\n" ) ;
00022       exit(0) ;
00023    }
00024 
00025    /** get parameters **/
00026 
00027 #define ERR fprintf(stderr,"Illegal parameter!\n")
00028 
00029    nopt = 1 ;
00030    if( strncmp(argv[nopt],"-linear",4) == 0 ){
00031       almode = MRI_BILINEAR ;
00032       nopt++ ;
00033    } else if( strncmp(argv[nopt],"-Fourier",4) == 0 ){
00034       almode = MRI_FOURIER ;
00035       nopt++ ;
00036    }
00037 
00038    aa  = strtod( argv[nopt++] , &cp ) ;              if( *cp != '\0' ){ERR;exit(1);}
00039    bb  = strtod( argv[nopt++] , &cp ) ;              if( *cp != '\0' ){ERR;exit(1);}
00040    phi = strtod( argv[nopt++] , &cp ) * (PI/180.0) ; if( *cp != '\0' ){ERR;exit(1);}
00041 
00042    imin = mri_read_just_one( argv[nopt++] ) ;
00043    if( imin == NULL ) exit(1) ;
00044    if( ! MRI_IS_2D(imin) ){
00045       fprintf(stderr,"** Input image is not 2D!\a\n") ; exit(1) ;
00046    }
00047 
00048    kk = imin->kind ;
00049    if( kk != MRI_float ){
00050      MRI_IMAGE * qim = mri_to_float(imin) ;
00051      mri_free(imin) ; imin = qim ;
00052    }
00053 
00054    ct = COX_cpu_time() ;
00055 
00056    for( qq=0 ; qq < 100 ; qq++ ){
00057       imwarp = mri_rota_variable( almode , imin,aa,bb,phi ) ;
00058       mri_free(imwarp) ;
00059    }
00060    ct = COX_cpu_time() - ct ;
00061    printf("CPU time = %g\n",ct) ; exit(0) ;
00062    exit(0) ;
00063 }
 

Powered by Plone

This site conforms to the following standards: