GDCM 2.2.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

vtkMedicalImageProperties.h
Go to the documentation of this file.

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