Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkGDCMImageIO.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkGDCMImageIO.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-04-25 12:25:42 $
00007   Version:   $Revision: 1.39 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012   Portions of this code are covered under the VTK copyright.
00013   See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
00014 
00015      This software is distributed WITHOUT ANY WARRANTY; without even 
00016      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00017      PURPOSE.  See the above copyright notices for more information.
00018 
00019 =========================================================================*/
00020 #ifndef __itkGDCMImageIO_h
00021 #define __itkGDCMImageIO_h
00022 
00023 #include "itkImageIOBase.h"
00024 #include <fstream>
00025 #include <string>
00026 
00027 namespace itk
00028 {
00029 
00067 class InternalHeader;
00068 class ITK_EXPORT GDCMImageIO : public ImageIOBase
00069 {
00070 public:
00072   typedef GDCMImageIO         Self;
00073   typedef ImageIOBase         Superclass;
00074   typedef SmartPointer<Self>  Pointer;
00075 
00077   itkNewMacro(Self);
00078 
00080   itkTypeMacro(GDCMImageIO, Superclass);
00081 
00082   /*-------- This part of the interface deals with reading data. ------ */
00083 
00086   virtual bool CanReadFile(const char*);
00087 
00089   virtual void ReadImageInformation();
00090 
00092   virtual void Read(void* buffer);
00093 
00094   /*-------- This part of the interfaces deals with writing data. ----- */
00095 
00098   virtual bool CanWriteFile(const char*);
00099 
00102   virtual void WriteImageInformation();
00103 
00106   virtual void Write(const void* buffer);
00107 
00111   itkGetConstMacro(RescaleSlope, double);
00112   itkGetConstMacro(RescaleIntercept, double);
00114 
00119   itkGetStringMacro(UIDPrefix);
00120   itkSetStringMacro(UIDPrefix);
00122 
00124   itkGetStringMacro(StudyInstanceUID);
00125   itkGetStringMacro(SeriesInstanceUID);
00126   itkGetStringMacro(FrameOfReferenceInstanceUID);
00128 
00131   itkSetMacro(KeepOriginalUID,bool);
00132   itkGetConstMacro(KeepOriginalUID,bool);
00133   itkBooleanMacro(KeepOriginalUID);
00135 
00142   void GetPatientName(char* name);
00143   void GetPatientID(char* id);
00144   void GetPatientSex(char* sex);
00145   void GetPatientAge(char* age);
00146   void GetStudyID(char* id);
00147   void GetPatientDOB(char* dob);
00148   void GetStudyDescription(char* desc);
00149   void GetBodyPart(char* part);
00150   void GetNumberOfSeriesInStudy(char* series);
00151   void GetNumberOfStudyRelatedSeries(char* series);
00152   void GetStudyDate(char* date);
00153   void GetModality(char* modality);
00154   void GetManufacturer(char* manu);
00155   void GetInstitution(char* ins);
00156   void GetModel(char* model);
00157   void GetScanOptions(char *options);
00159 
00165   bool GetValueFromTag(const std::string & tag, std::string & value);
00166 
00173   static bool GetLabelFromTag( const std::string & tag, 
00174                                std::string & labelId );
00175 
00182   itkSetMacro(MaxSizeLoadEntry, long);
00183 
00188   itkSetMacro(LoadSequences, bool);
00189   itkGetConstMacro(LoadSequences, bool);
00190   itkBooleanMacro(LoadSequences);
00192 
00197   itkSetMacro(LoadPrivateTags, bool);
00198   itkGetConstMacro(LoadPrivateTags, bool);
00199   itkBooleanMacro(LoadPrivateTags);  
00201 
00208   static void SetLoadSequencesDefault(bool b)
00209     { m_LoadSequencesDefault = b; }
00210   static void LoadSequencesDefaultOn()
00211     { m_LoadSequencesDefault = true; }
00212   static void LoadSequencesDefaultOff()
00213     { m_LoadSequencesDefault = false; }
00214   static bool GetLoadSequencesDefault()
00215     { return m_LoadSequencesDefault; }
00217 
00224   static void SetLoadPrivateTagsDefault(bool b)
00225     { m_LoadPrivateTagsDefault = b; }
00226   static void LoadPrivateTagsDefaultOn()
00227     { m_LoadPrivateTagsDefault = true; }
00228   static void LoadPrivateTagsDefaultOff()
00229     { m_LoadPrivateTagsDefault = false; }
00230   static bool GetLoadPrivateTagsDefault()
00231     { return m_LoadPrivateTagsDefault; }
00233 
00235   typedef enum { JPEG = 0, JPEG2000 } TCompressionType;
00236   itkSetEnumMacro(CompressionType,TCompressionType);
00237   itkGetEnumMacro(CompressionType,TCompressionType);
00239 
00240 protected:
00241   GDCMImageIO();
00242   ~GDCMImageIO();
00243   void PrintSelf(std::ostream& os, Indent indent) const;
00244 
00245   bool OpenGDCMFileForReading(std::ifstream& os, const char* filename);
00246   bool OpenGDCMFileForWriting(std::ofstream& os, const char* filename);
00247   void InternalReadImageInformation(std::ifstream& file);
00248 
00249   double m_RescaleSlope;
00250   double m_RescaleIntercept;
00251 
00252   std::string m_UIDPrefix;
00253   std::string m_StudyInstanceUID;
00254   std::string m_SeriesInstanceUID;
00255   std::string m_FrameOfReferenceInstanceUID;
00256   bool        m_KeepOriginalUID;
00257   long        m_MaxSizeLoadEntry;
00258 
00259 private:
00260   GDCMImageIO(const Self&); //purposely not implemented
00261   void operator=(const Self&); //purposely not implemented
00262 
00263   std::string m_PatientName;
00264   std::string m_PatientID;
00265   std::string m_PatientDOB;
00266   std::string m_StudyID;   
00267   std::string m_StudyDescription;
00268   std::string m_BodyPart;
00269   std::string m_NumberOfSeriesInStudy;
00270   std::string m_NumberOfStudyRelatedSeries;
00271   std::string m_PatientSex;
00272   std::string m_PatientAge;
00273   std::string m_StudyDate;
00274   std::string m_Modality;
00275   std::string m_Manufacturer;
00276   std::string m_Institution;
00277   std::string m_Model;
00278   std::string m_ScanOptions;
00279 
00280   bool        m_LoadSequences;
00281   bool        m_LoadPrivateTags;
00282   static bool m_LoadSequencesDefault;
00283   static bool m_LoadPrivateTagsDefault;
00284   
00287   unsigned int     m_GlobalNumberOfDimensions;
00288   TCompressionType m_CompressionType;
00289 
00290   ImageIOBase::IOComponentType m_InternalComponentType;
00291   InternalHeader *             m_DICOMHeader;
00292 };
00293 
00294 } // end namespace itk
00295 
00296 #endif // __itkGDCMImageIO_h
00297 

Generated at Tue Sep 15 03:02:05 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000