00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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
00072 {
00073 int problemreading;
00074 int ResToolsVersion;
00075 char patient_name[PAR_DEFAULT_STRING_LENGTH];
00076 char exam_name[PAR_DEFAULT_STRING_LENGTH];
00077 char protocol_name[PAR_DEFAULT_STRING_LENGTH];
00078 char exam_date[PAR_DEFAULT_STRING_LENGTH];
00079 char exam_time[PAR_DEFAULT_STRING_LENGTH];
00080 char series_type[PAR_DEFAULT_STRING_LENGTH];
00081 int scno;
00082 int recno;
00083 int scan_duration;
00084 int cardiac_phases;
00085 float trigger_times[PAR_DEFAULT_TRIGGER_TIMES_SIZE];
00086 int echoes;
00087 float echo_times[PAR_DEFAULT_ECHO_TIMES_SIZE];
00088 int slice;
00089 int dyn;
00090 int mixes;
00091 char patient_position[PAR_DEFAULT_STRING_LENGTH];
00092 char prep_direction[PAR_DEFAULT_STRING_LENGTH];
00093 short int bit;
00094 char technique[PAR_DEFAULT_STRING_LENGTH];
00095 char scan_mode[PAR_DEFAULT_STRING_LENGTH];
00096 int num_averages;
00097 int scan_resolution[2];
00098 int scan_percent;
00099 int dim[3];
00100 float repetition_time[PAR_DEFAULT_REP_TIMES_SIZE];
00101 int sliceorient;
00102 float slth;
00103 float gap;
00104 float fov[3];
00105 float water_fat_shift;
00106 float angAP;
00107 float angFH;
00108 float angRL;
00109 float offAP;
00110 float offFH;
00111 float offRL;
00112 int flow_comp;
00113 int presaturation;
00114 int cardiac_freq;
00115 int min_rr_int;
00116 int max_rr_int;
00117 float phase_encode_vel[3];
00118 int mtc;
00119 int spir;
00120 int epi;
00121 int turbo;
00122 int dynamic_scan;
00123 int diffusion;
00124 float diff_echo;
00125 float inversion_delay;
00126 int max_num_diff_vals;
00127 int max_num_grad_orient;
00128 int num_label_types;
00129 float vox[3];
00130 int slicessorted;
00131 int image_blocks;
00132 int num_image_types;
00133 int image_types[PAR_DEFAULT_IMAGE_TYPES_SIZE];
00134
00135 int num_scanning_sequences;
00136 int scanning_sequences[PAR_DEFAULT_SCAN_SEQUENCE_SIZE];
00137
00138
00139 int num_slice_repetitions;
00140
00141
00142
00143
00144
00145 };
00146
00147
00148
00149
00150
00151
00152
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
00164
00165
00166
00167 bool ReadPAR(std::string parFile, struct par_parameter* pPar);
00168
00169
00170
00171 std::vector< std::pair< int, int > > GetRECSliceIndexImageTypes(
00172 std::string parFile);
00173
00174
00175
00176 std::vector< std::pair< int, int > > GetRECSliceIndexScanningSequence(
00177 std::string parFile);
00178
00179
00180
00181 std::vector< std::pair< int, int > > GetImageTypesScanningSequence(
00182 std::string parFile);
00183
00184
00185
00186
00187
00188
00189 bool GetRECRescaleValues(std::string parFile,
00190 std::vector< std::vector< float > > *rescaleValues, int scan_sequence);
00191
00192
00193
00194
00195
00196
00197
00198 bool GetDiffusionGradientOrientationAndBValues(std::string parFile,
00199 std::vector< std::vector< float > > *gradientValues,
00200 std::vector< float > *bValues);
00201
00202
00203 std::vector< int > GetLabelTypesASL(std::string parFile);
00204
00205
00206 std::string GetLineNumber(std::string file, int lineNum);
00207
00208 protected:
00209 vtkPhilipsPAR();
00210 ~vtkPhilipsPAR();
00211
00212 private:
00213 vtkPhilipsPAR(const vtkPhilipsPAR&);
00214 void operator=(const vtkPhilipsPAR&);
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