GDCM 2.0.17

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

Generated on Tue Feb 1 2011 23:59:13 for GDCM by doxygen 1.7.3
SourceForge.net Logo