GDCM 2.0.17
|
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 #ifndef GDCMCSAHEADER_H 00016 #define GDCMCSAHEADER_H 00017 00018 #include "gdcmTypes.h" 00019 #include "gdcmDataSet.h" 00020 #include "gdcmCSAElement.h" 00021 00022 namespace gdcm 00023 { 00024 /* 00025 * Everything done in this code is for the sole purpose of writing interoperable 00026 * software under Sect. 1201 (f) Reverse Engineering exception of the DMCA. 00027 * If you believe anything in this code violates any law or any of your rights, 00028 * please contact us (gdcm-developers@lists.sourceforge.net) so that we can 00029 * find a solution. 00030 */ 00031 //----------------------------------------------------------------------------- 00032 00033 class DataElement; 00034 class PrivateTag; 00063 class GDCM_EXPORT CSAHeader 00064 { 00065 friend std::ostream& operator<<(std::ostream &_os, const CSAHeader &d); 00066 public : 00067 CSAHeader():InternalDataSet(),InternalType(UNKNOWN),InterfileData(0) {}; 00068 ~CSAHeader() {}; 00069 00071 typedef enum { 00072 UNKNOWN = 0, 00073 SV10, 00074 NOMAGIC, 00075 DATASET_FORMAT, 00076 INTERFILE, 00077 ZEROED_OUT 00078 } CSAHeaderType; 00079 00080 template <typename TSwap> 00081 std::istream &Read(std::istream &is); 00082 00083 template <typename TSwap> 00084 const std::ostream &Write(std::ostream &os) const; 00085 00087 bool LoadFromDataElement(DataElement const &de); 00088 00090 void Print(std::ostream &os) const; 00091 00093 const DataSet& GetDataSet() const { return InternalDataSet; } 00094 00096 const char * GetInterfile() const { return InterfileData; } 00097 00100 CSAHeaderType GetFormat() const; 00101 00104 static const PrivateTag & GetCSAImageHeaderInfoTag(); 00105 00108 static const PrivateTag & GetCSASeriesHeaderInfoTag(); 00109 00112 static const PrivateTag & GetCSADataInfo(); 00113 00116 const CSAElement &GetCSAElementByName(const char *name); 00117 00120 bool FindCSAElementByName(const char *name); 00121 00122 protected: 00123 const CSAElement& GetCSAEEnd() const; 00124 00125 private: 00126 std::set<CSAElement> InternalCSADataSet; 00127 DataSet InternalDataSet; 00128 CSAHeaderType InternalType; 00129 Tag DataElementTag; 00130 static CSAElement CSAEEnd; 00131 const char *InterfileData; 00132 }; 00133 //----------------------------------------------------------------------------- 00134 inline std::ostream& operator<<(std::ostream &os, const CSAHeader &d) 00135 { 00136 d.Print( os ); 00137 return os; 00138 } 00139 00140 } // end namespace gdcm 00141 //----------------------------------------------------------------------------- 00142 #endif //GDCMCSAHEADER_H