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  

3dAutobox.c

Go to the documentation of this file.
00001 #include "mrilib.h"
00002 
00003 int main( int argc , char * argv[] )
00004 {
00005    THD_3dim_dataset *dset ;
00006    int iarg=1 ;
00007 
00008    if( argc < 2 || strcmp(argv[1],"-help") == 0 ){
00009       printf("Usage: 3dAutobox dataset\n"
00010              "Computes size of a box that fits around the volume.\n"
00011             ) ;
00012       exit(0) ;
00013    }
00014 
00015    mainENTRY("3dAutobox main"); machdep(); AFNI_logger("3dAutobox",argc,argv);
00016    PRINT_VERSION("3dAutobox") ;
00017 
00018    /*-- read data --*/
00019 
00020    dset = THD_open_dataset(argv[iarg]) ;
00021    if( !ISVALID_DSET(dset) ){ fprintf(stderr,"** CAN'T open dataset\n");exit(1); }
00022    if( DSET_BRICK_TYPE(dset,0) != MRI_short &&
00023        DSET_BRICK_TYPE(dset,0) != MRI_byte  &&
00024        DSET_BRICK_TYPE(dset,0) != MRI_float   ){
00025       fprintf(stderr,"** ILLEGAL dataset type\n"); exit(1);
00026    }
00027    DSET_load(dset) ;
00028    if( !DSET_LOADED(dset) ){ fprintf(stderr,"** CAN'T load dataset\n");exit(1); }
00029 
00030    { int nx=DSET_NX(dset), ny=DSET_NY(dset), nz=DSET_NZ(dset), nxy=nx*ny ;
00031      int ii,jj,kk ;
00032 
00033      { int xm=-1,xp=-1,ym=-1,yp=-1,zm=-1,zp=-1 ;
00034        THD_autobbox( dset , &xm,&xp , &ym,&yp , &zm,&zp ) ;
00035        fprintf(stderr,"++ Auto bbox: x=%d..%d  y=%d..%d  z=%d..%d\n",
00036                xm,xp,ym,yp,zm,zp ) ;
00037      }
00038    }
00039 
00040    exit(0) ;
00041 }
 

Powered by Plone

This site conforms to the following standards: