# 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-2010 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
    00040 class GDCM_EXPORT TransferSyntax
    00041 {
    00042 public:
    00043   typedef enum {
    00044     Unknown = 0,
    00045     Explicit,
    00046     Implicit
    00047   } NegociatedType;
    00048
    00049 #if 0
    00050   //NOT FLEXIBLE, since force user to update lib everytime new module
    00051   //comes out...
    00052   // TODO
    00053   typedef enum {
    00054     NoSpacing = 0,
    00055     PixelSpacing,
    00056     ImagerPixelSpacing,
    00057     PixelAspectRatio
    00058   } ImageSpacingType;
    00059   ImageSpacingType GetImageSpacing();
    00060 #endif
    00061
    00062   typedef enum {
    00063     ImplicitVRLittleEndian = 0,
    00064     ImplicitVRBigEndianPrivateGE,
    00065     ExplicitVRLittleEndian,
    00066     DeflatedExplicitVRLittleEndian,
    00067     ExplicitVRBigEndian,
    00068     JPEGBaselineProcess1,
    00069     JPEGExtendedProcess2_4,
    00070     JPEGExtendedProcess3_5,
    00071     JPEGSpectralSelectionProcess6_8,
    00072     JPEGFullProgressionProcess10_12,
    00073     JPEGLosslessProcess14,
    00074     JPEGLosslessProcess14_1,
    00075     JPEGLSLossless,
    00076     JPEGLSNearLossless,
    00077     JPEG2000Lossless,
    00078     JPEG2000,
    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