GDCM 3.2.1

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
39 class GDCM_EXPORT TransferSyntax
40{
41 public:
42 typedef enum {
43 Unknown = 0,
44 Explicit,
45 Implicit
46 } NegociatedType;
47
48#if 0
49 //NOT FLEXIBLE, since forces user to update lib every time 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,
63 ImplicitVRBigEndianPrivateGE,
64 ExplicitVRLittleEndian,
65 DeflatedExplicitVRLittleEndian,
66 ExplicitVRBigEndian,
67 JPEGBaselineProcess1,
68 JPEGExtendedProcess2_4,
69 JPEGExtendedProcess3_5,
70 JPEGSpectralSelectionProcess6_8,
71 JPEGFullProgressionProcess10_12,
72 JPEGLosslessProcess14,
73 JPEGLosslessProcess14_1,
74 JPEGLSLossless,
75 JPEGLSNearLossless,
76 JPEG2000Lossless,
77 JPEG2000,
78 JPEG2000Part2Lossless,
79 JPEG2000Part2,
80 RLELossless,
81 MPEG2MainProfile,
82 ImplicitVRBigEndianACRNEMA,
83 WeirdPapryus,
84 CT_private_ELE,
85 JPIPReferenced,
86 MPEG2MainProfileHighLevel,
87 MPEG4AVCH264HighProfileLevel4_1,
88 MPEG4AVCH264BDcompatibleHighProfileLevel4_1,
89 HTJ2KLossless,
90 HTJ2KRPCLLossless,
91 HTJ2K,
92 TS_END
93 } TSType;
94
95 // Return the string as written in the official DICOM dict from
96 // a custom enum type
97 static const char* GetTSString(TSType ts);
98 static TSType GetTSType(const char *str);
99
100 NegociatedType GetNegociatedType() const;
101
105 SwapCode GetSwapCode() const;
106
107 bool IsValid() const { return TSField != TS_END; }
108
109 operator TSType () const { return TSField; }
110
111 // FIXME: ImplicitVRLittleEndian used to be the default, but nowadays
112 // this is rather the ExplicitVRLittleEndian instead...should be change the default ?
113 TransferSyntax(TSType type = ImplicitVRLittleEndian):TSField(type) {}
114
115 // return if dataset is encoded or not (Deflate Explicit VR)
116 bool IsEncoded() const;
117
118 bool IsImplicit() const;
119 bool IsExplicit() const;
120
121 bool IsEncapsulated() const;
122
124 bool IsLossy() const;
126 bool IsLossless() const;
128 bool CanStoreLossy() const;
129
130 const char *GetString() const { return TransferSyntax::GetTSString(TSField); }
131
132 friend std::ostream &operator<<(std::ostream &os, const TransferSyntax &ts);
133 private:
134 // DO NOT EXPOSE the following. Internal details of TransferSyntax
135 bool IsImplicit(TSType ts) const;
136 bool IsExplicit(TSType ts) const;
137 bool IsLittleEndian(TSType ts) const;
138 bool IsBigEndian(TSType ts) const;
139
140 TSType TSField;
141};
142//-----------------------------------------------------------------------------
143 inline std::ostream &operator<<(std::ostream &_os, const TransferSyntax &ts)
144{
145 _os << TransferSyntax::GetTSString(ts);
146 return _os;
147
148}
149
150} // end namespace gdcm
151
152#endif //GDCMTRANSFERSYNTAX_H
gdcm::SwapCode
SwapCode representation.
Definition gdcmSwapCode.h:27
gdcm::TransferSyntax
Class to manipulate Transfer Syntax.
Definition gdcmTransferSyntax.h:40
gdcm::TransferSyntax::CanStoreLossy
bool CanStoreLossy() const
gdcm::TransferSyntax::GetTSType
static TSType GetTSType(const char *str)
gdcm::TransferSyntax::IsImplicit
bool IsImplicit() const
gdcm::TransferSyntax::IsValid
bool IsValid() const
Definition gdcmTransferSyntax.h:107
gdcm::TransferSyntax::IsEncoded
bool IsEncoded() const
gdcm::TransferSyntax::IsEncapsulated
bool IsEncapsulated() const
gdcm::TransferSyntax::GetNegociatedType
NegociatedType GetNegociatedType() const
gdcm::TransferSyntax::GetSwapCode
SwapCode GetSwapCode() const
gdcm::TransferSyntax::GetTSString
static const char * GetTSString(TSType ts)
gdcm::TransferSyntax::TSType
TSType
Definition gdcmTransferSyntax.h:61
gdcm::TransferSyntax::ImplicitVRBigEndianACRNEMA
@ ImplicitVRBigEndianACRNEMA
Definition gdcmTransferSyntax.h:82
gdcm::TransferSyntax::MPEG4AVCH264HighProfileLevel4_1
@ MPEG4AVCH264HighProfileLevel4_1
Definition gdcmTransferSyntax.h:87
gdcm::TransferSyntax::HTJ2KRPCLLossless
@ HTJ2KRPCLLossless
Definition gdcmTransferSyntax.h:90
gdcm::TransferSyntax::CT_private_ELE
@ CT_private_ELE
Definition gdcmTransferSyntax.h:84
gdcm::TransferSyntax::JPEG2000
@ JPEG2000
Definition gdcmTransferSyntax.h:77
gdcm::TransferSyntax::JPEGLSNearLossless
@ JPEGLSNearLossless
Definition gdcmTransferSyntax.h:75
gdcm::TransferSyntax::JPEGFullProgressionProcess10_12
@ JPEGFullProgressionProcess10_12
Definition gdcmTransferSyntax.h:71
gdcm::TransferSyntax::MPEG2MainProfile
@ MPEG2MainProfile
Definition gdcmTransferSyntax.h:81
gdcm::TransferSyntax::JPEG2000Part2
@ JPEG2000Part2
Definition gdcmTransferSyntax.h:79
gdcm::TransferSyntax::JPEG2000Lossless
@ JPEG2000Lossless
Definition gdcmTransferSyntax.h:76
gdcm::TransferSyntax::JPIPReferenced
@ JPIPReferenced
Definition gdcmTransferSyntax.h:85
gdcm::TransferSyntax::WeirdPapryus
@ WeirdPapryus
Definition gdcmTransferSyntax.h:83
gdcm::TransferSyntax::ExplicitVRBigEndian
@ ExplicitVRBigEndian
Definition gdcmTransferSyntax.h:66
gdcm::TransferSyntax::TS_END
@ TS_END
Definition gdcmTransferSyntax.h:92
gdcm::TransferSyntax::JPEGExtendedProcess3_5
@ JPEGExtendedProcess3_5
Definition gdcmTransferSyntax.h:69
gdcm::TransferSyntax::RLELossless
@ RLELossless
Definition gdcmTransferSyntax.h:80
gdcm::TransferSyntax::MPEG2MainProfileHighLevel
@ MPEG2MainProfileHighLevel
Definition gdcmTransferSyntax.h:86
gdcm::TransferSyntax::JPEGLosslessProcess14_1
@ JPEGLosslessProcess14_1
Definition gdcmTransferSyntax.h:73
gdcm::TransferSyntax::JPEGSpectralSelectionProcess6_8
@ JPEGSpectralSelectionProcess6_8
Definition gdcmTransferSyntax.h:70
gdcm::TransferSyntax::HTJ2KLossless
@ HTJ2KLossless
Definition gdcmTransferSyntax.h:89
gdcm::TransferSyntax::ExplicitVRLittleEndian
@ ExplicitVRLittleEndian
Definition gdcmTransferSyntax.h:64
gdcm::TransferSyntax::DeflatedExplicitVRLittleEndian
@ DeflatedExplicitVRLittleEndian
Definition gdcmTransferSyntax.h:65
gdcm::TransferSyntax::JPEG2000Part2Lossless
@ JPEG2000Part2Lossless
Definition gdcmTransferSyntax.h:78
gdcm::TransferSyntax::MPEG4AVCH264BDcompatibleHighProfileLevel4_1
@ MPEG4AVCH264BDcompatibleHighProfileLevel4_1
Definition gdcmTransferSyntax.h:88
gdcm::TransferSyntax::ImplicitVRBigEndianPrivateGE
@ ImplicitVRBigEndianPrivateGE
Definition gdcmTransferSyntax.h:63
gdcm::TransferSyntax::HTJ2K
@ HTJ2K
Definition gdcmTransferSyntax.h:91
gdcm::TransferSyntax::JPEGBaselineProcess1
@ JPEGBaselineProcess1
Definition gdcmTransferSyntax.h:67
gdcm::TransferSyntax::JPEGExtendedProcess2_4
@ JPEGExtendedProcess2_4
Definition gdcmTransferSyntax.h:68
gdcm::TransferSyntax::JPEGLSLossless
@ JPEGLSLossless
Definition gdcmTransferSyntax.h:74
gdcm::TransferSyntax::ImplicitVRLittleEndian
@ ImplicitVRLittleEndian
Definition gdcmTransferSyntax.h:62
gdcm::TransferSyntax::JPEGLosslessProcess14
@ JPEGLosslessProcess14
Definition gdcmTransferSyntax.h:72
gdcm::TransferSyntax::IsExplicit
bool IsExplicit() const
gdcm::TransferSyntax::IsLossy
bool IsLossy() const
gdcm::TransferSyntax::GetString
const char * GetString() const
Definition gdcmTransferSyntax.h:130
gdcm::TransferSyntax::NegociatedType
NegociatedType
Definition gdcmTransferSyntax.h:42
gdcm::TransferSyntax::Unknown
@ Unknown
Definition gdcmTransferSyntax.h:43
gdcm::TransferSyntax::Explicit
@ Explicit
Definition gdcmTransferSyntax.h:44
gdcm::TransferSyntax::Implicit
@ Implicit
Definition gdcmTransferSyntax.h:45
gdcm::TransferSyntax::IsLossless
bool IsLossless() const
gdcm::TransferSyntax::TransferSyntax
TransferSyntax(TSType type=ImplicitVRLittleEndian)
Definition gdcmTransferSyntax.h:113
gdcmSwapCode.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21
gdcm::operator<<
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88