# vtkGDCMMedicalImageProperties.h

Go to the documentation of this file.

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