IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
BaseImageTile2d.h
1 // BaseImageTile2d.h:
3 // ------------------
4 //
14 
15 #ifndef __IPSDKIMAGE_BASEIMAGETILE2D_H__
16 #define __IPSDKIMAGE_BASEIMAGETILE2D_H__
17 
18 // suppression warnings
19 // warning C4251: 'ipsdk::image::BaseImageTile2d::_bufferType' : class 'ipsdk::image::eImageBufferType' needs to have dll-interface to be used by clients of class 'ipsdk::image::BaseImageTile2d'
20 #pragma warning (push)
21 #pragma warning (disable : 4251)
22 
23 #include <IPSDKImage/Fragment/Tile/BaseImageTile.h>
25 
26 namespace ipsdk {
27 namespace image {
28 
29 class BaseImageTile3d;
30 class InputImageTile3d;
31 
34 
36 {
37  // declare serial class
39 
40  // friend class for protected members access
41  friend class BaseImageTile3d;
42  friend class InputImageTile3d;
43 
44 // predefined public types
45 public:
47  static const eImageTileType::domain g_imageTileType = eImageTileType::eITT_2d;
48 
49 public:
53  virtual ~BaseImageTile2d() = 0;
55 
56 // methods
57 public:
59  eImageTileType getImageTileType() const;
60 
64  ipUInt64 getImageSizeX() const;
65  ipUInt64 getImageSizeY() const;
67 
71  ipInt64 getTileStartOffsetX() const;
72  ipInt64 getTileStartOffsetY() const;
74 
78  ipUInt64 getTileSizeX() const;
79  ipUInt64 getTileSizeY() const;
81 
86  ipUInt64 getTileEndOffsetX() const;
87  ipUInt64 getTileEndOffsetY() const;
89 
92  const eImageBufferType& getBufferType() const;
93 
96  const ipUInt64 getFullTileSize() const;
97 
100  const ipUInt64 getPlanTileSize() const;
101 
104  const ipUInt64 getTileNbPlans() const;
105 
106  //--------------------
109  //--------------------
110 
113  ipUInt64 getZPlanIdx() const;
114 
117  ipUInt64 getCPlanIdx() const;
118 
121  ipUInt64 getTPlanIdx() const;
123 
127  const FragHybridBuffer& getBuffer() const;
128 
134  template <typename T>
135  const T* getBuffer(const ipUInt64 rowIdx) const
136  {
137  return static_cast<const T*>(accessBuffer(rowIdx));
138  }
139 
140 protected:
142  void initBase(const ipUInt64 zPlanIdx,
143  const ipUInt64 cPlanIdx,
144  const ipUInt64 tPlanIdx,
145  const ipInt64 tileStartOffsetX,
146  const ipInt64 tileStartOffsetY,
147  const ipUInt64 tileSizeX,
148  const ipUInt64 tileSizeY,
149  const PlanStoragePtr& pPlanStorage,
150  const DataIdentifierConstPtr& pImageIdentifier,
151  const DataItemMapConstPtr& pImageHeader);
152 
154  void initBase(const ipUInt64 zPlanIdx,
155  const ipUInt64 cPlanIdx,
156  const ipUInt64 tPlanIdx,
157  const ipInt64 tileStartOffsetX,
158  const ipInt64 tileStartOffsetY,
159  const ipUInt64 tileSizeX,
160  const ipUInt64 tileSizeY,
161  const ipUInt64 imageSizeX,
162  const ipUInt64 imageSizeY,
164  const DataIdentifierConstPtr& pImageIdentifier,
165  const DataItemMapConstPtr& pImageHeader);
166 
168  bool isBufferInitDerived() const;
169 
171  BoolResult initBufferDerived();
172 
174  void clearBufferDerived();
175 
177  eDataAccessMode retrieveAccessMode() const;
178 
179  //-----------------------------------
182  //-----------------------------------
183 
186  BoolResult readDataDerived() const;
187 
190  BoolResult writeDataDerived();
192 
195  FragHybridBuffer& accessBuffer() const;
196 
202  const void* accessBuffer(const ipUInt64 rowIdx) const;
203  void* accessBuffer(const ipUInt64 rowIdx);
205 
207  void clearDerived();
208 
211  void retrieveIntersection(tile::ImageTileInfo2d& imageTileInfo2d) const;
212 
213 // attributes
214 private:
217  ipUInt64 _zPlanIdx;
218  ipUInt64 _cPlanIdx;
219  ipUInt64 _tPlanIdx;
221 
224  ipUInt64 _imageSizeX;
225  ipUInt64 _imageSizeY;
227 
230  ipInt64 _tileStartOffsetX;
231  ipInt64 _tileStartOffsetY;
233 
236  ipUInt64 _tileSizeX;
237  ipUInt64 _tileSizeY;
239 
241  eImageBufferType _bufferType;
242 
244  PlanStoragePtr _pPlanStorage;
245 
247  mutable FragHybridBufferPtr _pBuffer;
248 };
249 
252 
253 inline eImageTileType
255 {
256  return g_imageTileType;
257 }
258 
259 inline const FragHybridBuffer&
261 {
262  return accessBuffer();
263 }
264 
267 } // end of namespace image
268 } // end of namespace ipsdk
269 
270 #pragma warning (pop)
271 
272 #endif // __IPSDKIMAGE_BASEIMAGETILE2D_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
boost::shared_ptr< FragHybridBuffer > FragHybridBufferPtr
shared pointer to FragHybridBuffer
Definition: BufferTypes.h:82
Definition: ImageTileTypes.h:99
eDataAccessMode
Enumerate describing access mode for an image fragment data.
Definition: ImageFragmentTypes.h:45
uint64_t ipUInt64
Base types definition.
Definition: BaseTypes.h:55
image 2d tile
Definition: ImageTileTypes.h:43
eImageTileType
Enumerate describing image tile type.
Definition: ImageTileTypes.h:41
static const eImageTileType::domain g_imageTileType
image tile type
Definition: BaseImageTile2d.h:47
#define IPSDK_DECLARE_ABSTRACT_SERIAL_WITHOUT_COPY(libraryName, className)
macro enabling serialization on abstract class
Definition: SerializationHdrMacro.h:97
eImageTileType getImageTileType() const
retrieve image tile type
Definition: BaseImageTile2d.h:254
Predefined types for buffer manipulations.
const FragHybridBuffer & getBuffer() const
retrieve tile full buffer
Definition: BaseImageTile2d.h:260
Class allowing to encapsulate an hybrid form of fragment buffer.
Definition: FragHybridBuffer.h:53
Base class for 2 image tiles.
Definition: BaseImageTile2d.h:35
IPSDKIMAGEPROCESSING_API processor::RulePtr bufferType(const ImageAttributeConstWeakPtr &pImageAttribute, const IBTAttributeConstWeakPtr &pIBTAttribute)
function allowing to check that an image correspond to a given image buffer types attribute ...
boost::shared_ptr< const DataItemMap > DataItemMapConstPtr
shared pointer to const DataItemMap
Definition: DataItemTypes.h:170
Base class for 3d image tiles.
Definition: BaseImageTile3d.h:32
#define IPSDKIMAGE_API
Import/Export macro for library IPSDKImage.
Definition: IPSDKImageExports.h:27
FragHybridBuffer & accessBuffer() const
access to tile full buffer
boost::shared_ptr< BasePlanStorage > PlanStoragePtr
shared pointer to image plan storage
Definition: PlanStorageTypes.h:55
Input class for 3d image tiles.
Definition: InputImageTile3d.h:27
boost::shared_ptr< const DataIdentifier > DataIdentifierConstPtr
shared pointer to const data identifier
Definition: DataIdentifierTypes.h:31
Base class for image tile.
Definition: BaseImageTile.h:27
int64_t ipInt64
Base types definition.
Definition: BaseTypes.h:54
const T * getBuffer(const ipUInt64 rowIdx) const
retrieve tile row buffer for a given row index
Definition: BaseImageTile2d.h:135
eImageBufferType
types associated to image buffers
Definition: ImageTypes.h:78