# 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     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
    00119   bool IsLossy() const;
    00120   bool IsLossless() const;
    00121
    00122   const char *GetString() const { return TransferSyntax::GetTSString(TSField); }
    00123
    00124   friend std::ostream &operator<<(std::ostream &os, const TransferSyntax &ts);
    00125 private:
    00126   // DO NOT EXPOSE the following. Internal details of TransferSyntax
    00127 bool IsImplicit(TSType ts) const;
    00128 bool IsExplicit(TSType ts) const;
    00129 bool IsLittleEndian(TSType ts) const;
    00130 bool IsBigEndian(TSType ts) const;
    00131
    00132   TSType TSField;
    00133 };
    00134 //-----------------------------------------------------------------------------
    00135 inline std::ostream &operator<<(std::ostream &_os, const TransferSyntax &ts)
    00136 {
    00137   _os << TransferSyntax::GetTSString(ts);
    00138   return _os;
    00139
    00140 }
    00141
    00142 } // end namespace gdcm
    00143
    00144 #endif //GDCMTRANSFERSYNTAX_H
    00145