ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkPhilipsPAR.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
33
34#ifndef itkPhilipsPAR_h
35#define itkPhilipsPAR_h
36#include "ITKIOPhilipsRECExport.h"
37
38#include <cstdio>
39#include <cstdlib>
40#include <string>
42#include "itkVectorContainer.h"
43#include "vnl/vnl_vector_fixed.h"
44
45enum
46{
52};
53
54enum
55{
64};
65
66enum
67{
71};
72
73namespace itk
74{
78struct par_parameter // par_parameter
79{
80 int problemreading; // Marked 1 if problem
81 // occurred reading in
82 // PAR file
83 int ResToolsVersion; // V3, V4, V4.1, or
84 // V4.2 PAR/REC
85 // version
87 char exam_name[PAR_DEFAULT_STRING_LENGTH]; // Examination name
90 // date/time
92 // date/time
94 int scno; // Acquisition nr
95 int recno; // Reconstruction nr
96 int scan_duration; // Scan Duration [sec]
97 int cardiac_phases; // Max. number of
98 // cardiac phases
100 // (float)
101 int echoes; // Max. number of
102 // echoes
103 float echo_times[PAR_DEFAULT_ECHO_TIMES_SIZE]; // Echo times read
104 // from PAR file
105 int slice; // Max. number of
106 // slices/locations
107 int dyn; // Max. number of
108 // dynamics
109 int mixes; // Max. number of
110 // mixes
113 // direction
114 short bit; // Image pixel size [8
115 // or 16 bits]
118 int num_averages; // Number of averages
119 int scan_resolution[2]; // Scan resolution
120 // (x, y)
121 int scan_percent; // Scan percentage
122 int dim[3]; // Recon resolution
123 // (x, y) + slices (z)
125 // [msec]
126 int sliceorient; // slice orientation (
127 // TRA/SAG/COR )
128 // (integer)
129 float slth; // Slice thickness
130 // [mm]
131 float gap; // Slice gap [mm]
132 float fov[3]; // FOV (ap,fh,rl) [mm]
133 float water_fat_shift; // Water Fat shift
134 // [pixels]
135 float angAP; // Angulation
136 // midslice(ap,fh,rl)[degr]
137 float angFH; // Angulation
138 // midslice(ap,fh,rl)[degr]
139 float angRL; // Angulation
140 // midslice(ap,fh,rl)[degr]
141 float offAP; // Off Centre
142 // midslice(ap,fh,rl)
143 // [mm]
144 float offFH; // Off Centre
145 // midslice(ap,fh,rl)
146 // [mm]
147 float offRL; // Off Centre
148 // midslice(ap,fh,rl)
149 // [mm]
150 int flow_comp; // Flow compensation
151 // <0=no 1=yes> ?
152 int presaturation; // Presaturation
153 // <0=no 1=yes> ?
154 int cardiac_freq; // Cardiac frequency
155 int min_rr_int; // Min. RR interval
156 int max_rr_int; // Max. RR interval
157 float phase_encode_vel[3]; // Phase encoding
158 // velocity [cm/sec]
159 int mtc; // MTC
160 // <0=no
161 // 1=yes> ?
162 int spir; // SPIR
163 // <0=no
164 // 1=yes> ?
165 int epi; // EPI factor
166 // <0,1=no EPI>
167 int turbo; // TURBO factor
168 // <0=no turbo>
169 int dynamic_scan; // Dynamic scan
170 // <0=no 1=yes> ?
171 int diffusion; // Diffusion
172 // <0=no
173 // 1=yes> ?
174 float diff_echo; // Diffusion echo time
175 // [msec]
176 float inversion_delay; // Inversion delay
177 // [msec]
178 int max_num_diff_vals; // Max. number of
179 // diffusion values
180 int max_num_grad_orient; // Max. number of
181 // gradient orients
182 int num_label_types; // Number of label
183 // types <0=no ASL>
184 float vox[3]; // pixel spacing (x,y)
185 // (in mm)
186 int slicessorted; // 1-slices sorted,
187 // 0-slices not sorted
188 int image_blocks; // The total number of
189 // image blocks stored
190 // in the REC file
191 int num_image_types; // The number of image
192 // types in the REC
193 // file
194 int image_types[PAR_DEFAULT_IMAGE_TYPES_SIZE]; // The different image
195 // types
196 // detected in the REC
197 int num_scanning_sequences; // The number of
198 // scanning sequences
199 // in the REC file
201 // scanning sequences
202 // detected in the REC
204 // num_scanning_sequences
205 // > 1 then
206 // num_image_types may not equal the total number of slice
207 // repetitions for a single acquisition. This value is the
208 // total number of slice repetitions for a single acquisition
209 // and is valid only when slicessorted == 0.
210};
211
221class ITKIOPhilipsREC_EXPORT PhilipsPAR : public LightProcessObject
222{
223public:
224 ITK_DISALLOW_COPY_AND_MOVE(PhilipsPAR);
225
230
232 itkNewMacro(Self);
233
235 itkOverrideGetNameOfClassMacro(PhilipsPAR);
236
237 // Reads the PAR file parameters in "parFile" and stores the PAR parameters in
238 // pPar.
239 // Returns false if an error is encountered during reading, otherwise true is
240 // returned.
241 void
242 ReadPAR(std::string parFile, struct par_parameter * pPar);
243
244 // Returns a vector of paired values, the first contains the slice index and
245 // the
246 // second is the image type for the PAR file "parFile".
247 using PARSliceIndexImageType = std::pair<int, int>;
248 using PARSliceIndexImageTypeVector = std::vector<PARSliceIndexImageType>;
250 GetRECSliceIndexImageTypes(std::string parFile);
251
252 // Returns a vector of paired values, the first contains the slice index and
253 // the
254 // second is the scan sequence for the PAR file "parFile".
255 using PARSliceIndexScanSequence = std::pair<int, int>;
256 using PARSliceIndexScanSequenceVector = std::vector<PARSliceIndexScanSequence>;
259
260 // Returns a vector of paired values, the first contains the image type and
261 // the
262 // second is the scan sequence for that image type for the PAR file "parFile".
263 using PARImageTypeScanSequence = std::pair<int, int>;
264 using PARImageTypeScanSequenceVector = std::vector<PARImageTypeScanSequence>;
266 GetImageTypesScanningSequence(std::string parFile);
267
268 // Stores rescale values in the VectorContainer "rescaleValues" for each image
269 // type of the specified scan sequence number "scan_sequence" (from
270 // scanning_sequences) for the PAR file "parFile".
271 // Returns false if an error is encountered during reading, otherwise true is
272 // returned.
273 using PARRescaleValues = vnl_vector_fixed<double, PAR_RESCALE_VALUES_SIZE>;
275 bool
276 GetRECRescaleValues(std::string parFile, PARRescaleValuesContainer * rescaleValues, int scan_sequence);
277
278 // Stores the diffusion gradient values in the VectorContainer
279 // "gradientValues"
280 // and the diffusion b values in the VectorContainer "bValues" for each
281 // gradient
282 // direction in the PAR file "parFile". This function is applicable only for
283 // PAR
284 // versions > 4.1
285 // Returns false if an error is encountered during reading, otherwise true is
286 // returned.
287 using PARDiffusionValues = vnl_vector_fixed<double, PAR_DIFFUSION_VALUES_SIZE>;
290 bool
292 PARDiffusionValuesContainer * gradientValues,
293 PARBValuesContainer * bValues);
294
295 // Returns a vector of ASL label types for the PAR file "parFile".
297 bool
298 GetLabelTypesASL(std::string parFile, PARLabelTypesASLContainer * labelTypes);
299
300 // Read a line number within the PAR file.
301 std::string
302 GetLineNumber(std::string file, int lineNum);
303
304protected:
306 ~PhilipsPAR() override;
307 void
308 PrintSelf(std::ostream & os, Indent indent) const override;
309
310private:
312 int
313 GetPARVersion(std::string parFile);
314
316 std::string
317 GetGeneralInfoString(std::string file, int lineNum);
318
320 std::string m_FileName{};
321
323 std::vector<std::string> m_PARFileLines{};
324};
325} // end namespace itk
326
327#endif /* itkPhilipsPAR_h */
Control indentation during Print() invocation.
Definition itkIndent.h:53
vnl_vector_fixed< double, PAR_RESCALE_VALUES_SIZE > PARRescaleValues
std::string GetGeneralInfoString(std::string file, int lineNum)
void ReadPAR(std::string parFile, struct par_parameter *pPar)
VectorContainer< unsigned int, PARRescaleValues > PARRescaleValuesContainer
std::vector< std::string > m_PARFileLines
std::pair< int, int > PARSliceIndexScanSequence
VectorContainer< unsigned int, int > PARLabelTypesASLContainer
std::vector< PARSliceIndexScanSequence > PARSliceIndexScanSequenceVector
std::pair< int, int > PARSliceIndexImageType
bool GetLabelTypesASL(std::string parFile, PARLabelTypesASLContainer *labelTypes)
~PhilipsPAR() override
VectorContainer< unsigned int, PARDiffusionValues > PARDiffusionValuesContainer
SmartPointer< Self > Pointer
PARSliceIndexScanSequenceVector GetRECSliceIndexScanningSequence(std::string parFile)
void PrintSelf(std::ostream &os, Indent indent) const override
PARImageTypeScanSequenceVector GetImageTypesScanningSequence(std::string parFile)
vnl_vector_fixed< double, PAR_DIFFUSION_VALUES_SIZE > PARDiffusionValues
PARSliceIndexImageTypeVector GetRECSliceIndexImageTypes(std::string parFile)
VectorContainer< unsigned int, double > PARBValuesContainer
std::vector< PARSliceIndexImageType > PARSliceIndexImageTypeVector
std::vector< PARImageTypeScanSequence > PARImageTypeScanSequenceVector
int GetPARVersion(std::string parFile)
bool GetDiffusionGradientOrientationAndBValues(std::string parFile, PARDiffusionValuesContainer *gradientValues, PARBValuesContainer *bValues)
std::pair< int, int > PARImageTypeScanSequence
std::string m_FileName
std::string GetLineNumber(std::string file, int lineNum)
bool GetRECRescaleValues(std::string parFile, PARRescaleValuesContainer *rescaleValues, int scan_sequence)
LightProcessObject Superclass
Implements transparent reference counting.
@ PAR_SLICE_ORIENTATION_TRANSVERSAL
@ PAR_SLICE_ORIENTATION_SAGITTAL
@ PAR_SLICE_ORIENTATION_CORONAL
@ PAR_DEFAULT_REP_TIMES_SIZE
@ PAR_DEFAULT_STRING_LENGTH
@ PAR_DEFAULT_SCAN_SEQUENCE_SIZE
@ PAR_DEFAULT_ECHO_TIMES_SIZE
@ PAR_DEFAULT_TRIGGER_TIMES_SIZE
@ PAR_DEFAULT_IMAGE_TYPES_SIZE
@ PAR_RESCALE_VALUES_SIZE
@ PAR_DIFFUSION_VALUES_SIZE
@ RESEARCH_IMAGE_EXPORT_TOOL_V4
@ RESEARCH_IMAGE_EXPORT_TOOL_V4_1
@ RESEARCH_IMAGE_EXPORT_TOOL_V3
@ RESEARCH_IMAGE_EXPORT_TOOL_UNKNOWN
@ RESEARCH_IMAGE_EXPORT_TOOL_V4_2
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
detail::VectorContainer< std::conditional_t< std::is_void_v< T2 >, SizeValueType, T1 >, std::conditional_t< std::is_void_v< T2 >, T1, T2 > > VectorContainer
float trigger_times[PAR_DEFAULT_TRIGGER_TIMES_SIZE]
int scanning_sequences[PAR_DEFAULT_SCAN_SEQUENCE_SIZE]
char technique[PAR_DEFAULT_STRING_LENGTH]
char exam_date[PAR_DEFAULT_STRING_LENGTH]
float echo_times[PAR_DEFAULT_ECHO_TIMES_SIZE]
int image_types[PAR_DEFAULT_IMAGE_TYPES_SIZE]
char patient_name[PAR_DEFAULT_STRING_LENGTH]
char protocol_name[PAR_DEFAULT_STRING_LENGTH]
char exam_name[PAR_DEFAULT_STRING_LENGTH]
char series_type[PAR_DEFAULT_STRING_LENGTH]
char prep_direction[PAR_DEFAULT_STRING_LENGTH]
float repetition_time[PAR_DEFAULT_REP_TIMES_SIZE]
char patient_position[PAR_DEFAULT_STRING_LENGTH]
char exam_time[PAR_DEFAULT_STRING_LENGTH]
char scan_mode[PAR_DEFAULT_STRING_LENGTH]