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

Generated on Sat Dec 21 2013 05:56:18 for GDCM by doxygen 1.8.5
SourceForge.net Logo