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  

rotcom.c File Reference

#include "mrilib.h"

Go to the source code of this file.


Functions

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

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 3 of file rotcom.c.

References argc, EDIT_empty_copy(), ISVALID_DSET, THD_dmat33::mat, THD_dvecmat::mm, THD_open_dataset(), THD_rotcom_to_matvec(), THD_dvecmat::vv, and THD_dfvec3::xyz.

00004 {
00005    THD_dvecmat dvm ;
00006    THD_3dim_dataset *dset ;
00007 
00008    if( argc < 2 || strcmp(argv[1],"-help") == 0 ){
00009      printf("Usage: rotcom '-rotate aaI bbR ccA -ashift ddS eeL ffP' [dataset]\n"
00010             "\n"
00011             "Prints to stdout the 4x3 transformation matrix+vector that would be\n"
00012             "applied by 3drotate to the given dataset.\n"
00013             "\n"
00014             "The -rotate and -ashift options combined must be input inside single\n"
00015             "quotes (i.e., as one long command string):\n"
00016             " * These options follow the same form as specified by '3drotate -help'.\n"
00017             " * That is, if you include the '-rotate' component, it must be followed\n"
00018             "   by 3 angles.\n"
00019             " * If you include the '-ashift' component, it must be followed by 3 shifts;\n"
00020             " * For example, if you only want to shift in the 'I' direction, you could use\n"
00021             "     '-ashift 10I 0 0'.\n"
00022             " * If you only want to rotate about the 'I' direction, you could use\n"
00023             "     '-rotate 10I 0R 0A'.\n"
00024             "\n"
00025             "Note that the coordinate order for the matrix and vector is that of\n"
00026             "the dataset, which can be determined from program 3dinfo.  This is the\n"
00027             "only function of the 'dataset' command line argument.\n"
00028             "\n"
00029             "If no dataset is given, the coordinate order is 'RAI', which means:\n"
00030             "    -x = Right      [and so +x = Left     ]\n"
00031             "    -y = Anterior   [    so +y = Posterior]\n"
00032             "    -z = Inferior   [    so +z = Superior ]\n"
00033             "For example, the output of command\n"
00034             "   rotcom '-rotate 10I 0R 0A'\n"
00035             "is the 3 lines below:\n"
00036             "0.984808 -0.173648  0.000000  0.000\n"
00037             "0.173648  0.984808  0.000000  0.000\n"
00038             "0.000000  0.000000  1.000000  0.000\n"
00039             "\n"
00040             "-- RWCox - Nov 2002\n"
00041            ) ;
00042      exit(0) ;
00043    }
00044 
00045    if( argc > 2 ){
00046      dset = THD_open_dataset( argv[2] ) ;
00047      if( !ISVALID_DSET(dset) ){
00048        fprintf(stderr,"** ERROR: can't open dataset %s\n",argv[2]); exit(1);
00049      }
00050    } else {
00051      dset = EDIT_empty_copy(NULL) ;
00052    }
00053 
00054    dvm = THD_rotcom_to_matvec( dset , argv[1] ) ;
00055 
00056    printf("%9.6f %9.6f %9.6f  %.3f\n"
00057           "%9.6f %9.6f %9.6f  %.3f\n"
00058           "%9.6f %9.6f %9.6f  %.3f\n" ,
00059 
00060      dvm.mm.mat[0][0] , dvm.mm.mat[0][1] , dvm.mm.mat[0][2] , dvm.vv.xyz[0] ,
00061      dvm.mm.mat[1][0] , dvm.mm.mat[1][1] , dvm.mm.mat[1][2] , dvm.vv.xyz[1] ,
00062      dvm.mm.mat[2][0] , dvm.mm.mat[2][1] , dvm.mm.mat[2][2] , dvm.vv.xyz[2]   ) ;
00063 
00064    exit(0) ;
00065 }
 

Powered by Plone

This site conforms to the following standards: