GDCM  2.2.0
gdcmTransferSyntax.h
Go to the documentation of this file.
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     JPIPReferenced,
00079     RLELossless,
00080     MPEG2MainProfile,
00081     ImplicitVRBigEndianACRNEMA,
00082 #ifdef GDCM_SUPPORT_BROKEN_IMPLEMENTATION
00083     WeirdPapryus,
00084 #endif
00085     CT_private_ELE,
00086     TS_END
00087   } TSType;
00088 
00089   // Return the string as written in the official DICOM dict from
00090   // a custom enum type
00091   static const char* GetTSString(TSType ts);
00092   static TSType GetTSType(const char *str);
00093 
00094   NegociatedType GetNegociatedType() const;
00095 
00099   SwapCode GetSwapCode() const;
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 
00118   bool IsLossy() const;
00120   bool IsLossless() const;
00122   bool CanStoreLossy() const;
00123 
00124   const char *GetString() const { return TransferSyntax::GetTSString(TSField); }
00125 
00126   friend std::ostream &operator<<(std::ostream &os, const TransferSyntax &ts);
00127 private:
00128   // DO NOT EXPOSE the following. Internal details of TransferSyntax
00129 bool IsImplicit(TSType ts) const;
00130 bool IsExplicit(TSType ts) const;
00131 bool IsLittleEndian(TSType ts) const;
00132 bool IsBigEndian(TSType ts) const;
00133 
00134   TSType TSField;
00135 };
00136 //-----------------------------------------------------------------------------
00137 inline std::ostream &operator<<(std::ostream &_os, const TransferSyntax &ts)
00138 {
00139   _os << TransferSyntax::GetTSString(ts);
00140   return _os;
00141 
00142 }
00143 
00144 } // end namespace gdcm
00145 
00146 #endif //GDCMTRANSFERSYNTAX_H

Generated on Fri Jun 1 2012 19:00:32 for GDCM by doxygen 1.7.6.1
SourceForge.net Logo