GDCM  2.2.0
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 protected:
46  bool Decode(std::istream &is_, std::ostream &os);
47  virtual bool IsValid(PhotometricInterpretation const &pi);
48 public:
49 
50  unsigned int GetPlanarConfiguration() const
51  {
52  return PlanarConfiguration;
53  }
54  void SetPlanarConfiguration(unsigned int pc)
55  {
56  assert( pc == 0 || pc == 1 );
57  PlanarConfiguration = pc;
58  }
59 
60  PixelFormat &GetPixelFormat()
61  {
62  return PF;
63  }
64  const PixelFormat &GetPixelFormat() const
65  {
66  return PF;
67  }
68  virtual void SetPixelFormat(PixelFormat const &pf)
69  {
70  PF = pf;
71  }
72  const PhotometricInterpretation &GetPhotometricInterpretation() const;
73  void SetPhotometricInterpretation(PhotometricInterpretation const &pi);
74 
75  bool GetNeedByteSwap() const
76  {
77  return NeedByteSwap;
78  }
79  void SetNeedByteSwap(bool b)
80  {
81  NeedByteSwap = b;
82  }
83  void SetNeedOverlayCleanup(bool b)
84  {
85  NeedOverlayCleanup = b;
86  }
87  void SetLUT(LookupTable const &lut)
88  {
89  LUT = SmartPointer<LookupTable>( const_cast<LookupTable*>(&lut) );
90  }
91  const LookupTable &GetLUT() const
92  {
93  return *LUT;
94  }
95 
96  void SetDimensions(const unsigned int *d)
97  {
98  Dimensions[0] = d[0];
99  Dimensions[1] = d[1];
100  Dimensions[2] = d[2];
101  }
102 
103  void SetDimensions(const std::vector<unsigned int> & d)
104  {
105  size_t theSize = d.size();
106  assert(theSize<= 3);
107  for (size_t i = 0; i < 3; i++)
108  {
109  if (i < theSize)
110  Dimensions[i] = d[i];
111  else
112  Dimensions[i] = 1;
113  }
114  }
115  const unsigned int *GetDimensions() const { return Dimensions; }
116  void SetNumberOfDimensions(unsigned int dim);
117  unsigned int GetNumberOfDimensions() const;
118 
119 protected:
122 //private:
123  unsigned int PlanarConfiguration;
128 
131  unsigned int Dimensions[3]; // FIXME
132  unsigned int NumberOfDimensions;
133  bool LossyFlag;
134 
135  bool DoOverlayCleanup(std::istream &is_, std::ostream &os);
136  bool DoByteSwap(std::istream &is_, std::ostream &os);
137  bool DoYBR(std::istream &is_, std::ostream &os);
138  bool DoPlanarConfiguration(std::istream &is_, std::ostream &os);
139  bool DoSimpleCopy(std::istream &is_, std::ostream &os);
140  bool DoPaddedCompositePixelCode(std::istream &is_, std::ostream &os);
141  bool DoInvertMonochrome(std::istream &is_, std::ostream &os);
142 
143  //template <typename T>
144  //bool DoInvertPlanarConfiguration(T *output, const T *input, uint32_t length);
145 };
146 
147 } // end namespace gdcm
148 
149 #endif //GDCMIMAGECODEC_H

Generated on Wed Jun 13 2012 20:40:37 for GDCM by doxygen 1.8.1
SourceForge.net Logo