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  

Imon.h

Go to the documentation of this file.
00001 
00002 #ifndef _IMON_H_
00003 #define _IMON_H_
00004 
00005 /*----------------------------------------------------------------------*/
00006 
00007 #define IFM_MAX_FLEN       200       /* maximum characters in filename   */
00008 #define IFM_PAD_LEN         20       /* padding for I-file expansion     */
00009 #define IFM_EPSILON       0.01       /* slice epsilon                    */
00010 #define IFM_STAT_ALLOC      20       /* allocation blocksize - run stats */
00011 #define IFM_MAX_IM_ALLOC    40       /* initial limit for read_ge_files  */
00012 #define IFM_MAX_RUN_NAPS     3       /* maximum number of mid-run naps   */
00013 #define IFM_MAX_GE_FAILURES  3       /* file read failures before exit   */
00014 #define IFM_MAX_NT       32767       /* maximum valid num time points    */
00015 #define IFM_SUFFIX_LEN      10       /* allocated space for I-file sufix */
00016 
00017 #define IFM_MIN_NICE_INC   -19       /* minimum nice value increment     */
00018 #define IFM_MAX_NICE_INC    20       /* maximum nice value increment     */
00019 
00020 #define IFM_USE_SHORT        1       /* usage constants                  */
00021 #define IFM_USE_LONG         2
00022 #define IFM_USE_HIST         3
00023 #define IFM_USE_VERSION      4
00024 
00025 #define IFM_IM_FTYPE_NONE    0       /* valid image file types:          */
00026 #define IFM_IM_FTYPE_GEMS5   1       /* GEMS 5.x                         */
00027 #define IFM_IM_FTYPE_DICOM   4       /* DICOM                            */
00028 
00029 #define IFM_DEBUG_DEFAULT    1       /* default debug level: show status */
00030 #define IFM_MAX_DEBUG        5       /* maximum debug level              */
00031 
00032 #define IFM_GERT_SCRIPT "GERT_Reco2" /* output script, like GERT_Reco    */
00033 #define IFM_GERT_DICOM  "GERT_Reco_dicom" /* DICOM GERT_Reco script      */
00034 #define IFM_SLICE_PAT   "alt+z"
00035 
00036 /* -- define copies -- */
00037 
00038 #define LSB_FIRST            1
00039 #define MSB_FIRST            2
00040 
00041 /*-----------------------------------------------------------------------*/
00042                                     /* from Ifile.c ... */
00043 typedef struct                      /* stuff extracted from GE I.* image */
00044 {
00045     int   good;                     /* is this a good image?           */
00046     int   nx, ny;                   /* image matrix                    */
00047     int   uv17;                     /* apparently codes for scan index */
00048     int   index;                    /* image counter                   */
00049     float dx,dy,dz, zoff, tr,te;    /* various dimensions              */
00050     char  orients[8];               /* orientation string              */
00051 } ge_header_info;
00052 
00053 typedef struct                      /* extra stuff from mri_read.c     */
00054 {
00055     int   bpp;                      /* bits per pixel                  */
00056     int   cflag;                    /* compression flag (0=compressed) */
00057     int   hdroff;                   /* offset of image header          */
00058     int   skip;                     /* offset of image data into file  */
00059     int   swap;                     /* did we do byte swapping?        */
00060     int   kk;                       /* z-orient info (1=LR, 2=PA, 3=IS)*/
00061     float xorg;                     /* x and y axes origins            */
00062     float yorg;
00063     float xyz[9];
00064 } ge_extras;
00065 
00066 typedef struct
00067 {
00068     ge_header_info   geh;           /* ge_header_info struct for this file */
00069     ge_extras        gex;           /* ge_extras struct for this file     */
00070     int              index;         /* index into fnames array           */
00071     int              bytes;         /* size of image in bytes           */
00072     void           * image;         /* actual image data               */
00073 } finfo_t;
00074 
00075 typedef struct
00076 {
00077     char          ** str;           /* list of actual strings */
00078     int              nalloc;        /* number allocated for  */
00079     int              nused;         /* number in use        */
00080 } string_list;
00081 
00082 typedef struct
00083 {
00084     int              nalloc;        /* number of images allocated for   */
00085     int              nused;         /* number of images in use now      */
00086     int              ary_len;       /* length of allocated im_ary array */
00087     int              im_size;       /* size of each individual image    */
00088     void          ** im_ary;        /* array of images                  */
00089     void           * x_im;          /* extra image for afni comm        */
00090 } im_store_t;
00091 
00092 typedef struct  /* user options */
00093 {
00094     char           * start_file;    /* user-specified starting file     */
00095     char           * start_dir;     /* user input starting directory    */
00096     char           * dicom_glob;    /* globbing form for dicom files    */
00097     char           * sp;            /* slice acquisition pattern        */
00098     char           * gert_outdir;   /* output directory for GERT_Reco2  */
00099     char          ** argv;          /* passed to the program            */
00100     int              argc;
00101     int              nt;            /* user input time points per run   */
00102     int              nice;          /* nice offset (must be >= 0)       */
00103     int              pause;         /* pause time between volumes (MS)  */
00104     int              debug;         /* debug level                      */
00105     int              gert_reco;     /* output GERT_Reco2 script         */
00106     int              quit;          /* quit when no new images found    */
00107     int              use_dicom;     /* flag for dicom (not GE) images   */
00108     int              dicom_org;     /* flag to organize dicom files     */
00109 
00110     /* realtime options */
00111     int              rt;            /* run in real-time afni mode       */
00112     int              swap;          /* swap bytes when sending data     */
00113     int              rev_bo;        /* reverse BYTEORDER command        */
00114     char           * host;          /* pointer to hostname              */
00115     string_list      drive_list;    /* list of DRIVE_AFNI commands      */
00116     string_list      rt_list;       /* list of real-time commands       */
00117 } opts_t;
00118 
00119 typedef struct
00120 {
00121     int              ftype;         /* one of IFM_IM_FTYPE_*            */
00122     int              nused;         /* number of elements assigned      */
00123     int              nalloc;        /* number of elements allocated for */
00124     finfo_t        * flist;         /* array of finfo structures        */
00125     im_store_t       im_store;      /* structure to hold actual images  */
00126 
00127     char           * glob_dir;      /* wildcard format to search for    */
00128     int              nfiles;        /* number of files in list          */
00129     char          ** fnames;        /* corresponding file names         */
00130 
00131     opts_t           opts;          /* user specified options           */
00132 } param_t;
00133 
00134 typedef struct                      /* used for the stats_t struct      */
00135 {
00136     int  volumes;                   /* number of volumes in this run    */
00137     int  f1index;                   /* index into fnames list           */
00138     char f1name[IFM_MAX_FLEN];      /* file name for first image        */
00139 } run_t;
00140 
00141 typedef struct                  /* used to output statistics at the end */
00142 {
00143     int     slices;             /* the number of slices in each volume  */
00144     float   z_first, z_last;    /* bounding range for slice locations   */
00145     float   z_delta;            /* slice thickness                      */
00146 
00147     int     nalloc;             /* number of run_t structures allocated */
00148     int     nused;              /* number of run_t structures in use    */
00149     int     nvols;              /* number of volumes in a run           */
00150     run_t * runs;               /* array of run_t strcutrues            */
00151 } stats_t;
00152 
00153 typedef struct
00154 {
00155     ge_header_info geh;                  /* first GE header structure        */
00156     ge_extras      gex;                  /* first GE extras structure        */
00157     int            nim;                  /* number of images in this volume  */
00158     int            fl_1;                 /* first index into flist           */
00159     int            fn_1, fn_n;           /* indicies into the fnames list    */
00160     char           first_file[IFM_MAX_FLEN]; /*file name of first slice image*/
00161     char           last_file [IFM_MAX_FLEN]; /*file name of last slice image */
00162     float          z_first;              /* z location of first slice image  */
00163     float          z_last;               /* z location of last slice image   */
00164     float          z_delta;              /* signed slice thickness           */
00165     int            seq_num;              /* sequence number in TRs (1-based) */
00166     int            run;                  /* run number                       */
00167 } vol_t;
00168 
00169 typedef struct
00170 {
00171     int level;
00172 } IFM_debug;
00173 
00174 
00175 /*----------------------------------------------------------------------*/
00176 /* macros */
00177 
00178 #define IFM_BIG_ERROR_MESG( I_str, I_file, I_ez, I_az, I_run, I_s1, I_sn )  \
00179         do {                                                            \
00180             fprintf( stderr, "\007\n"                                   \
00181                     "***********************************************\n" \
00182                     "Error: %s\n"                                       \
00183                     "       current file      : %s\n"                   \
00184                     "       expected z-offset : %.4f\n"                 \
00185                     "       actual z-offset   : %.4f\n"                 \
00186                     "       current run       : %d\n"                   \
00187                     "       slice number      : %d (of %d)\n"           \
00188                     "***********************************************\n",\
00189                 I_str, I_file, I_ez, I_az, I_run, I_s1, I_sn );         \
00190         } while (0)
00191 
00192 #endif /* _IMON_H_ */
 

Powered by Plone

This site conforms to the following standards: