IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
InputImageTile3dCollSplit.h
1 // InputImageTile3dCollSplit.h:
3 // ----------------------------
4 //
15 
16 #ifndef __IPSDKIMAGEPROCESSING_INPUTIMAGETILE3DCOLLSPLIT_H__
17 #define __IPSDKIMAGEPROCESSING_INPUTIMAGETILE3DCOLLSPLIT_H__
18 
19 #include <IPSDKImageProcessing/DataSplit/TileColl/BaseImageTile3dCollSplit.h>
20 #include <IPSDKImage/Fragment/BorderPolicy/3d/Border3dPolicy.h>
21 #include <IPSDKImage/Fragment/Extractor/ImageTileExtractor.h>
22 #include <IPSDKImage/Fragment/Tile/Tile3d/InputImageTile3d.h>
23 
24 namespace ipsdk {
25 namespace imaproc {
26 
29 
30 template <typename TProcessor, typename TAttribute>
31 class InputImageTile3dCollSplit : public BaseImageTile3dCollSplit<typename TAttribute::TileType>
32 {
33 // predefined public types
34 public:
36  typedef TProcessor ProcessorType;
37 
39  typedef TAttribute AttributeType;
40 
43 
46 
48  typedef boost::shared_ptr<InputImageType> InputImagePtrType;
49 
51  typedef typename TAttribute::TileType OutputTileType;
52 
55 
58 
59 public:
65 
66 // methods
67 public:
69  const std::string& getAttributeName() const;
70 
72  const std::string& getAttributeToolTip() const;
73 
89  void init(const boost::shared_ptr<InputImageType>& pImage,
90  const image::Border3dPolicy& border3dPolicy,
91  const Tile3dCoordsColl& tile3dCoordsColl,
92  const ipUInt64 nbMinEltsPerSplit = 1,
93  const ipUInt64 nbMaxEltsPerSplit = NumericLimits<ipUInt32>::max());
94 
95 protected:
97  bool checkProcessorType(const processor::BaseProcessor& processor);
98 
100  Tile3dPtr extractTile3d(const Tile3dCoords& curTile3dCoords);
101 
106  const Tile3dColl& tile3dColl);
107 
108 // attributes
109 protected:
112 };
113 
116 
117 template <typename TProcessor, typename TAttribute>
118 inline const std::string&
120 {
121  return TAttribute::getObjectNameStr();
122 }
123 
124 template <typename TProcessor, typename TAttribute>
125 inline const std::string&
127 {
128  return TAttribute::getToolTipStr();
129 }
130 
131 template <typename TProcessor, typename TAttribute>
132 inline void
133 InputImageTile3dCollSplit<TProcessor, TAttribute>::init(const boost::shared_ptr<InputImageType>& pImage,
134  const image::Border3dPolicy& border3dPolicy,
135  const Tile3dCoordsColl& tile3dCoordsColl,
136  const ipUInt64 nbMinEltsPerSplit,
137  const ipUInt64 nbMaxEltsPerSplit)
138 {
139  // store input border policy
140  _border3dPolicy = border3dPolicy;
141 
142  // call of base class initialization method
143  return this->initBase(pImage, tile3dCoordsColl, nbMinEltsPerSplit, nbMaxEltsPerSplit);
144 }
145 
146 template <typename TProcessor, typename TAttribute>
147 inline bool
149 {
150  // check for consistency between processor and attribute
152  "This attribute is not part of processor class");
153 
154  return dynamic_cast<const TProcessor*>(&processor) != 0;
155 }
156 
157 template <typename TProcessor, typename TAttribute>
160 {
161  Tile3dPtr pCurTile(boost::make_shared<OutputTileType>());
163  curTile3dCoords._startOffsetX, curTile3dCoords._startOffsetY, curTile3dCoords._startOffsetZ,
164  curTile3dCoords._sizeX, curTile3dCoords._sizeY, curTile3dCoords._sizeZ,
165  *(this->getImagePtr()), _border3dPolicy, *pCurTile);
166 
167  return pCurTile;
168 }
169 
170 template <typename TProcessor, typename TAttribute>
171 inline BoolResult
173  const Tile3dColl& tile3dColl)
174 {
175  // cast of input processor object
176  TProcessor& tProcessor = static_cast<TProcessor&>(processor);
177 
178  // update of processor attribute value
179  tProcessor.TProcessor::template set<TAttribute>(tile3dColl);
180 
181  return true;
182 }
183 
186 
187 } // end of namespace imaproc
188 } // end of namespace ipsdk
189 
190 #endif // __IPSDKIMAGEPROCESSING_INPUTIMAGETILE3DCOLLSPLIT_H__
BaseClassType::Tile3dColl Tile3dColl
tile 3d collection created by splitting operation
Definition: InputImageTile3dCollSplit.h:57
Class allowing to encapsulate a typed process result associated to a string description.
Definition: ProcessingResult.h:28
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Base class for image tile 2d collection split operations for data dispatch.
Definition: BaseImageTile3dCollSplit.h:33
uint64_t ipUInt64
Base types definition.
Definition: BaseTypes.h:55
boost::shared_ptr< InputImageType > InputImagePtrType
shared pointer to input image type associated to operation
Definition: InputImageTile3dCollSplit.h:48
structure used to store tile 3d coordinates
Definition: ImageTileCollSplitTypes.h:65
bool checkProcessorType(const processor::BaseProcessor &processor)
check processor type in derived class
Definition: InputImageTile3dCollSplit.h:148
ipInt64 _startOffsetX
tile x start offset
Definition: ImageTileCollSplitTypes.h:68
Concrete class for image tile 3d collection split operations for data dispatch using predefined coord...
Definition: InputImageTile3dCollSplit.h:31
TAttribute AttributeType
attribute type associated to object
Definition: InputImageTile3dCollSplit.h:39
BaseClassType::InputImageType InputImageType
input image type associated to operation
Definition: InputImageTile3dCollSplit.h:45
BoolResult processAttribute(processor::BaseProcessor &processor, const Tile3dColl &tile3dColl)
initialize processor attribute associate to split operation for a given tile 3d collection ...
Definition: InputImageTile3dCollSplit.h:172
image::Border3dPolicy _border3dPolicy
border policy used to generate tile parts outside from image
Definition: InputImageTile3dCollSplit.h:111
Definition: NumericLimits.h:27
std::vector< Tile3dCoords > Tile3dCoordsColl
collection of tile 3d coordinates
Definition: ImageTileCollSplitTypes.h:87
boost::shared_ptr< OutputTileType > Tile3dPtr
shared pointer to tile
Definition: BaseImageTile3dCollSplit.h:75
Base class for processor class.
Definition: BaseProcessor.h:43
structure allowing to check whether a given attribute exists in attribute collection information ...
Definition: AttributeCollInfoCheckMacros.h:131
void init(const boost::shared_ptr< InputImageType > &pImage, const image::Border3dPolicy &border3dPolicy, const Tile3dCoordsColl &tile3dCoordsColl, const ipUInt64 nbMinEltsPerSplit=1, const ipUInt64 nbMaxEltsPerSplit=NumericLimits< ipUInt32 >::max())
object initialization method
Definition: InputImageTile3dCollSplit.h:133
const std::string & getAttributeToolTip() const
retrieve attribute tooltip associated to split operation
Definition: InputImageTile3dCollSplit.h:126
ipInt64 _startOffsetZ
tile z start offset
Definition: ImageTileCollSplitTypes.h:74
ipUInt64 _sizeY
tile y size
Definition: ImageTileCollSplitTypes.h:80
OutputTileType::ImageType InputImageType
input image type associated to operation
Definition: BaseImageTile3dCollSplit.h:38
BaseClassType::Tile3dPtr Tile3dPtr
shared pointer to tile
Definition: InputImageTile3dCollSplit.h:54
ipInt64 _startOffsetY
tile y start offset
Definition: ImageTileCollSplitTypes.h:71
TAttribute::TileType OutputTileType
output tile type associated to operation
Definition: InputImageTile3dCollSplit.h:51
Class used to define policy for 3d strip borders management during a kernel algorithm processing...
Definition: Border3dPolicy.h:34
std::vector< Tile3dPtr > Tile3dColl
tile 3d collection created by splitting operation
Definition: BaseImageTile3dCollSplit.h:78
BaseImageTile3dCollSplit< typename TAttribute::TileType > BaseClassType
base class type
Definition: InputImageTile3dCollSplit.h:42
ipUInt64 _sizeZ
tile z size
Definition: ImageTileCollSplitTypes.h:83
Tile3dPtr extractTile3d(const Tile3dCoords &curTile3dCoords)
method allowing to create a new tile given its coordinates
Definition: InputImageTile3dCollSplit.h:159
ipUInt64 _sizeX
tile x size
Definition: ImageTileCollSplitTypes.h:77
static void extractInputTile3d(const ipUInt64 cPlanIdx, const ipUInt64 tPlanIdx, const ipInt64 tileStartOffsetX, const ipInt64 tileStartOffsetY, const ipInt64 tileStartOffsetZ, const ipUInt64 tileSizeX, const ipUInt64 tileSizeY, const ipUInt64 tileSizeZ, const BaseImage &inputImage, const Border3dPolicy &border3dPolicy, InputImageTile3d &imageTile3d)
extraction of an input image 3d tile from an image
const std::string & getAttributeName() const
retrieve attribute name associated to split operation
Definition: InputImageTile3dCollSplit.h:119
TProcessor ProcessorType
processor type associated to object
Definition: InputImageTile3dCollSplit.h:36