IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
PlanExtractor.h
1 // PlanExtractor.h:
3 // ----------------
4 //
14 
15 #ifndef __IPSDKIMAGE_PLANEXTRACTOR_H__
16 #define __IPSDKIMAGE_PLANEXTRACTOR_H__
17 
18 // suppression warnings
19 // warning C4251: 'ipsdk::image::BaseDiskImageAccessor::_filePath' : class 'boost::filesystem::path' nécessite une interface DLL pour être utilisé(e) par les clients de class 'ipsdk::image::BaseDiskImageAccessor'
20 #pragma warning (push)
21 #pragma warning (disable : 4251)
22 
24 #include <IPSDKImage/Image/BaseImage.h>
25 #include <unordered_map>
26 
27 namespace ipsdk {
28 namespace image {
29 
32 
34 {
35 public:
38  PlanExtractor();
39  ~PlanExtractor();
41 
42 // methods
43 public:
44  const ipUInt8* extractBuffer(const std::string& key,
45  const ImageConstPtr pImage,
46  const ipUInt64 z = 0, const ipUInt64 c = 0, const ipUInt64 t = 0,
47  const ipUInt64 dataOffset = 0);
48 
49  ipUInt8* extractBuffer(const std::string& key,
50  const ImagePtr pImage,
51  const ipUInt64 z = 0, const ipUInt64 c = 0, const ipUInt64 t = 0,
52  const ipUInt64 dataOffset = 0);
53 
54  const ipUInt8* extractLineBuffer(const std::string& key,
55  const ImageConstPtr pImage,
56  const ipUInt64 z, const ipUInt64 c, const ipUInt64 t,
57  const ipUInt64 lineIdx);
58 
59  ipUInt8* extractLineBuffer(const std::string& key,
60  const ImagePtr pImage,
61  const ipUInt64 z, const ipUInt64 c, const ipUInt64 t,
62  const ipUInt64 lineIdx);
63 
64  BoolResult writeBufferToImage(const std::string& key);
65 
66  BoolResult writeValueToImage(const std::string& key, const ipReal64 value,
67  const ipUInt64 x, const ipUInt64 y,
68  const ipUInt64 z = 0, const ipUInt64 c = 0, const ipUInt64 t = 0);
69 
70  void clear();
71 
72 // attributes
73 protected:
74  template <typename ImagePtrType>
76  ipUInt64 _z; // Z index of the extracted plan
77  ipUInt64 _c; // C index of the extracted plan
78  ipUInt64 _t; // T index of the extracted plan
79  ipUInt64 _offset; // Data offset in pixels
80  ipUInt64 _bufferSize; // Number of pixels in the buffer
81  std::vector<char> _vBuffer; // Buffer containing the data in the RAM
82  ImagePtrType _pImage; // Pointer to the complete IPSDK image
83  };
84 
87 
88  typedef boost::shared_ptr< BufferInfo > BufferInfoPtr;
89  typedef boost::shared_ptr< BufferConstInfo > BufferConstInfoPtr;
90 
91  BufferInfoPtr createBufferInfo(const ImagePtr pImage,
92  const ipUInt64 z = 0, const ipUInt64 c = 0, const ipUInt64 t = 0,
93  const ipUInt64 dataOffset = 0);
94 
95  BufferConstInfoPtr createBufferInfo(const ImageConstPtr pImage,
96  const ipUInt64 z = 0, const ipUInt64 c = 0, const ipUInt64 t = 0,
97  const ipUInt64 dataOffset = 0);
98 
99  void updateBufferInfo(BufferInfoPtr& pBufInfo,
100  const ImagePtr pImage,
101  const ipUInt64 z = 0, const ipUInt64 c = 0, const ipUInt64 t = 0,
102  const ipUInt64 dataOffset = 0);
103 
104  void updateBufferInfo(BufferConstInfoPtr& pBufInfo,
105  const ImageConstPtr pImage,
106  const ipUInt64 z = 0, const ipUInt64 c = 0, const ipUInt64 t = 0,
107  const ipUInt64 dataOffset = 0);
108 
109 // attributes
110 protected:
111 
112  typedef std::map<std::string, BufferConstInfoPtr> BufferConstColl;
113  typedef std::map<std::string, BufferInfoPtr> BufferColl;
114 
115  BufferColl _mBuffers;
116  BufferConstColl _mBuffersConst;
117 
118 };
119 
122 
123 } // end of namespace image
124 } // end of namespace ipsdk
125 
126 #pragma warning (pop)
127 
128 #endif // __IPSDKIMAGE_PLANEXTRACTOR_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
uint64_t ipUInt64
Base types definition.
Definition: BaseTypes.h:55
Definition: PlanExtractor.h:75
boost::shared_ptr< BaseImage > ImagePtr
Definition: ImageTypes.h:139
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
uint8_t ipUInt8
Base types definition.
Definition: BaseTypes.h:49
Class allowing to extract a plan from several image types (memory, disk, ...)
Definition: PlanExtractor.h:33
Definition of import/export macro for library.
#define IPSDKIMAGE_API
Import/Export macro for library IPSDKImage.
Definition: IPSDKImageExports.h:27
boost::shared_ptr< const BaseImage > ImageConstPtr
Definition: ImageTypes.h:140