MeVisLab Toolbox Reference
mlCSADecoder.h
Go to the documentation of this file.
1 // Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2 // **InsertLicense** code
3 //----------------------------------------------------------------------------------
10 
15 //----------------------------------------------------------------------------------
16 /*=========================================================================
17 
18  Program: GDCM (Grassroots DICOM). A DICOM library
19  Module: $URL$
20 
21  Copyright (c) 2006-2010 Mathieu Malaterre
22  All rights reserved.
23  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
24 
25  This software is distributed WITHOUT ANY WARRANTY; without even
26  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
27  PURPOSE. See the above copyright notice for more information.
28 
29 =========================================================================*/
30 #pragma once
31 
32 #include <ThirdPartyWarningsDisable.h>
33 #include <gdcmTypes.h>
34 #include <gdcmDataSet.h>
35 #include <gdcmCSAElement.h>
36 #include <ThirdPartyWarningsRestore.h>
37 
39 namespace gdcm
40 {
41 /*
42  * Everything done in this code is for the sole purpose of writing interoperable
43  * software under Sect. 1201 (f) Reverse Engineering exception of the DMCA.
44  * If you believe anything in this code violates any law or any of your rights,
45  * please contact us (gdcm-developers@lists.sourceforge.net) so that we can
46  * find a solution.
47  */
48 //-----------------------------------------------------------------------------
49 
50 class DataElement;
51 class PrivateTag;
71 class GDCM_EXPORT CSADecoder
72 {
73  friend std::ostream& operator<<(std::ostream &_os, const CSADecoder &d);
74 public :
75  // Constructor.
76  CSADecoder(): InternalDataSet(), InternalType(UNKNOWN), InterfileData(nullptr) {};
77 
79  typedef enum {
80  UNKNOWN = 0,
85  ZEROED_OUT
86  } CSAHeaderType;
87 
89  bool LoadFromDataElement(DataElement const &de);
90 
92  void Print(std::ostream &os) const;
93 
95  const DataSet& GetDataSet() const { return InternalDataSet; }
96 
98  const char * GetInterfile() const { return InterfileData; }
99 
101  static VR GetVRFromDataSetFormatDict( const Tag& t );
102 
106 
108  inline const std::set<CSAElement> & getInternalCSADataSet() const { return InternalCSADataSet; }
109 
111  inline const std::string& getReportString() const { return reportString; }
112 
113 private:
115  std::set<CSAElement> InternalCSADataSet;
117  DataSet InternalDataSet;
119  CSAHeaderType InternalType;
121  Tag DataElementTag;
123  const char *InterfileData;
125  std::string reportString;
126 };
127 
128 //-----------------------------------------------------------------------------
130 inline std::ostream& operator<<(std::ostream &os, const CSADecoder &d)
131 {
132  d.Print( os );
133  return os;
134 }
135 
136 } // end namespace gdcm
137 //-----------------------------------------------------------------------------
Class CSADecoder adopted from gdcm implementation to decode Siemens CSA DICOM header tags.
Definition: mlCSADecoder.h:72
void Print(std::ostream &os) const
Print the CSADecoder (use only if Format == SV10 or NOMAGIC)
const DataSet & GetDataSet() const
Return the DataSet output (use only if Format == DATASET_FORMAT )
Definition: mlCSADecoder.h:95
const char * GetInterfile() const
Return the string output (use only if Format == Interfile)
Definition: mlCSADecoder.h:98
const std::set< CSAElement > & getInternalCSADataSet() const
wsp: Added access function to traverse all private elements. I wonder why this is not available norma...
Definition: mlCSADecoder.h:108
CSAHeaderType GetFormat() const
return the format of the CSADecoder SV10 and NOMAGIC are equivalent.
static VR GetVRFromDataSetFormatDict(const Tag &t)
Helper function to get VR from a DataSet entry if Format is DATASET_FORMAT.
bool LoadFromDataElement(DataElement const &de)
Decode the CSADecoder from element 'de'.
CSAHeaderType
Divers format of CSADecoder as found 'in the wild'.
Definition: mlCSADecoder.h:79
const std::string & getReportString() const
Returns information about the reason why decoding failed.
Definition: mlCSADecoder.h:111
Namespace of the Grassroots DICOM library.
Definition: mlCSADecoder.h:40
std::ostream & operator<<(std::ostream &os, const CSADecoder &d)
Print operator streaming out the CSADecoder.
Definition: mlCSADecoder.h:130