GDCM
2.0.18
|
00001 /*========================================================================= 00002 00003 Program: GDCM (Grassroots DICOM). A DICOM library 00004 00005 Copyright (c) 2006-2011 Mathieu Malaterre 00006 All rights reserved. 00007 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. 00008 00009 This software is distributed WITHOUT ANY WARRANTY; without even 00010 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00011 PURPOSE. See the above copyright notice for more information. 00012 00013 =========================================================================*/ 00014 // .NAME vtkGDCMMedicalImageProperties - some medical image properties. 00015 // .SECTION Description 00016 // vtkGDCMMedicalImageProperties is a helper class that can be used by medical 00017 // image readers and applications to encapsulate medical image/acquisition 00018 // properties. Later on, this should probably be extended to add 00019 // any user-defined property. 00020 // .SECTION See Also 00021 // vtkMedicalImageReader2 00022 00023 #ifndef VTKGDCMMEDICALIMAGEPROPERTIES_H 00024 #define VTKGDCMMEDICALIMAGEPROPERTIES_H 00025 00026 #include "vtkMedicalImageProperties.h" 00027 00028 class vtkGDCMMedicalImagePropertiesInternals; 00029 //BTX 00030 namespace gdcm { class File; } 00031 //ETX 00032 00033 class VTK_EXPORT vtkGDCMMedicalImageProperties : public vtkMedicalImageProperties 00034 { 00035 public: 00036 static vtkGDCMMedicalImageProperties *New(); 00037 vtkTypeRevisionMacro(vtkGDCMMedicalImageProperties,vtkMedicalImageProperties); 00038 void PrintSelf(ostream& os, vtkIndent indent); 00039 00040 // Description: 00041 // Convenience method to reset all fields to an emptry string/value 00042 virtual void Clear(); 00043 00044 /* 00045 // Description: 00046 // Patient name 00047 // For ex: DICOM (0010,0010) = DOE,JOHN 00048 vtkSetStringMacro(PatientName); 00049 vtkGetStringMacro(PatientName); 00050 00051 // Description: 00052 // Patient ID 00053 // For ex: DICOM (0010,0020) = 1933197 00054 vtkSetStringMacro(PatientID); 00055 vtkGetStringMacro(PatientID); 00056 00057 // Description: 00058 // Patient age 00059 // Format: nnnD, nnW, nnnM or nnnY (eventually nnD, nnW, nnY) 00060 // with D (day), M (month), W (week), Y (year) 00061 // For ex: DICOM (0010,1010) = 031Y 00062 vtkSetStringMacro(PatientAge); 00063 vtkGetStringMacro(PatientAge); 00064 00065 // Description: 00066 // Take as input a string in VR=AS (DICOM PS3.5) and extract either 00067 // different fields namely: year month week day 00068 // Return 0 on error, 1 on success 00069 // One can test fields if they are different from -1 upon success 00070 static int GetAgeAsFields(const char *age, int &year, int &month, int &week, int &day); 00071 00072 // For Tcl: 00073 // From C++ use GetPatientAge + GetAgeAsField 00074 // Those function parse a DICOM string, and return the value of the number expressed 00075 // this is either expressed in year, month or days. Thus if a string is expressed in years 00076 // GetPatientAgeDay/GetPatientAgeWeek/GetPatientAgeMonth will return 0 00077 int GetPatientAgeYear(); 00078 int GetPatientAgeMonth(); 00079 int GetPatientAgeWeek(); 00080 int GetPatientAgeDay(); 00081 00082 // Description: 00083 // Patient sex 00084 // For ex: DICOM (0010,0040) = M 00085 vtkSetStringMacro(PatientSex); 00086 vtkGetStringMacro(PatientSex); 00087 00088 // Description: 00089 // Patient birth date 00090 // Format: yyyymmdd 00091 // For ex: DICOM (0010,0030) = 19680427 00092 vtkSetStringMacro(PatientBirthDate); 00093 vtkGetStringMacro(PatientBirthDate); 00094 00095 // For Tcl: 00096 // From C++ use GetPatientBirthDate + GetDateAsFields 00097 int GetPatientBirthDateYear(); 00098 int GetPatientBirthDateMonth(); 00099 int GetPatientBirthDateDay(); 00100 00101 // Description: 00102 // Study Date 00103 // Format: yyyymmdd 00104 // For ex: DICOM (0008,0020) = 20030617 00105 vtkSetStringMacro(StudyDate); 00106 vtkGetStringMacro(StudyDate); 00107 00108 // Description: 00109 // Acquisition Date 00110 // Format: yyyymmdd 00111 // For ex: DICOM (0008,0022) = 20030617 00112 vtkSetStringMacro(AcquisitionDate); 00113 vtkGetStringMacro(AcquisitionDate); 00114 00115 // For Tcl: 00116 // From C++ use GetAcquisitionDate + GetDateAsFields 00117 int GetAcquisitionDateYear(); 00118 int GetAcquisitionDateMonth(); 00119 int GetAcquisitionDateDay(); 00120 00121 // Description: 00122 // Study Time 00123 // Format: hhmmss.frac (any trailing component(s) can be ommited) 00124 // For ex: DICOM (0008,0030) = 162552.0705 or 230012, or 0012 00125 vtkSetStringMacro(StudyTime); 00126 vtkGetStringMacro(StudyTime); 00127 00128 // Description: 00129 // Acquisition time 00130 // Format: hhmmss.frac (any trailing component(s) can be ommited) 00131 // For ex: DICOM (0008,0032) = 162552.0705 or 230012, or 0012 00132 vtkSetStringMacro(AcquisitionTime); 00133 vtkGetStringMacro(AcquisitionTime); 00134 00135 // Description: 00136 // Image Date aka Content Date 00137 // Format: yyyymmdd 00138 // For ex: DICOM (0008,0023) = 20030617 00139 vtkSetStringMacro(ImageDate); 00140 vtkGetStringMacro(ImageDate); 00141 00142 // For Tcl: 00143 // From C++ use GetImageDate + GetDateAsFields 00144 int GetImageDateYear(); 00145 int GetImageDateMonth(); 00146 int GetImageDateDay(); 00147 00148 // Description: 00149 // Take as input a string in ISO 8601 date (YYYY/MM/DD) and extract the 00150 // different fields namely: year month day 00151 // Return 0 on error, 1 on success 00152 static int GetDateAsFields(const char *date, int &year, int &month, int &day); 00153 00154 // Description: 00155 // Take as input a string in ISO 8601 date (YYYY/MM/DD) and construct a 00156 // locale date based on the different fields (see GetDateAsFields to extract 00157 // different fields) 00158 // Return 0 on error, 1 on success 00159 static int GetDateAsLocale(const char *date, char *locale); 00160 00161 // Description: 00162 // Image Time 00163 // Format: hhmmss.frac (any trailing component(s) can be ommited) 00164 // For ex: DICOM (0008,0033) = 162552.0705 or 230012, or 0012 00165 vtkSetStringMacro(ImageTime); 00166 vtkGetStringMacro(ImageTime); 00167 00168 // Description: 00169 // Image number 00170 // For ex: DICOM (0020,0013) = 1 00171 vtkSetStringMacro(ImageNumber); 00172 vtkGetStringMacro(ImageNumber); 00173 00174 // Description: 00175 // Series number 00176 // For ex: DICOM (0020,0011) = 902 00177 vtkSetStringMacro(SeriesNumber); 00178 vtkGetStringMacro(SeriesNumber); 00179 00180 // Description: 00181 // Series Description 00182 // User provided description of the Series 00183 // For ex: DICOM (0008,103e) = SCOUT 00184 vtkSetStringMacro(SeriesDescription); 00185 vtkGetStringMacro(SeriesDescription); 00186 00187 // Description: 00188 // Study ID 00189 // For ex: DICOM (0020,0010) = 37481 00190 vtkSetStringMacro(StudyID); 00191 vtkGetStringMacro(StudyID); 00192 00193 // Description: 00194 // Study description 00195 // For ex: DICOM (0008,1030) = BRAIN/C-SP/FACIAL 00196 vtkSetStringMacro(StudyDescription); 00197 vtkGetStringMacro(StudyDescription); 00198 00199 // Description: 00200 // Modality 00201 // For ex: DICOM (0008,0060)= CT 00202 vtkSetStringMacro(Modality); 00203 vtkGetStringMacro(Modality); 00204 00205 // Description: 00206 // Manufacturer 00207 // For ex: DICOM (0008,0070) = Siemens 00208 vtkSetStringMacro(Manufacturer); 00209 vtkGetStringMacro(Manufacturer); 00210 00211 // Description: 00212 // Manufacturer's Model Name 00213 // For ex: DICOM (0008,1090) = LightSpeed QX/i 00214 vtkSetStringMacro(ManufacturerModelName); 00215 vtkGetStringMacro(ManufacturerModelName); 00216 00217 // Description: 00218 // Station Name 00219 // For ex: DICOM (0008,1010) = LSPD_OC8 00220 vtkSetStringMacro(StationName); 00221 vtkGetStringMacro(StationName); 00222 00223 // Description: 00224 // Institution Name 00225 // For ex: DICOM (0008,0080) = FooCity Medical Center 00226 vtkSetStringMacro(InstitutionName); 00227 vtkGetStringMacro(InstitutionName); 00228 00229 // Description: 00230 // Convolution Kernel (or algorithm used to reconstruct the data) 00231 // For ex: DICOM (0018,1210) = Bone 00232 vtkSetStringMacro(ConvolutionKernel); 00233 vtkGetStringMacro(ConvolutionKernel); 00234 00235 // Description: 00236 // Slice Thickness (Nominal reconstructed slice thickness, in mm) 00237 // For ex: DICOM (0018,0050) = 0.273438 00238 vtkSetStringMacro(SliceThickness); 00239 vtkGetStringMacro(SliceThickness); 00240 virtual double GetSliceThicknessAsDouble(); 00241 00242 // Description: 00243 // Peak kilo voltage output of the (x-ray) generator used 00244 // For ex: DICOM (0018,0060) = 120 00245 vtkSetStringMacro(KVP); 00246 vtkGetStringMacro(KVP); 00247 00248 // Description: 00249 // Gantry/Detector tilt (Nominal angle of tilt in degrees of the scanning 00250 // gantry.) 00251 // For ex: DICOM (0018,1120) = 15 00252 vtkSetStringMacro(GantryTilt); 00253 vtkGetStringMacro(GantryTilt); 00254 virtual double GetGantryTiltAsDouble(); 00255 00256 // Description: 00257 // Echo Time 00258 // (Time in ms between the middle of the excitation pulse and the peak of 00259 // the echo produced) 00260 // For ex: DICOM (0018,0081) = 105 00261 vtkSetStringMacro(EchoTime); 00262 vtkGetStringMacro(EchoTime); 00263 00264 // Description: 00265 // Echo Train Length 00266 // (Number of lines in k-space acquired per excitation per image) 00267 // For ex: DICOM (0018,0091) = 35 00268 vtkSetStringMacro(EchoTrainLength); 00269 vtkGetStringMacro(EchoTrainLength); 00270 00271 // Description: 00272 // Repetition Time 00273 // The period of time in msec between the beginning of a pulse sequence and 00274 // the beginning of the succeeding (essentially identical) pulse sequence. 00275 // For ex: DICOM (0018,0080) = 2040 00276 vtkSetStringMacro(RepetitionTime); 00277 vtkGetStringMacro(RepetitionTime); 00278 00279 // Description: 00280 // Exposure time (time of x-ray exposure in msec) 00281 // For ex: DICOM (0018,1150) = 5 00282 vtkSetStringMacro(ExposureTime); 00283 vtkGetStringMacro(ExposureTime); 00284 00285 // Description: 00286 // X-ray tube current (in mA) 00287 // For ex: DICOM (0018,1151) = 400 00288 vtkSetStringMacro(XRayTubeCurrent); 00289 vtkGetStringMacro(XRayTubeCurrent); 00290 00291 // Description: 00292 // Exposure (The exposure expressed in mAs, for example calculated 00293 // from Exposure Time and X-ray Tube Current) 00294 // For ex: DICOM (0018,1152) = 114 00295 vtkSetStringMacro(Exposure); 00296 vtkGetStringMacro(Exposure); 00297 00298 // Interface to allow insertion of user define values, for instance in DICOM one would want to 00299 // store the Protocol Name (0018,1030), in this case one would do: 00300 // AddUserDefinedValue( "Protocol Name", "T1W/SE/1024" ); 00301 void AddUserDefinedValue(const char *name, const char *value); 00302 // Get a particular user value 00303 const char *GetUserDefinedValue(const char *name); 00304 // Get the number of user defined values 00305 unsigned int GetNumberOfUserDefinedValues(); 00306 // Get a name/value by index 00307 const char *GetUserDefinedNameByIndex(unsigned int idx); 00308 const char *GetUserDefinedValueByIndex(unsigned int idx); 00309 00310 // Description: 00311 // Copy the contents of p to this instance. 00312 virtual void DeepCopy(vtkGDCMMedicalImageProperties *p); 00313 00314 // Description: 00315 // Add/Remove/Query the window/level presets that may have been associated 00316 // to a medical image. Window is also known as 'width', level is also known 00317 // as 'center'. The same window/level pair can not be added twice. 00318 // As a convenience, a comment (aka Explanation) can be associated to a preset. 00319 // For ex: DICOM Window Center (0028,1050) = 00045\000470 00320 // DICOM Window Width (0028,1051) = 0106\03412 00321 // DICOM Window Center Width Explanation (0028,1055) = WINDOW1\WINDOW2 00322 virtual void AddWindowLevelPreset(double w, double l); 00323 virtual void RemoveWindowLevelPreset(double w, double l); 00324 virtual void RemoveAllWindowLevelPresets(); 00325 virtual int GetNumberOfWindowLevelPresets(); 00326 virtual int HasWindowLevelPreset(double w, double l); 00327 virtual int GetNthWindowLevelPreset(int idx, double *w, double *l); 00328 virtual double* GetNthWindowLevelPreset(int idx); 00329 virtual void SetNthWindowLevelPresetComment(int idx, const char *comment); 00330 virtual const char* GetNthWindowLevelPresetComment(int idx); 00331 00332 // Description: 00333 // Mapping from a sliceidx within a volumeidx into a DICOM Instance UID 00334 // Some DICOM reader can populate this structure so that later on from a slice index 00335 // in a vtkImageData volume we can backtrack and find out which 2d slice it was coming from 00336 const char *GetInstanceUIDFromSliceID(int volumeidx, int sliceid); 00337 void SetInstanceUIDFromSliceID(int volumeidx, int sliceid, const char *uid); 00338 00339 // Description: 00340 // Provides the inverse mapping. Returns -1 if a slice for this uid is 00341 // not found. 00342 int GetSliceIDFromInstanceUID(int &volumeidx, const char *uid); 00343 00344 //BTX 00345 typedef enum { 00346 AXIAL = 0, 00347 CORONAL, 00348 SAGITTAL 00349 } OrientationType; 00350 //ETX 00351 int GetOrientationType(int volumeidx); 00352 void SetOrientationType(int volumeidx, int orientation); 00353 static const char *GetStringFromOrientationType(unsigned int type); 00354 */ 00355 protected: 00356 vtkGDCMMedicalImageProperties(); 00357 ~vtkGDCMMedicalImageProperties(); 00358 00359 //BTX 00360 friend class vtkGDCMImageReader; 00361 friend class vtkGDCMImageWriter; 00362 void PushBackFile(gdcm::File const &f); 00363 gdcm::File const & GetFile(unsigned int t); 00364 //ETX 00365 00366 private: 00367 vtkGDCMMedicalImagePropertiesInternals *Internals; 00368 00369 vtkGDCMMedicalImageProperties(const vtkGDCMMedicalImageProperties&); // Not implemented. 00370 void operator=(const vtkGDCMMedicalImageProperties&); // Not implemented. 00371 }; 00372 00373 #endif