GDCM  2.2.0
gdcmTransferSyntax.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 GDCMTRANSFERSYNTAX_H
15 #define GDCMTRANSFERSYNTAX_H
16 
17 #include "gdcmSwapCode.h"
18 
19 namespace gdcm
20 {
21 
40 {
41 public:
42  typedef enum {
43  Unknown = 0,
45  Implicit
46  } NegociatedType;
47 
48 #if 0
49  //NOT FLEXIBLE, since force user to update lib everytime new module
50  //comes out...
51  // TODO
52  typedef enum {
53  NoSpacing = 0,
54  PixelSpacing,
55  ImagerPixelSpacing,
56  PixelAspectRatio
57  } ImageSpacingType;
58  ImageSpacingType GetImageSpacing();
59 #endif
60 
61  typedef enum {
62  ImplicitVRLittleEndian = 0,
82 #ifdef GDCM_SUPPORT_BROKEN_IMPLEMENTATION
83  WeirdPapryus,
84 #endif
86  TS_END
87  } TSType;
88 
89  // Return the string as written in the official DICOM dict from
90  // a custom enum type
91  static const char* GetTSString(TSType ts);
92  static TSType GetTSType(const char *str);
93 
94  NegociatedType GetNegociatedType() const;
95 
99  SwapCode GetSwapCode() const;
100 
101  bool IsValid() const { return TSField != TS_END; }
102 
103  operator TSType () const { return TSField; }
104 
105  // FIXME: ImplicitVRLittleEndian used to be the default, but nowadays
106  // this is rather the ExplicitVRLittleEndian instead...should be change the default ?
107  TransferSyntax(TSType type = ImplicitVRLittleEndian):TSField(type) {}
108 
109  // return if dataset is encoded or not (Deflate Explicit VR)
110  bool IsEncoded() const;
111 
112  bool IsImplicit() const;
113  bool IsExplicit() const;
114 
115  bool IsEncapsulated() const;
116 
118  bool IsLossy() const;
120  bool IsLossless() const;
122  bool CanStoreLossy() const;
123 
124  const char *GetString() const { return TransferSyntax::GetTSString(TSField); }
125 
126  friend std::ostream &operator<<(std::ostream &os, const TransferSyntax &ts);
127 private:
128  // DO NOT EXPOSE the following. Internal details of TransferSyntax
129 bool IsImplicit(TSType ts) const;
130 bool IsExplicit(TSType ts) const;
131 bool IsLittleEndian(TSType ts) const;
132 bool IsBigEndian(TSType ts) const;
133 
134  TSType TSField;
135 };
136 //-----------------------------------------------------------------------------
137 inline std::ostream &operator<<(std::ostream &_os, const TransferSyntax &ts)
138 {
139  _os << TransferSyntax::GetTSString(ts);
140  return _os;
141 
142 }
143 
144 } // end namespace gdcm
145 
146 #endif //GDCMTRANSFERSYNTAX_H

Generated on Wed Jun 13 2012 20:40:37 for GDCM by doxygen 1.8.1
SourceForge.net Logo