gdcmTransferSyntax.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program: GDCM (Grassroots DICOM). A DICOM library
00004   Module:  $URL$
00005 
00006   Copyright (c) 2006-2009 Mathieu Malaterre
00007   All rights reserved.
00008   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 #ifndef __gdcmTransferSyntax_h
00016 #define __gdcmTransferSyntax_h
00017 
00018 #include "gdcmSwapCode.h"
00019 
00020 namespace gdcm
00021 {
00022 
00038 class GDCM_EXPORT TransferSyntax
00039 {
00040 public:
00041   typedef enum {
00042     Unknown = 0,
00043     Explicit,
00044     Implicit
00045   } NegociatedType;
00046 
00047 #if 0
00048   //NOT FLEXIBLE, since force user to update lib everytime new module
00049   //comes out...
00050   // TODO
00051   typedef enum {
00052     NoSpacing = 0,
00053     PixelSpacing,
00054     ImagerPixelSpacing,
00055     PixelAspectRatio
00056   } ImageSpacingType;
00057   ImageSpacingType GetImageSpacing();
00058 #endif
00059   
00060   typedef enum {
00061     ImplicitVRLittleEndian = 0,
00062     ImplicitVRBigEndianPrivateGE,
00063     ExplicitVRLittleEndian,
00064     DeflatedExplicitVRLittleEndian,
00065     ExplicitVRBigEndian,
00066     JPEGBaselineProcess1,
00067     JPEGExtendedProcess2_4,
00068     JPEGExtendedProcess3_5,
00069     JPEGSpectralSelectionProcess6_8,
00070     JPEGFullProgressionProcess10_12,
00071     JPEGLosslessProcess14,
00072     JPEGLosslessProcess14_1,
00073     JPEGLSLossless,
00074     JPEGLSNearLossless,
00075     JPEG2000Lossless,
00076     JPEG2000,
00077     RLELossless,
00078     MPEG2MainProfile,
00079     ImplicitVRBigEndianACRNEMA,
00080 #ifdef GDCM_SUPPORT_BROKEN_IMPLEMENTATION
00081     WeirdPapryus,
00082 #endif
00083     TS_END
00084   } TSType;
00085 
00086   // Return the string as written in the official DICOM dict from
00087   // a custom enum type
00088   static const char* GetTSString(TSType ts);
00089   static TSType GetTSType(const char *str);
00090 
00091   NegociatedType GetNegociatedType() const;
00092 
00093   // Return the SwapCode associated with the Transfer Syntax. Be carefull
00094   // with the special GE private syntax the DataSet is written in little
00095   // endian but the Pixel Data is in Big Endian.
00096   SwapCode GetSwapCode() const;
00097 
00098   // TODO
00099   //SwapCode GetPixelDataSwapCode() const { assert(0); };
00100 
00101   bool IsValid() const { return TSField != TS_END; }
00102 
00103   operator TSType () const { return TSField; }
00104 
00105   // FIXME: ImplicitVRLittleEndian used to be the default, but nowadays
00106   // this is rather the ExplicitVRLittleEndian instead...should be change the default ?
00107   TransferSyntax(TSType type = ImplicitVRLittleEndian):TSField(type) {}
00108 
00109   // return if dataset is encoded or not (Deflate Explicit VR)
00110   bool IsEncoded() const;
00111 
00112   bool IsImplicit() const;
00113   bool IsExplicit() const;
00114 
00115   bool IsEncapsulated() const;
00116 
00120   bool IsLossy() const;
00121   bool IsLossless() 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
00146 

Generated on Tue Mar 9 22:40:51 2010 for GDCM by doxygen 1.6.3
SourceForge.net Logo