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: 2006/07/12 16:56:24 $
00007   Version:   $Revision: 1.30 $
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 
00056 class InternalHeader;
00057 class ITK_EXPORT GDCMImageIO : public ImageIOBase
00058 {
00059 public:
00061   typedef GDCMImageIO Self;
00062   typedef ImageIOBase Superclass;
00063   typedef SmartPointer<Self>  Pointer;
00064 
00066   itkNewMacro(Self);
00067 
00069   itkTypeMacro(GDCMImageIO, Superclass);
00070 
00071   /*-------- This part of the interface deals with reading data. ------ */
00072 
00075   virtual bool CanReadFile(const char*);
00076 
00078   virtual void ReadImageInformation();
00079 
00081   virtual void Read(void* buffer);
00082 
00083   /*-------- This part of the interfaces deals with writing data. ----- */
00084 
00087   virtual bool CanWriteFile(const char*);
00088 
00091   virtual void WriteImageInformation();
00092 
00095   virtual void Write(const void* buffer);
00096 
00100   itkGetMacro(RescaleSlope, double);
00101   itkGetMacro(RescaleIntercept, double);
00103 
00108   itkGetStringMacro(UIDPrefix);
00109   itkSetStringMacro(UIDPrefix);
00111 
00113   itkGetStringMacro(StudyInstanceUID);
00114   itkGetStringMacro(SeriesInstanceUID);
00115   itkGetStringMacro(FrameOfReferenceInstanceUID);
00117 
00120   itkSetMacro(KeepOriginalUID,bool);
00121   itkGetMacro(KeepOriginalUID,bool);
00122   itkBooleanMacro(KeepOriginalUID);
00124 
00128   void GetPatientName(char* name);
00129   void GetPatientID(char* id);
00130   void GetPatientSex(char* sex);
00131   void GetPatientAge(char* age);
00132   void GetStudyID(char* id);
00133   void GetPatientDOB(char* dob);
00134   void GetStudyDescription(char* desc);
00135   void GetBodyPart(char* part);
00136   void GetNumberOfSeriesInStudy(char* series);
00137   void GetNumberOfStudyRelatedSeries(char* series);
00138   void GetStudyDate(char* date);
00139   void GetModality(char* modality);
00140   void GetManufacturer(char* manu);
00141   void GetInstitution(char* ins);
00142   void GetModel(char* model);
00143   void GetScanOptions(char *options);
00145 
00149   bool GetValueFromTag(const std::string & tag, std::string & value);
00150 
00157   static bool GetLabelFromTag( const std::string & tag, 
00158                                std::string & labelId );
00159 
00166   itkSetMacro(MaxSizeLoadEntry, long);
00167 
00172   itkSetMacro(LoadSequences, bool);
00173   itkGetMacro(LoadSequences, bool);
00174   itkBooleanMacro(LoadSequences);
00176 
00181   itkSetMacro(LoadPrivateTags, bool);
00182   itkGetMacro(LoadPrivateTags, bool);
00183   itkBooleanMacro(LoadPrivateTags);  
00185 
00192   static void SetLoadSequencesDefault(bool b)
00193     { m_LoadSequencesDefault = b; }
00194   static void LoadSequencesDefaultOn()
00195     { m_LoadSequencesDefault = true; }
00196   static void LoadSequencesDefaultOff()
00197     { m_LoadSequencesDefault = false; }
00198   static bool GetLoadSequencesDefault()
00199     { return m_LoadSequencesDefault; }
00201 
00208   static void SetLoadPrivateTagsDefault(bool b)
00209     { m_LoadPrivateTagsDefault = b; }
00210   static void LoadPrivateTagsDefaultOn()
00211     { m_LoadPrivateTagsDefault = true; }
00212   static void LoadPrivateTagsDefaultOff()
00213     { m_LoadPrivateTagsDefault = false; }
00214   static bool GetLoadPrivateTagsDefault()
00215     { return m_LoadPrivateTagsDefault; }
00217 
00219   typedef enum { JPEG = 0, JPEG2000 } TCompressionType;
00220   itkSetMacro(CompressionType,TCompressionType);
00221   itkGetConstReferenceMacro(CompressionType,TCompressionType);
00223 
00224 protected:
00225   GDCMImageIO();
00226   ~GDCMImageIO();
00227   void PrintSelf(std::ostream& os, Indent indent) const;
00228 
00229   bool OpenGDCMFileForReading(std::ifstream& os, const char* filename);
00230   bool OpenGDCMFileForWriting(std::ofstream& os, const char* filename);
00231   void InternalReadImageInformation(std::ifstream& file);
00232 
00233   double m_RescaleSlope;
00234   double m_RescaleIntercept;
00235 
00236   std::string m_UIDPrefix;
00237   std::string m_StudyInstanceUID;
00238   std::string m_SeriesInstanceUID;
00239   std::string m_FrameOfReferenceInstanceUID;
00240   bool m_KeepOriginalUID;
00241   long m_MaxSizeLoadEntry;
00242 
00243 private:
00244   GDCMImageIO(const Self&); //purposely not implemented
00245   void operator=(const Self&); //purposely not implemented
00246 
00247   std::string m_PatientName;
00248   std::string m_PatientID;
00249   std::string m_PatientDOB;
00250   std::string m_StudyID;   
00251   std::string m_StudyDescription;
00252   std::string m_BodyPart;
00253   std::string m_NumberOfSeriesInStudy;
00254   std::string m_NumberOfStudyRelatedSeries;
00255   std::string m_PatientSex;
00256   std::string m_PatientAge;
00257   std::string m_StudyDate;
00258   std::string m_Modality;
00259   std::string m_Manufacturer;
00260   std::string m_Institution;
00261   std::string m_Model;
00262   std::string m_ScanOptions;
00263 
00264   bool m_LoadSequences;
00265   bool m_LoadPrivateTags;
00266   static bool m_LoadSequencesDefault;
00267   static bool m_LoadPrivateTagsDefault;
00268   
00271   unsigned int m_GlobalNumberOfDimensions;
00272   TCompressionType m_CompressionType;
00273 
00274   ImageIOBase::IOComponentType m_InternalComponentType;
00275   InternalHeader *DICOMHeader;
00276 };
00277 
00278 } // end namespace itk
00279 
00280 #endif // __itkGDCMImageIO_h
00281 

Generated at Mon Mar 12 00:27:22 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000