GDCM  2.2.0
gdcmCSAHeader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program: GDCM (Grassroots DICOM). A DICOM library
00004 
00005   Copyright (c) 2006-2011 Mathieu Malaterre
00006   All rights reserved.
00007   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE.  See the above copyright notice for more information.
00012 
00013 =========================================================================*/
00014 #ifndef GDCMCSAHEADER_H
00015 #define GDCMCSAHEADER_H
00016 
00017 #include "gdcmTypes.h"
00018 #include "gdcmDataSet.h"
00019 #include "gdcmCSAElement.h"
00020 
00021 namespace gdcm
00022 {
00023 /*
00024  * Everything done in this code is for the sole purpose of writing interoperable
00025  * software under Sect. 1201 (f) Reverse Engineering exception of the DMCA.
00026  * If you believe anything in this code violates any law or any of your rights,
00027  * please contact us (gdcm-developers@lists.sourceforge.net) so that we can
00028  * find a solution.
00029  */
00030 //-----------------------------------------------------------------------------
00031 
00032 class DataElement;
00033 class PrivateTag;
00062 class GDCM_EXPORT CSAHeader
00063 {
00064   friend std::ostream& operator<<(std::ostream &_os, const CSAHeader &d);
00065 public :
00066   CSAHeader():InternalDataSet(),InternalType(UNKNOWN),InterfileData(0) {};
00067   ~CSAHeader() {};
00068 
00070   typedef enum {
00071     UNKNOWN = 0,
00072     SV10,
00073     NOMAGIC,
00074     DATASET_FORMAT,
00075     INTERFILE,
00076     ZEROED_OUT
00077   } CSAHeaderType;
00078 
00079   template <typename TSwap>
00080   std::istream &Read(std::istream &is);
00081 
00082   template <typename TSwap>
00083   const std::ostream &Write(std::ostream &os) const;
00084 
00086   bool LoadFromDataElement(DataElement const &de);
00087 
00089   void Print(std::ostream &os) const;
00090 
00092   const DataSet& GetDataSet() const { return InternalDataSet; }
00093 
00095   const char * GetInterfile() const { return InterfileData; }
00096 
00099   CSAHeaderType GetFormat() const;
00100 
00103   static const PrivateTag & GetCSAImageHeaderInfoTag();
00104 
00107   static const PrivateTag & GetCSASeriesHeaderInfoTag();
00108 
00111   static const PrivateTag & GetCSADataInfo();
00112 
00115   const CSAElement &GetCSAElementByName(const char *name);
00116 
00119   bool FindCSAElementByName(const char *name);
00120 
00121 protected:
00122   const CSAElement& GetCSAEEnd() const;
00123 
00124 private:
00125   std::set<CSAElement> InternalCSADataSet;
00126   DataSet InternalDataSet;
00127   CSAHeaderType InternalType;
00128   Tag DataElementTag;
00129   static CSAElement CSAEEnd;
00130   const char *InterfileData;
00131 };
00132 //-----------------------------------------------------------------------------
00133 inline std::ostream& operator<<(std::ostream &os, const CSAHeader &d)
00134 {
00135   d.Print( os );
00136   return os;
00137 }
00138 
00139 } // end namespace gdcm
00140 //-----------------------------------------------------------------------------
00141 #endif //GDCMCSAHEADER_H

Generated on Tue Mar 27 2012 18:19:32 for GDCM by doxygen 1.8.0
SourceForge.net Logo