fw4spl
ImageLazyStream.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 "fwDcmtkIO/config.hpp"
10 
11 #include <fwCore/base.hpp>
12 
13 #include <fwMedData/DicomSeries.hpp>
14 
15 #include <fwMemory/stream/in/IFactory.hpp>
16 
17 #include <fwTools/Type.hpp>
18 
19 #include <boost/iostreams/stream.hpp>
20 
21 #include <vector>
22 
23 namespace fwDcmtkIO
24 {
25 namespace reader
26 {
27 namespace main
28 {
29 
30 //------------------------------------------------------------------------------
31 
35 class FWDCMTKIO_CLASS_API ImageLazyInformation
36 {
37 public:
38  typedef SPTR ( ImageLazyInformation ) sptr;
39 
41  ::fwMedData::DicomSeries::csptr m_dicomSeries;
42 
44  unsigned int m_rows;
45 
47  unsigned int m_columns;
48 
50  unsigned int m_depth;
51 
54 
57 
59  unsigned short m_pixelRepresentation;
60 
63 
64 };
65 
66 //------------------------------------------------------------------------------
67 
71 class FWDCMTKIO_CLASS_API ImageLazySource
72 {
73 public:
74  typedef char char_type;
75  typedef ::boost::iostreams::source_tag category;
76 
81  ImageLazySource( ImageLazyInformation::sptr dcmInfo );
82 
88  std::streamsize read(char* s, std::streamsize n);
89 
90 private:
92  ImageLazyInformation::sptr m_dcmInfo;
93 
95  size_t m_frameSize;
96 
98  int m_currentFrame;
99 
101  size_t m_currentPosition;
102 
104  char* m_frame;
105 
107  ::fwMedData::DicomSeries::DicomContainerType::const_iterator m_currentDicom;
108 };
109 
110 //------------------------------------------------------------------------------
111 
115 class FWDCMTKIO_CLASS_API ImageLazyStream : public ::fwMemory::stream::in::IFactory
116 {
117 
118 public:
119 
124  ImageLazyStream( ImageLazyInformation::sptr dcmInfo );
125 
126 protected:
127 
129  SPTR(std::istream) get();
130 
132  ImageLazyInformation::sptr m_dcmInfo;
133 };
134 
135 //------------------------------------------------------------------------------
136 
137 } //main
138 } //reader
139 } //fwDcmtkIO
#define SPTR(_cls_)
unsigned int m_columns
Number of columns in the image.
unsigned int m_depth
Depth of the image.
unsigned short m_pixelRepresentation
Pixel representation.
Basic class used to store informations in order to read DICOM images.
ImageLazyInformation::sptr m_dcmInfo
To conserve dicom information.
unsigned int m_rows
Number of rows in the image.
Class used to perform a lazy reading of dicom images with fw4spl system.
Class describing an elementary C++ type aka unsigned char, signed char, .... int, float...
Definition: Type.hpp:32
fwDcmtkIO contains classes used to pull Dicom images from a pacs using dcmtk library.
Definition: Codec.hpp:12
::fwMedData::DicomSeries::csptr m_dicomSeries
Dicom series used to get the paths of the instances.
Class used to build a std::istream using the ::boost::iostreams api.