dox/IO/vtkPhilipsPAR.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   vtkCNMRRLibrary
00004   Module:    $RCSfile: vtkPhilipsPAR.h,v $
00005 
00006   Copyright  2005  The Pennsylvania State University
00007   
00008       Notice
00009  
00010   The contents of this file are subject to The Pennsylvania State University 
00011   Open Source License (the "License"); you may not use this file except in 
00012   compliance with the License. You may obtain a copy of the License at H066 
00013   Radiology, NMR Building, 500 University Drive, Hershey, PA, 
00014   tel. (717) 531-6069 or via email at dcb210@psu.edu.
00015  
00016   Software distributed under the License is distributed on an "AS IS" basis, 
00017   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
00018   for the specific language governing rights and limitations under the 
00019   License.
00020  
00021   The Original Code is listed under Exhibit A of the license.
00022  
00023   The Initial Developer of the Original Code is Don Bigler.
00024  
00025   Contributor(s):
00026   
00027 =========================================================================*/
00039 #ifndef _vtkPhilipsPAR_h
00040 #define _vtkPhilipsPAR_h
00041 
00042 #include <stdio.h>
00043 #include <stdlib.h>
00044 #include <string>
00045 #include <vector>
00046 #include "vtkObject.h"
00047 #include "vtkCNMRRIOWin32Header.h"
00048 
00049 #define RESEARCH_IMAGE_EXPORT_TOOL_V3       30
00050 #define RESEARCH_IMAGE_EXPORT_TOOL_V4       40
00051 #define RESEARCH_IMAGE_EXPORT_TOOL_V4_1     41
00052 #define RESEARCH_IMAGE_EXPORT_TOOL_V4_2     42
00053 #define RESEARCH_IMAGE_EXPORT_TOOL_UNKNOWN  -1
00054 
00055 #define PAR_DEFAULT_STRING_LENGTH           32
00056 #define PAR_DEFAULT_TRIGGER_TIMES_SIZE      128
00057 #define PAR_DEFAULT_ECHO_TIMES_SIZE         128
00058 #define PAR_DEFAULT_REP_TIMES_SIZE          128
00059 #define PAR_DEFAULT_IMAGE_TYPES_SIZE        8
00060 #define PAR_DEFAULT_SCAN_SEQUENCE_SIZE      8
00061 #define PAR_RESCALE_VALUES_SIZE             3
00062 #define PAR_DIFFUSION_VALUES_SIZE           3
00063 
00064 #define PAR_SLICE_ORIENTATION_TRANSVERSAL   1
00065 #define PAR_SLICE_ORIENTATION_SAGITTAL      2
00066 #define PAR_SLICE_ORIENTATION_CORONAL       3
00067 
00071 struct par_parameter  //par_parameter
00072 {
00073   int problemreading; // Marked 1 if problem occurred reading in PAR file
00074   int ResToolsVersion; // V3, V4, V4.1, or V4.2 PAR/REC version
00075   char patient_name[PAR_DEFAULT_STRING_LENGTH]; // Patient name
00076   char exam_name[PAR_DEFAULT_STRING_LENGTH]; // Examination name
00077   char protocol_name[PAR_DEFAULT_STRING_LENGTH]; // Protocol name
00078   char exam_date[PAR_DEFAULT_STRING_LENGTH]; // Examination date/time
00079   char exam_time[PAR_DEFAULT_STRING_LENGTH]; // Examination date/time
00080   char series_type[PAR_DEFAULT_STRING_LENGTH]; // Series Type
00081   int scno; // Acquisition nr
00082   int recno; // Reconstruction nr
00083   int scan_duration; // Scan Duration [sec]
00084   int cardiac_phases; // Max. number of cardiac phases
00085   float trigger_times[PAR_DEFAULT_TRIGGER_TIMES_SIZE]; // trigger_time (float)
00086   int echoes; // Max. number of echoes
00087   float echo_times[PAR_DEFAULT_ECHO_TIMES_SIZE]; // Echo times read from PAR file
00088   int slice; // Max. number of slices/locations
00089   int dyn; // Max. number of dynamics
00090   int mixes; // Max. number of mixes
00091   char patient_position[PAR_DEFAULT_STRING_LENGTH]; // Patient position
00092   char prep_direction[PAR_DEFAULT_STRING_LENGTH]; // Preparation direction
00093   short int bit; // Image pixel size [8 or 16 bits]
00094   char technique[PAR_DEFAULT_STRING_LENGTH]; // Technique
00095   char scan_mode[PAR_DEFAULT_STRING_LENGTH]; // Scan mode
00096   int num_averages; // Number of averages
00097   int scan_resolution[2]; // Scan resolution  (x, y)
00098   int scan_percent; // Scan percentage
00099   int dim[3]; // Recon resolution (x, y) + slices (z)
00100   float repetition_time[PAR_DEFAULT_REP_TIMES_SIZE]; // Repetition time [msec]
00101   int sliceorient; // slice orientation ( TRA/SAG/COR ) (integer)
00102   float slth; // Slice thickness [mm]
00103   float gap; // Slice gap [mm]
00104   float fov[3]; // FOV (ap,fh,rl) [mm]
00105   float water_fat_shift; // Water Fat shift [pixels]
00106   float angAP; // Angulation midslice(ap,fh,rl)[degr]
00107   float angFH; // Angulation midslice(ap,fh,rl)[degr]
00108   float angRL; // Angulation midslice(ap,fh,rl)[degr]
00109   float offAP; // Off Centre midslice(ap,fh,rl) [mm]
00110   float offFH; // Off Centre midslice(ap,fh,rl) [mm]
00111   float offRL; // Off Centre midslice(ap,fh,rl) [mm]
00112   int flow_comp; // Flow compensation <0=no 1=yes> ?
00113   int presaturation; // Presaturation     <0=no 1=yes> ?
00114   int cardiac_freq; // Cardiac frequency
00115   int min_rr_int; // Min. RR interval
00116   int max_rr_int; // Max. RR interval
00117   float phase_encode_vel[3]; // Phase encoding velocity [cm/sec]
00118   int mtc; // MTC               <0=no 1=yes> ?
00119   int spir; // SPIR              <0=no 1=yes> ?
00120   int epi; // EPI factor        <0,1=no EPI>
00121   int turbo; // TURBO factor      <0=no turbo>
00122   int dynamic_scan; // Dynamic scan      <0=no 1=yes> ?
00123   int diffusion; // Diffusion         <0=no 1=yes> ?
00124   float diff_echo; // Diffusion echo time [msec]
00125   float inversion_delay; // Inversion delay [msec]
00126   int max_num_diff_vals; // Max. number of diffusion values
00127   int max_num_grad_orient; // Max. number of gradient orients
00128   int num_label_types; // Number of label types   <0=no ASL>
00129   float vox[3]; // pixel spacing (x,y) (in mm)
00130   int slicessorted; // 1-slices sorted, 0-slices not sorted
00131   int image_blocks; // The total number of image blocks stored in the REC file
00132   int num_image_types; // The number of image types in the REC file
00133   int image_types[PAR_DEFAULT_IMAGE_TYPES_SIZE]; // The different image types 
00134                                                  // detected in the REC
00135   int num_scanning_sequences; // The number of scanning sequences in the REC file
00136   int scanning_sequences[PAR_DEFAULT_SCAN_SEQUENCE_SIZE]; // The different 
00137                                                           // scanning sequences 
00138                                                           // detected in the REC
00139   int num_slice_repetitions; // If num_scanning_sequences > 1 then 
00140                   // num_image_types may not equal the total number of slice 
00141                   // repetitions for a single acquisition.  This value is the 
00142                   // total number of slice repetitions for a single acquisition 
00143                   // and is valid only when slicessorted == 0.
00144 
00145 };
00146 
00147 // .NAME vtkPhilipsPAR - read Philips PAR/REC image files
00148 // .SECTION Description
00149 // Class for reading parameters from a Philips PAR file.
00150 //
00151 // .SECTION See Also
00152 // vtkPhilipsRECReader
00153 
00154 class VTK_CNMRR_IO_EXPORT vtkPhilipsPAR : public vtkObject
00155 {
00156 public:
00157   static vtkPhilipsPAR *New();
00158 
00159   vtkTypeRevisionMacro(vtkPhilipsPAR,vtkObject);
00160   void PrintSelf(ostream& os, vtkIndent indent);
00161 
00162 
00163   // Reads the PAR file parameters in "parFile" and stores the PAR parameters in 
00164   // pPar.
00165   // Returns false if an error is encountered during reading, otherwise true is 
00166   // returned.
00167   bool ReadPAR(std::string parFile, struct par_parameter* pPar);
00168 
00169   // Returns a vector of paired values, the first contains the slice index and the 
00170   // second is the image type for the PAR file "parFile".
00171   std::vector< std::pair< int, int > > GetRECSliceIndexImageTypes(
00172     std::string parFile);
00173 
00174   // Returns a vector of paired values, the first contains the slice index and the 
00175   // second is the scan sequence for the PAR file "parFile".
00176   std::vector< std::pair< int, int > > GetRECSliceIndexScanningSequence(
00177     std::string parFile);
00178 
00179   // Returns a vector of paired values, the first contains the image type and the 
00180   // second is the scan sequence for that image type for the PAR file "parFile".
00181   std::vector< std::pair< int, int > > GetImageTypesScanningSequence(
00182     std::string parFile);
00183 
00184   // Stores rescale values in the VectorContainer "rescaleValues" for each image 
00185   // type of the specified scan sequence number "scan_sequence" (from 
00186   // scanning_sequences) for the PAR file "parFile".
00187   // Returns false if an error is encountered during reading, otherwise true is 
00188   // returned.
00189   bool GetRECRescaleValues(std::string parFile,
00190     std::vector< std::vector< float > > *rescaleValues, int scan_sequence);
00191 
00192   // Stores the diffusion gradient values in the VectorContainer "gradientValues" 
00193   // and the diffusion b values in the VectorContainer "bValues" for each gradient 
00194   // direction in the PAR file "parFile".  This function is applicable only for PAR
00195   // versions > 4.1
00196   // Returns false if an error is encountered during reading, otherwise true is 
00197   // returned.
00198   bool GetDiffusionGradientOrientationAndBValues(std::string parFile,
00199     std::vector< std::vector< float > > *gradientValues,
00200    std::vector< float > *bValues);
00201 
00202   // Returns a vector of ASL label types for the PAR file "parFile".
00203   std::vector< int > GetLabelTypesASL(std::string parFile);
00204 
00205   // Read a line number within the PAR file.
00206   std::string GetLineNumber(std::string file, int lineNum);
00207 
00208 protected:
00209   vtkPhilipsPAR();
00210   ~vtkPhilipsPAR();
00211 
00212 private:
00213   vtkPhilipsPAR(const vtkPhilipsPAR&); //purposely not implemented
00214   void operator=(const vtkPhilipsPAR&); //purposely not implemented
00215 
00217   int GetPARVersion(std::string parFile);
00218 
00220   std::string GetGeneralInfoString(std::string file, int lineNum);
00221 
00223   std::string FileName;
00224 
00226   std::vector<std::string> PARFileLines;
00227 
00228 };
00229 
00230 #endif                           /*_PhilipsPAR_h*/

Generated on Tue May 12 14:53:03 2009 for vtkCNMRRLibrary by  doxygen 1.4.7