fw4spl
ImageDicomStream.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2015.
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 #ifndef __VTKGDCMIO_HELPER_IMAGEDICOMSTREAM_HPP__
8 #define __VTKGDCMIO_HELPER_IMAGEDICOMSTREAM_HPP__
9 
10 #include <vector>
11 
12 #include <boost/iostreams/stream.hpp>
13 
14 #include <vtkSmartPointer.h>
15 #include <vtkGDCMImageReader.h>
16 
17 #include <fwCore/base.hpp>
18 
19 #include <fwMemory/stream/in/IFactory.hpp>
20 
21 #include "vtkGdcmIO/config.hpp"
22 
23 namespace vtkGdcmIO
24 {
25 namespace helper
26 {
27 
28 //------------------------------------------------------------------------------
29 
32 {
33 
34 public:
35 
36  typedef std::vector< std::string > SeriesFilesType;
37 
38  typedef SPTR ( ImageDicomInfo ) sptr;
39 
42 
44  SeriesFilesType m_seriesFiles;
45 };
46 
47 //------------------------------------------------------------------------------
48 
51 {
52 public:
53 
54  typedef char char_type;
55 
56  typedef ::boost::iostreams::source_tag category;
57 
59  ImageDicomSource( ImageDicomInfo::sptr dcmInfo );
60 
62  std::streamsize read(char* s, std::streamsize n);
63 
64 private:
65 
70  bool readImage();
71 
73  ImageDicomInfo::sptr m_dcmInfo;
74 
76  size_t m_pos;
77 
79  vtkSmartPointer< vtkGDCMImageReader > m_reader;
80 
82  char * m_inputReader;
83 
85  bool m_success;
86 };
87 
88 //------------------------------------------------------------------------------
89 
92 {
93 
94 public:
95 
97  ImageDicomStream( ImageDicomInfo::sptr dcmInfo );
98 
99 protected:
100 
102  SPTR(std::istream) get();
103 
105  ImageDicomInfo::sptr m_dcmInfo;
106 };
107 
108 //------------------------------------------------------------------------------
109 
110 } // namespace helper
111 } // namespace vtkGdcmIO
112 
113 #endif // __VTKGDCMIO_HELPER_IMAGEDICOMSTREAM_HPP__
#define SPTR(_cls_)
size_t m_buffSizeInBytes
Size of image buffer in bytes.
Class to perform a lazy reading on dicom image with fw4spl system.
vtkmGdcm reader/writer lib
Definition: GdcmHelper.hpp:15
SeriesFilesType m_seriesFiles
Dicom files that represents an image series.
Class used to build an std::istream thanks to ::boost::iostreams api.
ImageDicomInfo::sptr m_dcmInfo
To conserve dicom information.
Basic class to store some information to read an dicom image.