GDCM
2.0.18
|
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 GDCMTRANSFERSYNTAX_H 00015 #define GDCMTRANSFERSYNTAX_H 00016 00017 #include "gdcmSwapCode.h" 00018 00019 namespace gdcm 00020 { 00021 00039 class GDCM_EXPORT TransferSyntax 00040 { 00041 public: 00042 typedef enum { 00043 Unknown = 0, 00044 Explicit, 00045 Implicit 00046 } NegociatedType; 00047 00048 #if 0 00049 //NOT FLEXIBLE, since force user to update lib everytime new module 00050 //comes out... 00051 // TODO 00052 typedef enum { 00053 NoSpacing = 0, 00054 PixelSpacing, 00055 ImagerPixelSpacing, 00056 PixelAspectRatio 00057 } ImageSpacingType; 00058 ImageSpacingType GetImageSpacing(); 00059 #endif 00060 00061 typedef enum { 00062 ImplicitVRLittleEndian = 0, 00063 ImplicitVRBigEndianPrivateGE, 00064 ExplicitVRLittleEndian, 00065 DeflatedExplicitVRLittleEndian, 00066 ExplicitVRBigEndian, 00067 JPEGBaselineProcess1, 00068 JPEGExtendedProcess2_4, 00069 JPEGExtendedProcess3_5, 00070 JPEGSpectralSelectionProcess6_8, 00071 JPEGFullProgressionProcess10_12, 00072 JPEGLosslessProcess14, 00073 JPEGLosslessProcess14_1, 00074 JPEGLSLossless, 00075 JPEGLSNearLossless, 00076 JPEG2000Lossless, 00077 JPEG2000, 00078 RLELossless, 00079 MPEG2MainProfile, 00080 ImplicitVRBigEndianACRNEMA, 00081 #ifdef GDCM_SUPPORT_BROKEN_IMPLEMENTATION 00082 WeirdPapryus, 00083 #endif 00084 CT_private_ELE, 00085 TS_END 00086 } TSType; 00087 00088 // Return the string as written in the official DICOM dict from 00089 // a custom enum type 00090 static const char* GetTSString(TSType ts); 00091 static TSType GetTSType(const char *str); 00092 00093 NegociatedType GetNegociatedType() const; 00094 00098 SwapCode GetSwapCode() const; 00099 00100 bool IsValid() const { return TSField != TS_END; } 00101 00102 operator TSType () const { return TSField; } 00103 00104 // FIXME: ImplicitVRLittleEndian used to be the default, but nowadays 00105 // this is rather the ExplicitVRLittleEndian instead...should be change the default ? 00106 TransferSyntax(TSType type = ImplicitVRLittleEndian):TSField(type) {} 00107 00108 // return if dataset is encoded or not (Deflate Explicit VR) 00109 bool IsEncoded() const; 00110 00111 bool IsImplicit() const; 00112 bool IsExplicit() const; 00113 00114 bool IsEncapsulated() const; 00115 00117 bool IsLossy() const; 00119 bool IsLossless() const; 00121 bool CanStoreLossy() const; 00122 00123 const char *GetString() const { return TransferSyntax::GetTSString(TSField); } 00124 00125 friend std::ostream &operator<<(std::ostream &os, const TransferSyntax &ts); 00126 private: 00127 // DO NOT EXPOSE the following. Internal details of TransferSyntax 00128 bool IsImplicit(TSType ts) const; 00129 bool IsExplicit(TSType ts) const; 00130 bool IsLittleEndian(TSType ts) const; 00131 bool IsBigEndian(TSType ts) const; 00132 00133 TSType TSField; 00134 }; 00135 //----------------------------------------------------------------------------- 00136 inline std::ostream &operator<<(std::ostream &_os, const TransferSyntax &ts) 00137 { 00138 _os << TransferSyntax::GetTSString(ts); 00139 return _os; 00140 00141 } 00142 00143 } // end namespace gdcm 00144 00145 #endif //GDCMTRANSFERSYNTAX_H