GDCM: vtkGDCMMedicalImageProperties.h Source File

GDCM 3.0.25

vtkGDCMMedicalImageProperties.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13=========================================================================*/
14// .NAME vtkGDCMMedicalImageProperties - some medical image properties.
15// .SECTION Description
16// vtkGDCMMedicalImageProperties is a helper class that can be used by medical
17// image readers and applications to encapsulate medical image/acquisition
18// properties. Later on, this should probably be extended to add
19// any user-defined property.
20// .SECTION See Also
21// vtkMedicalImageReader2
22
23#ifndef VTKGDCMMEDICALIMAGEPROPERTIES_H
24#define VTKGDCMMEDICALIMAGEPROPERTIES_H
25
26#include "vtkgdcmModule.h"
27#include "vtkMedicalImageProperties.h"
28
29class vtkGDCMMedicalImagePropertiesInternals;
30//BTX
31namespace gdcm { class File; }
32//ETX
33
34 class VTKGDCM_EXPORT vtkGDCMMedicalImageProperties : public vtkMedicalImageProperties
35{
36public:
37 static vtkGDCMMedicalImageProperties *New();
38 vtkTypeMacro(vtkGDCMMedicalImageProperties,vtkMedicalImageProperties);
39 void PrintSelf(ostream& os, vtkIndent indent);
40
41 // Description:
42 // Convenience method to reset all fields to an empty string/value
43 virtual void Clear();
44
45/*
46 // Description:
47 // Patient name
48 // For ex: DICOM (0010,0010) = DOE,JOHN
49 vtkSetStringMacro(PatientName);
50 vtkGetStringMacro(PatientName);
51
52 // Description:
53 // Patient ID
54 // For ex: DICOM (0010,0020) = 1933197
55 vtkSetStringMacro(PatientID);
56 vtkGetStringMacro(PatientID);
57
58 // Description:
59 // Patient age
60 // Format: nnnD, nnW, nnnM or nnnY (eventually nnD, nnW, nnY)
61 // with D (day), M (month), W (week), Y (year)
62 // For ex: DICOM (0010,1010) = 031Y
63 vtkSetStringMacro(PatientAge);
64 vtkGetStringMacro(PatientAge);
65
66 // Description:
67 // Take as input a string in VR=AS (DICOM PS3.5) and extract either
68 // different fields namely: year month week day
69 // Return 0 on error, 1 on success
70 // One can test fields if they are different from -1 upon success
71 static int GetAgeAsFields(const char *age, int &year, int &month, int &week, int &day);
72
73 // For Tcl:
74 // From C++ use GetPatientAge + GetAgeAsField
75 // Those function parse a DICOM string, and return the value of the number expressed
76 // this is either expressed in year, month or days. Thus if a string is expressed in years
77 // GetPatientAgeDay/GetPatientAgeWeek/GetPatientAgeMonth will return 0
78 int GetPatientAgeYear();
79 int GetPatientAgeMonth();
80 int GetPatientAgeWeek();
81 int GetPatientAgeDay();
82
83 // Description:
84 // Patient sex
85 // For ex: DICOM (0010,0040) = M
86 vtkSetStringMacro(PatientSex);
87 vtkGetStringMacro(PatientSex);
88
89 // Description:
90 // Patient birth date
91 // Format: yyyymmdd
92 // For ex: DICOM (0010,0030) = 19680427
93 vtkSetStringMacro(PatientBirthDate);
94 vtkGetStringMacro(PatientBirthDate);
95
96 // For Tcl:
97 // From C++ use GetPatientBirthDate + GetDateAsFields
98 int GetPatientBirthDateYear();
99 int GetPatientBirthDateMonth();
100 int GetPatientBirthDateDay();
101
102 // Description:
103 // Study Date
104 // Format: yyyymmdd
105 // For ex: DICOM (0008,0020) = 20030617
106 vtkSetStringMacro(StudyDate);
107 vtkGetStringMacro(StudyDate);
108
109 // Description:
110 // Acquisition Date
111 // Format: yyyymmdd
112 // For ex: DICOM (0008,0022) = 20030617
113 vtkSetStringMacro(AcquisitionDate);
114 vtkGetStringMacro(AcquisitionDate);
115
116 // For Tcl:
117 // From C++ use GetAcquisitionDate + GetDateAsFields
118 int GetAcquisitionDateYear();
119 int GetAcquisitionDateMonth();
120 int GetAcquisitionDateDay();
121
122 // Description:
123 // Study Time
124 // Format: hhmmss.frac (any trailing component(s) can be omitted)
125 // For ex: DICOM (0008,0030) = 162552.0705 or 230012, or 0012
126 vtkSetStringMacro(StudyTime);
127 vtkGetStringMacro(StudyTime);
128
129 // Description:
130 // Acquisition time
131 // Format: hhmmss.frac (any trailing component(s) can be omitted)
132 // For ex: DICOM (0008,0032) = 162552.0705 or 230012, or 0012
133 vtkSetStringMacro(AcquisitionTime);
134 vtkGetStringMacro(AcquisitionTime);
135
136 // Description:
137 // Image Date aka Content Date
138 // Format: yyyymmdd
139 // For ex: DICOM (0008,0023) = 20030617
140 vtkSetStringMacro(ImageDate);
141 vtkGetStringMacro(ImageDate);
142
143 // For Tcl:
144 // From C++ use GetImageDate + GetDateAsFields
145 int GetImageDateYear();
146 int GetImageDateMonth();
147 int GetImageDateDay();
148
149 // Description:
150 // Take as input a string in ISO 8601 date (YYYY/MM/DD) and extract the
151 // different fields namely: year month day
152 // Return 0 on error, 1 on success
153 static int GetDateAsFields(const char *date, int &year, int &month, int &day);
154
155 // Description:
156 // Take as input a string in ISO 8601 date (YYYY/MM/DD) and construct a
157 // locale date based on the different fields (see GetDateAsFields to extract
158 // different fields)
159 // Return 0 on error, 1 on success
160 static int GetDateAsLocale(const char *date, char *locale);
161
162 // Description:
163 // Image Time
164 // Format: hhmmss.frac (any trailing component(s) can be omitted)
165 // For ex: DICOM (0008,0033) = 162552.0705 or 230012, or 0012
166 vtkSetStringMacro(ImageTime);
167 vtkGetStringMacro(ImageTime);
168
169 // Description:
170 // Image number
171 // For ex: DICOM (0020,0013) = 1
172 vtkSetStringMacro(ImageNumber);
173 vtkGetStringMacro(ImageNumber);
174
175 // Description:
176 // Series number
177 // For ex: DICOM (0020,0011) = 902
178 vtkSetStringMacro(SeriesNumber);
179 vtkGetStringMacro(SeriesNumber);
180
181 // Description:
182 // Series Description
183 // User provided description of the Series
184 // For ex: DICOM (0008,103e) = SCOUT
185 vtkSetStringMacro(SeriesDescription);
186 vtkGetStringMacro(SeriesDescription);
187
188 // Description:
189 // Study ID
190 // For ex: DICOM (0020,0010) = 37481
191 vtkSetStringMacro(StudyID);
192 vtkGetStringMacro(StudyID);
193
194 // Description:
195 // Study description
196 // For ex: DICOM (0008,1030) = BRAIN/C-SP/FACIAL
197 vtkSetStringMacro(StudyDescription);
198 vtkGetStringMacro(StudyDescription);
199
200 // Description:
201 // Modality
202 // For ex: DICOM (0008,0060)= CT
203 vtkSetStringMacro(Modality);
204 vtkGetStringMacro(Modality);
205
206 // Description:
207 // Manufacturer
208 // For ex: DICOM (0008,0070) = Siemens
209 vtkSetStringMacro(Manufacturer);
210 vtkGetStringMacro(Manufacturer);
211
212 // Description:
213 // Manufacturer's Model Name
214 // For ex: DICOM (0008,1090) = LightSpeed QX/i
215 vtkSetStringMacro(ManufacturerModelName);
216 vtkGetStringMacro(ManufacturerModelName);
217
218 // Description:
219 // Station Name
220 // For ex: DICOM (0008,1010) = LSPD_OC8
221 vtkSetStringMacro(StationName);
222 vtkGetStringMacro(StationName);
223
224 // Description:
225 // Institution Name
226 // For ex: DICOM (0008,0080) = FooCity Medical Center
227 vtkSetStringMacro(InstitutionName);
228 vtkGetStringMacro(InstitutionName);
229
230 // Description:
231 // Convolution Kernel (or algorithm used to reconstruct the data)
232 // For ex: DICOM (0018,1210) = Bone
233 vtkSetStringMacro(ConvolutionKernel);
234 vtkGetStringMacro(ConvolutionKernel);
235
236 // Description:
237 // Slice Thickness (Nominal reconstructed slice thickness, in mm)
238 // For ex: DICOM (0018,0050) = 0.273438
239 vtkSetStringMacro(SliceThickness);
240 vtkGetStringMacro(SliceThickness);
241 virtual double GetSliceThicknessAsDouble();
242
243 // Description:
244 // Peak kilo voltage output of the (x-ray) generator used
245 // For ex: DICOM (0018,0060) = 120
246 vtkSetStringMacro(KVP);
247 vtkGetStringMacro(KVP);
248
249 // Description:
250 // Gantry/Detector tilt (Nominal angle of tilt in degrees of the scanning
251 // gantry.)
252 // For ex: DICOM (0018,1120) = 15
253 vtkSetStringMacro(GantryTilt);
254 vtkGetStringMacro(GantryTilt);
255 virtual double GetGantryTiltAsDouble();
256
257 // Description:
258 // Echo Time
259 // (Time in ms between the middle of the excitation pulse and the peak of
260 // the echo produced)
261 // For ex: DICOM (0018,0081) = 105
262 vtkSetStringMacro(EchoTime);
263 vtkGetStringMacro(EchoTime);
264
265 // Description:
266 // Echo Train Length
267 // (Number of lines in k-space acquired per excitation per image)
268 // For ex: DICOM (0018,0091) = 35
269 vtkSetStringMacro(EchoTrainLength);
270 vtkGetStringMacro(EchoTrainLength);
271
272 // Description:
273 // Repetition Time
274 // The period of time in msec between the beginning of a pulse sequence and
275 // the beginning of the succeeding (essentially identical) pulse sequence.
276 // For ex: DICOM (0018,0080) = 2040
277 vtkSetStringMacro(RepetitionTime);
278 vtkGetStringMacro(RepetitionTime);
279
280 // Description:
281 // Exposure time (time of x-ray exposure in msec)
282 // For ex: DICOM (0018,1150) = 5
283 vtkSetStringMacro(ExposureTime);
284 vtkGetStringMacro(ExposureTime);
285
286 // Description:
287 // X-ray tube current (in mA)
288 // For ex: DICOM (0018,1151) = 400
289 vtkSetStringMacro(XRayTubeCurrent);
290 vtkGetStringMacro(XRayTubeCurrent);
291
292 // Description:
293 // Exposure (The exposure expressed in mAs, for example calculated
294 // from Exposure Time and X-ray Tube Current)
295 // For ex: DICOM (0018,1152) = 114
296 vtkSetStringMacro(Exposure);
297 vtkGetStringMacro(Exposure);
298
299 // Interface to allow insertion of user define values, for instance in DICOM one would want to
300 // store the Protocol Name (0018,1030), in this case one would do:
301 // AddUserDefinedValue( "Protocol Name", "T1W/SE/1024" );
302 void AddUserDefinedValue(const char *name, const char *value);
303 // Get a particular user value
304 const char *GetUserDefinedValue(const char *name);
305 // Get the number of user defined values
306 unsigned int GetNumberOfUserDefinedValues();
307 // Get a name/value by index
308 const char *GetUserDefinedNameByIndex(unsigned int idx);
309 const char *GetUserDefinedValueByIndex(unsigned int idx);
310
311 // Description:
312 // Copy the contents of p to this instance.
313 virtual void DeepCopy(vtkGDCMMedicalImageProperties *p);
314
315 // Description:
316 // Add/Remove/Query the window/level presets that may have been associated
317 // to a medical image. Window is also known as 'width', level is also known
318 // as 'center'. The same window/level pair can not be added twice.
319 // As a convenience, a comment (aka Explanation) can be associated to a preset.
320 // For ex: DICOM Window Center (0028,1050) = 00045\000470
321 // DICOM Window Width (0028,1051) = 0106\03412
322 // DICOM Window Center Width Explanation (0028,1055) = WINDOW1\WINDOW2
323 virtual void AddWindowLevelPreset(double w, double l);
324 virtual void RemoveWindowLevelPreset(double w, double l);
325 virtual void RemoveAllWindowLevelPresets();
326 virtual int GetNumberOfWindowLevelPresets();
327 virtual int HasWindowLevelPreset(double w, double l);
328 virtual int GetNthWindowLevelPreset(int idx, double *w, double *l);
329 virtual double* GetNthWindowLevelPreset(int idx);
330 virtual void SetNthWindowLevelPresetComment(int idx, const char *comment);
331 virtual const char* GetNthWindowLevelPresetComment(int idx);
332
333 // Description:
334 // Mapping from a sliceidx within a volumeidx into a DICOM Instance UID
335 // Some DICOM reader can populate this structure so that later on from a slice index
336 // in a vtkImageData volume we can backtrack and find out which 2d slice it was coming from
337 const char *GetInstanceUIDFromSliceID(int volumeidx, int sliceid);
338 void SetInstanceUIDFromSliceID(int volumeidx, int sliceid, const char *uid);
339
340 // Description:
341 // Provides the inverse mapping. Returns -1 if a slice for this uid is
342 // not found.
343 int GetSliceIDFromInstanceUID(int &volumeidx, const char *uid);
344
345//BTX
346 typedef enum {
347 AXIAL = 0,
348 CORONAL,
349 SAGITTAL
350 } OrientationType;
351//ETX
352 int GetOrientationType(int volumeidx);
353 void SetOrientationType(int volumeidx, int orientation);
354 static const char *GetStringFromOrientationType(unsigned int type);
355*/
356protected:
357 vtkGDCMMedicalImageProperties();
358 ~vtkGDCMMedicalImageProperties();
359
360//BTX
361 friend class vtkGDCMImageReader;
362 friend class vtkGDCMImageReader2;
363 friend class vtkGDCMImageWriter;
364 void PushBackFile(gdcm::File const &f);
365 gdcm::File const & GetFile(unsigned int t);
366//ETX
367
368private:
369 vtkGDCMMedicalImagePropertiesInternals *Internals;
370
371 vtkGDCMMedicalImageProperties(const vtkGDCMMedicalImageProperties&); // Not implemented.
372 void operator=(const vtkGDCMMedicalImageProperties&); // Not implemented.
373};
374
375#endif
gdcm::File
a DICOM File
Definition gdcmFile.h:34
vtkGDCMMedicalImageProperties::vtkGDCMImageReader
friend class vtkGDCMImageReader
Definition vtkGDCMMedicalImageProperties.h:361
vtkGDCMMedicalImageProperties::GetFile
gdcm::File const & GetFile(unsigned int t)
vtkGDCMMedicalImageProperties::vtkGDCMImageWriter
friend class vtkGDCMImageWriter
Definition vtkGDCMMedicalImageProperties.h:363
vtkGDCMMedicalImageProperties::Clear
virtual void Clear()
vtkGDCMMedicalImageProperties::vtkTypeMacro
vtkTypeMacro(vtkGDCMMedicalImageProperties, vtkMedicalImageProperties)
vtkGDCMMedicalImageProperties::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkGDCMMedicalImageProperties::~vtkGDCMMedicalImageProperties
~vtkGDCMMedicalImageProperties()
vtkGDCMMedicalImageProperties::vtkGDCMImageReader2
friend class vtkGDCMImageReader2
Definition vtkGDCMMedicalImageProperties.h:362
vtkGDCMMedicalImageProperties::vtkGDCMMedicalImageProperties
vtkGDCMMedicalImageProperties()
vtkGDCMMedicalImageProperties::New
static vtkGDCMMedicalImageProperties * New()
vtkGDCMMedicalImageProperties::PushBackFile
void PushBackFile(gdcm::File const &f)
gdcm
Definition gdcmASN1.h:21