GDCM 2.2.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

gdcmCSAHeader.h
Go to the documentation of this file.
1 /*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13 =========================================================================*/
14 #ifndef GDCMCSAHEADER_H
15 #define GDCMCSAHEADER_H
16
17 #include "gdcmTypes.h"
18 #include "gdcmDataSet.h"
19 #include "gdcmCSAElement.h"
20
21 namespace gdcm
22 {
23 /*
24 * Everything done in this code is for the sole purpose of writing interoperable
25 * software under Sect. 1201 (f) Reverse Engineering exception of the DMCA.
26 * If you believe anything in this code violates any law or any of your rights,
27 * please contact us (gdcm-developers@lists.sourceforge.net) so that we can
28 * find a solution.
29 */
30 //-----------------------------------------------------------------------------
31
32 class DataElement;
33 class PrivateTag;
62 class GDCM_EXPORT CSAHeader
63 {
64 friend std::ostream& operator<<(std::ostream &_os, const CSAHeader &d);
65 public :
66 CSAHeader():InternalDataSet(),InternalType(UNKNOWN),InterfileData(0) {};
67 ~CSAHeader() {};
68
70 typedef enum {
71 UNKNOWN = 0,
72 SV10,
73 NOMAGIC,
74 DATASET_FORMAT,
75 INTERFILE,
76 ZEROED_OUT
77 } CSAHeaderType;
78
79 template <typename TSwap>
80 std::istream &Read(std::istream &is);
81
82 template <typename TSwap>
83 const std::ostream &Write(std::ostream &os) const;
84
86 bool LoadFromDataElement(DataElement const &de);
87
89 void Print(std::ostream &os) const;
90
92 const DataSet& GetDataSet() const { return InternalDataSet; }
93
95 const char * GetInterfile() const { return InterfileData; }
96
99 CSAHeaderType GetFormat() const;
100
103 static const PrivateTag & GetCSAImageHeaderInfoTag();
104
107 static const PrivateTag & GetCSASeriesHeaderInfoTag();
108
111 static const PrivateTag & GetCSADataInfo();
112
115 const CSAElement &GetCSAElementByName(const char *name);
116
119 bool FindCSAElementByName(const char *name);
120
121 protected:
122 const CSAElement& GetCSAEEnd() const;
123
124 private:
125 std::set<CSAElement> InternalCSADataSet;
126 DataSet InternalDataSet;
127 CSAHeaderType InternalType;
128 Tag DataElementTag;
129 static CSAElement CSAEEnd;
130 const char *InterfileData;
131 };
132 //-----------------------------------------------------------------------------
133 inline std::ostream& operator<<(std::ostream &os, const CSAHeader &d)
134 {
135 d.Print( os );
136 return os;
137 }
138
139 } // end namespace gdcm
140 //-----------------------------------------------------------------------------
141 #endif //GDCMCSAHEADER_H