GDCM  2.2.6
gdcmImageCodec.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: GDCM (Grassroots DICOM). A DICOM library
4 
5  Copyright (c) 2006-2011 Mathieu Malaterre
6  All rights reserved.
7  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 #ifndef GDCMIMAGECODEC_H
15 #define GDCMIMAGECODEC_H
16 
17 #include "gdcmCodec.h"
19 #include "gdcmLookupTable.h"
20 #include "gdcmSmartPointer.h"
21 #include "gdcmPixelFormat.h"
22 
23 namespace gdcm
24 {
25 
31 {
33 public:
34  ImageCodec();
35  ~ImageCodec();
36  bool CanCode(TransferSyntax const &) const { return false; }
37  bool CanDecode(TransferSyntax const &) const { return false; }
38  bool Decode(DataElement const &is_, DataElement &os);
39  bool IsLossy() const;
40  void SetLossyFlag(bool l);
41  bool GetLossyFlag() const;
42 
43  virtual bool GetHeaderInfo(std::istream &is_, TransferSyntax &ts);
44 
45  virtual ImageCodec * Clone() const = 0;
46 
47 protected:
48  bool DecodeByStreams(std::istream &is_, std::ostream &os);
49  virtual bool IsValid(PhotometricInterpretation const &pi);
50 public:
51 
52  unsigned int GetPlanarConfiguration() const
53  {
54  return PlanarConfiguration;
55  }
56  void SetPlanarConfiguration(unsigned int pc)
57  {
58  assert( pc == 0 || pc == 1 );
59  PlanarConfiguration = pc;
60  }
61 
63  {
64  return PF;
65  }
66  const PixelFormat &GetPixelFormat() const
67  {
68  return PF;
69  }
70  virtual void SetPixelFormat(PixelFormat const &pf)
71  {
72  PF = pf;
73  }
74  const PhotometricInterpretation &GetPhotometricInterpretation() const;
75  void SetPhotometricInterpretation(PhotometricInterpretation const &pi);
76 
77  bool GetNeedByteSwap() const
78  {
79  return NeedByteSwap;
80  }
81  void SetNeedByteSwap(bool b)
82  {
83  NeedByteSwap = b;
84  }
85  void SetNeedOverlayCleanup(bool b)
86  {
87  NeedOverlayCleanup = b;
88  }
89  void SetLUT(LookupTable const &lut)
90  {
91  LUT = SmartPointer<LookupTable>( const_cast<LookupTable*>(&lut) );
92  }
93  const LookupTable &GetLUT() const
94  {
95  return *LUT;
96  }
97 
98  void SetDimensions(const unsigned int d[3]);
99  void SetDimensions(const std::vector<unsigned int> & d);
100  const unsigned int *GetDimensions() const { return Dimensions; }
101  void SetNumberOfDimensions(unsigned int dim);
102  unsigned int GetNumberOfDimensions() const;
103 
104 protected:
107 //private:
108  unsigned int PlanarConfiguration;
113 
116  unsigned int Dimensions[3]; // FIXME
117  unsigned int NumberOfDimensions;
118  bool LossyFlag;
119 
120  bool DoOverlayCleanup(std::istream &is_, std::ostream &os);
121  bool DoByteSwap(std::istream &is_, std::ostream &os);
122  bool DoYBR(std::istream &is_, std::ostream &os);
123  bool DoPlanarConfiguration(std::istream &is_, std::ostream &os);
124  bool DoSimpleCopy(std::istream &is_, std::ostream &os);
125  bool DoPaddedCompositePixelCode(std::istream &is_, std::ostream &os);
126  bool DoInvertMonochrome(std::istream &is_, std::ostream &os);
127 
128  //template <typename T>
129  //bool DoInvertPlanarConfiguration(T *output, const T *input, uint32_t length);
130 };
131 
132 } // end namespace gdcm
133 
134 #endif //GDCMIMAGECODEC_H
LookupTable class.
Definition: gdcmLookupTable.h:29
bool RequestPlanarConfiguration
Definition: gdcmImageCodec.h:105
const PixelFormat & GetPixelFormat() const
Definition: gdcmImageCodec.h:66
void SetLUT(LookupTable const &lut)
Definition: gdcmImageCodec.h:89
void SetPlanarConfiguration(unsigned int pc)
Definition: gdcmImageCodec.h:56
SmartPointer< LookupTable > LUTPtr
Definition: gdcmImageCodec.h:114
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
PhotometricInterpretation PI
Definition: gdcmImageCodec.h:109
bool RequestPaddedCompositePixelCode
Definition: gdcmImageCodec.h:106
unsigned int PlanarConfiguration
Definition: gdcmImageCodec.h:108
ImageCodec.
Definition: gdcmImageCodec.h:30
bool GetNeedByteSwap() const
Definition: gdcmImageCodec.h:77
bool NeedByteSwap
Definition: gdcmImageCodec.h:111
Codec class.
Definition: gdcmCodec.h:26
Class to represent a Data Element either Implicit or Explicit.
Definition: gdcmDataElement.h:58
const unsigned int * GetDimensions() const
Definition: gdcmImageCodec.h:100
bool LossyFlag
Definition: gdcmImageCodec.h:118
virtual void SetPixelFormat(PixelFormat const &pf)
Definition: gdcmImageCodec.h:70
Class to manipulate Transfer Syntax.
Definition: gdcmTransferSyntax.h:39
void SetNeedByteSwap(bool b)
Definition: gdcmImageCodec.h:81
unsigned int GetPlanarConfiguration() const
Definition: gdcmImageCodec.h:52
bool NeedOverlayCleanup
Definition: gdcmImageCodec.h:112
const LookupTable & GetLUT() const
Definition: gdcmImageCodec.h:93
Class to represent an PhotometricInterpretation.
Definition: gdcmPhotometricInterpretation.h:28
bool CanCode(TransferSyntax const &) const
Return whether this coder support this transfer syntax (can code it)
Definition: gdcmImageCodec.h:36
unsigned int NumberOfDimensions
Definition: gdcmImageCodec.h:117
PixelFormat PF
Definition: gdcmImageCodec.h:110
LUTPtr LUT
Definition: gdcmImageCodec.h:115
PixelFormat & GetPixelFormat()
Definition: gdcmImageCodec.h:62
void SetNeedOverlayCleanup(bool b)
Definition: gdcmImageCodec.h:85
bool CanDecode(TransferSyntax const &) const
Return whether this decoder support this transfer syntax (can decode it)
Definition: gdcmImageCodec.h:37
PixelFormat.
Definition: gdcmPixelFormat.h:36
ImageChangePhotometricInterpretation class Class to change the Photometric Interpetation of an input ...
Definition: gdcmImageChangePhotometricInterpretation.h:28
Definition: gdcmTerminal.h:52

Generated on Sat Dec 21 2013 05:56:17 for GDCM by doxygen 1.8.5
SourceForge.net Logo