fw4spl
io/fwGdcmIO/include/fwGdcmIO/reader/ie/Image.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #pragma once
8 
9 #include "fwGdcmIO/exception/Failed.hpp"
10 #include "fwGdcmIO/reader/ie/InformationEntity.hpp"
11 
12 #include <fwData/Image.hpp>
13 
14 #include <boost/numeric/ublas/matrix.hpp>
15 
16 namespace fwGdcmIO
17 {
18 namespace reader
19 {
20 namespace ie
21 {
22 
26 class FWGDCMIO_CLASS_API Image : public ::fwGdcmIO::reader::ie::InformationEntity< ::fwData::Image >
27 {
28 
29 public:
40  FWGDCMIO_API Image(const CSPTR(::fwMedData::DicomSeries)& dicomSeries,
41  const SPTR(::gdcm::Reader)& reader,
42  const SPTR(::fwGdcmIO::container::DicomInstance)& instance,
43  const ::fwData::Image::sptr& image,
44  const ::fwLog::Logger::sptr& logger = nullptr,
45  ProgressCallback progress = nullptr,
46  CancelRequestedCallback cancel = nullptr);
47 
49  FWGDCMIO_API virtual ~Image();
50 
55  FWGDCMIO_API virtual void readImagePlaneModule();
56 
61  FWGDCMIO_API virtual void readImagePixelModule();
62 
67  FWGDCMIO_API virtual void readVOILUTModule();
68 
70  void setBufferRotationEnabled(bool enabled)
71  {
72  m_enableBufferRotation = enabled;
73  }
74 
75 protected:
76 
77  typedef ::boost::numeric::ublas::matrix< double, ::boost::numeric::ublas::row_major,
78  std::vector<double> > MatrixType;
79  typedef ::boost::numeric::ublas::vector< double > VectorType;
80 
89  char* readImageBuffer(const std::vector<unsigned int>& dimensions,
90  const unsigned short bitsAllocated,
91  const unsigned short newBitsAllocated,
92  const bool performRescale) throw(::fwGdcmIO::exception::Failed);
93 
100  char* correctImageOrientation(char* buffer, const std::vector<unsigned int>& dimensions,
101  unsigned short bitsAllocated);
102 
107  MatrixType computeInverseMatrix(MatrixType matrix);
108 
111 };
112 
113 } // namespace ie
114 } // namespace reader
115 } // namespace fwGdcmIO
#define SPTR(_cls_)
#define CSPTR(_cls_)
void setBufferRotationEnabled(bool enabled)
Enable buffer rotation.
InformationEntity base class used to read modules.
This class defines a DICOM SOP instance. It is useful during the whole writing process. This class allows to share data between module writers.
The namespace fwGdcmIO contains reader, writer and helper for dicom data.
Implements a failed exception class for fwGdcmIO.