Doxygen Source Code Documentation
3dAutobox.c File Reference
#include "mrilib.h"
Go to the source code of this file.
Functions | |
int | main (int argc, char *argv[]) |
Function Documentation
|
compute the overall minimum and maximum voxel values for a dataset Definition at line 3 of file 3dAutobox.c. References AFNI_logger(), argc, DSET_BRICK_TYPE, DSET_load, DSET_LOADED, DSET_NX, DSET_NY, DSET_NZ, ISVALID_DSET, machdep(), mainENTRY, nz, PRINT_VERSION, THD_autobbox(), and THD_open_dataset().
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 } |