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: 2008-10-01 12:26:11 $
00007   Version:   $Revision: 1.35 $
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 
00057 class InternalHeader;
00058 class ITK_EXPORT GDCMImageIO : public ImageIOBase
00059 {
00060 public:
00062   typedef GDCMImageIO         Self;
00063   typedef ImageIOBase         Superclass;
00064   typedef SmartPointer<Self>  Pointer;
00065 
00067   itkNewMacro(Self);
00068 
00070   itkTypeMacro(GDCMImageIO, Superclass);
00071 
00072   /*-------- This part of the interface deals with reading data. ------ */
00073 
00076   virtual bool CanReadFile(const char*);
00077 
00079   virtual void ReadImageInformation();
00080 
00082   virtual void Read(void* buffer);
00083 
00084   /*-------- This part of the interfaces deals with writing data. ----- */
00085 
00088   virtual bool CanWriteFile(const char*);
00089 
00092   virtual void WriteImageInformation();
00093 
00096   virtual void Write(const void* buffer);
00097 
00101   itkGetMacro(RescaleSlope, double);
00102   itkGetMacro(RescaleIntercept, double);
00104 
00109   itkGetStringMacro(UIDPrefix);
00110   itkSetStringMacro(UIDPrefix);
00112 
00114   itkGetStringMacro(StudyInstanceUID);
00115   itkGetStringMacro(SeriesInstanceUID);
00116   itkGetStringMacro(FrameOfReferenceInstanceUID);
00118 
00121   itkSetMacro(KeepOriginalUID,bool);
00122   itkGetMacro(KeepOriginalUID,bool);
00123   itkBooleanMacro(KeepOriginalUID);
00125 
00129   void GetPatientName(char* name);
00130   void GetPatientID(char* id);
00131   void GetPatientSex(char* sex);
00132   void GetPatientAge(char* age);
00133   void GetStudyID(char* id);
00134   void GetPatientDOB(char* dob);
00135   void GetStudyDescription(char* desc);
00136   void GetBodyPart(char* part);
00137   void GetNumberOfSeriesInStudy(char* series);
00138   void GetNumberOfStudyRelatedSeries(char* series);
00139   void GetStudyDate(char* date);
00140   void GetModality(char* modality);
00141   void GetManufacturer(char* manu);
00142   void GetInstitution(char* ins);
00143   void GetModel(char* model);
00144   void GetScanOptions(char *options);
00146 
00152   bool GetValueFromTag(const std::string & tag, std::string & value);
00153 
00160   static bool GetLabelFromTag( const std::string & tag, 
00161                                std::string & labelId );
00162 
00169   itkSetMacro(MaxSizeLoadEntry, long);
00170 
00175   itkSetMacro(LoadSequences, bool);
00176   itkGetMacro(LoadSequences, bool);
00177   itkBooleanMacro(LoadSequences);
00179 
00184   itkSetMacro(LoadPrivateTags, bool);
00185   itkGetMacro(LoadPrivateTags, bool);
00186   itkBooleanMacro(LoadPrivateTags);  
00188 
00195   static void SetLoadSequencesDefault(bool b)
00196     { m_LoadSequencesDefault = b; }
00197   static void LoadSequencesDefaultOn()
00198     { m_LoadSequencesDefault = true; }
00199   static void LoadSequencesDefaultOff()
00200     { m_LoadSequencesDefault = false; }
00201   static bool GetLoadSequencesDefault()
00202     { return m_LoadSequencesDefault; }
00204 
00211   static void SetLoadPrivateTagsDefault(bool b)
00212     { m_LoadPrivateTagsDefault = b; }
00213   static void LoadPrivateTagsDefaultOn()
00214     { m_LoadPrivateTagsDefault = true; }
00215   static void LoadPrivateTagsDefaultOff()
00216     { m_LoadPrivateTagsDefault = false; }
00217   static bool GetLoadPrivateTagsDefault()
00218     { return m_LoadPrivateTagsDefault; }
00220 
00222   typedef enum { JPEG = 0, JPEG2000 } TCompressionType;
00223   itkSetEnumMacro(CompressionType,TCompressionType);
00224   itkGetEnumMacro(CompressionType,TCompressionType);
00226 
00227 protected:
00228   GDCMImageIO();
00229   ~GDCMImageIO();
00230   void PrintSelf(std::ostream& os, Indent indent) const;
00231 
00232   bool OpenGDCMFileForReading(std::ifstream& os, const char* filename);
00233   bool OpenGDCMFileForWriting(std::ofstream& os, const char* filename);
00234   void InternalReadImageInformation(std::ifstream& file);
00235 
00236   double m_RescaleSlope;
00237   double m_RescaleIntercept;
00238 
00239   std::string m_UIDPrefix;
00240   std::string m_StudyInstanceUID;
00241   std::string m_SeriesInstanceUID;
00242   std::string m_FrameOfReferenceInstanceUID;
00243   bool        m_KeepOriginalUID;
00244   long        m_MaxSizeLoadEntry;
00245 
00246 private:
00247   GDCMImageIO(const Self&); //purposely not implemented
00248   void operator=(const Self&); //purposely not implemented
00249 
00250   std::string m_PatientName;
00251   std::string m_PatientID;
00252   std::string m_PatientDOB;
00253   std::string m_StudyID;   
00254   std::string m_StudyDescription;
00255   std::string m_BodyPart;
00256   std::string m_NumberOfSeriesInStudy;
00257   std::string m_NumberOfStudyRelatedSeries;
00258   std::string m_PatientSex;
00259   std::string m_PatientAge;
00260   std::string m_StudyDate;
00261   std::string m_Modality;
00262   std::string m_Manufacturer;
00263   std::string m_Institution;
00264   std::string m_Model;
00265   std::string m_ScanOptions;
00266 
00267   bool        m_LoadSequences;
00268   bool        m_LoadPrivateTags;
00269   static bool m_LoadSequencesDefault;
00270   static bool m_LoadPrivateTagsDefault;
00271   
00274   unsigned int     m_GlobalNumberOfDimensions;
00275   TCompressionType m_CompressionType;
00276 
00277   ImageIOBase::IOComponentType m_InternalComponentType;
00278   InternalHeader *             m_DICOMHeader;
00279 };
00280 
00281 } // end namespace itk
00282 
00283 #endif // __itkGDCMImageIO_h
00284 

Generated at Wed Nov 5 21:34:24 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000