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: 2010-03-12 18:47:12 $
00007   Version:   $Revision: 1.41 $
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 
00097   itkGetEnumMacro(InternalComponentType,IOComponentType);
00098 
00099   /*-------- This part of the interfaces deals with writing data. ----- */
00100 
00103   virtual bool CanWriteFile(const char*);
00104 
00107   virtual void WriteImageInformation();
00108 
00111   virtual void Write(const void* buffer);
00112 
00116   itkGetConstMacro(RescaleSlope, double);
00117   itkGetConstMacro(RescaleIntercept, double);
00119 
00124   itkGetStringMacro(UIDPrefix);
00125   itkSetStringMacro(UIDPrefix);
00127 
00129   itkGetStringMacro(StudyInstanceUID);
00130   itkGetStringMacro(SeriesInstanceUID);
00131   itkGetStringMacro(FrameOfReferenceInstanceUID);
00133 
00136   itkSetMacro(KeepOriginalUID,bool);
00137   itkGetConstMacro(KeepOriginalUID,bool);
00138   itkBooleanMacro(KeepOriginalUID);
00140 
00147   void GetPatientName(char* name);
00148   void GetPatientID(char* id);
00149   void GetPatientSex(char* sex);
00150   void GetPatientAge(char* age);
00151   void GetStudyID(char* id);
00152   void GetPatientDOB(char* dob);
00153   void GetStudyDescription(char* desc);
00154   void GetBodyPart(char* part);
00155   void GetNumberOfSeriesInStudy(char* series);
00156   void GetNumberOfStudyRelatedSeries(char* series);
00157   void GetStudyDate(char* date);
00158   void GetModality(char* modality);
00159   void GetManufacturer(char* manu);
00160   void GetInstitution(char* ins);
00161   void GetModel(char* model);
00162   void GetScanOptions(char *options);
00164 
00170   bool GetValueFromTag(const std::string & tag, std::string & value);
00171 
00178   static bool GetLabelFromTag( const std::string & tag, 
00179                                std::string & labelId );
00180 
00188   itkSetMacro(MaxSizeLoadEntry, long);
00189 
00195   itkSetMacro(LoadSequences, bool);
00196   itkGetConstMacro(LoadSequences, bool);
00197   itkBooleanMacro(LoadSequences);
00199 
00205   itkSetMacro(LoadPrivateTags, bool);
00206   itkGetConstMacro(LoadPrivateTags, bool);
00207   itkBooleanMacro(LoadPrivateTags);  
00209 
00218   static void SetLoadSequencesDefault(bool b)
00219     { m_LoadSequencesDefault = b; }
00220   static void LoadSequencesDefaultOn()
00221     { m_LoadSequencesDefault = true; }
00222   static void LoadSequencesDefaultOff()
00223     { m_LoadSequencesDefault = false; }
00224   static bool GetLoadSequencesDefault()
00225     { return m_LoadSequencesDefault; }
00227 
00236   static void SetLoadPrivateTagsDefault(bool b)
00237     { m_LoadPrivateTagsDefault = b; }
00238   static void LoadPrivateTagsDefaultOn()
00239     { m_LoadPrivateTagsDefault = true; }
00240   static void LoadPrivateTagsDefaultOff()
00241     { m_LoadPrivateTagsDefault = false; }
00242   static bool GetLoadPrivateTagsDefault()
00243     { return m_LoadPrivateTagsDefault; }
00245 
00247   typedef enum { JPEG = 0, JPEG2000 } TCompressionType;
00248   itkSetEnumMacro(CompressionType,TCompressionType);
00249   itkGetEnumMacro(CompressionType,TCompressionType);
00251 
00252 protected:
00253   GDCMImageIO();
00254   ~GDCMImageIO();
00255   void PrintSelf(std::ostream& os, Indent indent) const;
00256 
00257   bool OpenGDCMFileForReading(std::ifstream& os, const char* filename);
00258   bool OpenGDCMFileForWriting(std::ofstream& os, const char* filename);
00259   void InternalReadImageInformation(std::ifstream& file);
00260 
00261   double m_RescaleSlope;
00262   double m_RescaleIntercept;
00263 
00264   std::string m_UIDPrefix;
00265   std::string m_StudyInstanceUID;
00266   std::string m_SeriesInstanceUID;
00267   std::string m_FrameOfReferenceInstanceUID;
00268   bool        m_KeepOriginalUID;
00269   long        m_MaxSizeLoadEntry;
00270 
00271 private:
00272   GDCMImageIO(const Self&); //purposely not implemented
00273   void operator=(const Self&); //purposely not implemented
00274 
00275   std::string m_PatientName;
00276   std::string m_PatientID;
00277   std::string m_PatientDOB;
00278   std::string m_StudyID;   
00279   std::string m_StudyDescription;
00280   std::string m_BodyPart;
00281   std::string m_NumberOfSeriesInStudy;
00282   std::string m_NumberOfStudyRelatedSeries;
00283   std::string m_PatientSex;
00284   std::string m_PatientAge;
00285   std::string m_StudyDate;
00286   std::string m_Modality;
00287   std::string m_Manufacturer;
00288   std::string m_Institution;
00289   std::string m_Model;
00290   std::string m_ScanOptions;
00291 
00292   bool        m_LoadSequences;
00293   bool        m_LoadPrivateTags;
00294   static bool m_LoadSequencesDefault;
00295   static bool m_LoadPrivateTagsDefault;
00296   
00299   unsigned int     m_GlobalNumberOfDimensions;
00300   TCompressionType m_CompressionType;
00301 
00302   ImageIOBase::IOComponentType m_InternalComponentType;
00303   InternalHeader *             m_DICOMHeader;
00304 };
00305 
00306 } // end namespace itk
00307 
00308 #endif // __itkGDCMImageIO_h
00309 

Generated at Mon Jul 12 2010 18:24:08 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000