IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
ImageTile2dCollSplit.h
1 // ImageTile2dCollSplit.h:
3 // -----------------------
4 //
15 
16 #ifndef __IPSDKIMAGEPROCESSING_IMAGETILE2DCOLLSPLIT_H__
17 #define __IPSDKIMAGEPROCESSING_IMAGETILE2DCOLLSPLIT_H__
18 
19 #include <IPSDKImageProcessing/DataSplit/TileColl/BaseImageTile2dCollSplit.h>
20 #include <IPSDKImage/Fragment/Extractor/ImageTileExtractor.h>
21 
22 namespace ipsdk {
23 namespace imaproc {
24 
27 
28 template <typename TProcessor, typename TAttribute>
29 class ImageTile2dCollSplit : public BaseImageTile2dCollSplit<typename TAttribute::TileType>
30 {
31 // predefined public types
32 public:
34  typedef TProcessor ProcessorType;
35 
37  typedef TAttribute AttributeType;
38 
41 
44 
46  typedef boost::shared_ptr<InputImageType> InputImagePtrType;
47 
49  typedef typename TAttribute::TileType OutputTileType;
50 
53 
56 
57 public:
63 
64 // methods
65 public:
67  const std::string& getAttributeName() const;
68 
70  const std::string& getAttributeToolTip() const;
71 
87  void init(const boost::shared_ptr<InputImageType>& pImage,
88  const Tile2dCoordsColl& tile2dCoordsColl,
89  const ipUInt32 nbMinEltsPerSplit = 1,
90  const ipUInt32 nbMaxEltsPerSplit = NumericLimits<ipUInt32>::max());
91 
92 protected:
94  bool checkProcessorType(const processor::BaseProcessor& processor);
95 
97  Tile2dPtr extractTile2d(const Tile2dCoords& curTile2dCoords);
98 
103  const Tile2dColl& tile2dColl);
104 
105 // attributes
106 protected:
107 
108 };
109 
112 
113 template <typename TProcessor, typename TAttribute>
114 inline const std::string&
116 {
117  return TAttribute::getObjectNameStr();
118 }
119 
120 template <typename TProcessor, typename TAttribute>
121 inline const std::string&
123 {
124  return TAttribute::getToolTipStr();
125 }
126 
127 template <typename TProcessor, typename TAttribute>
128 inline void
129 ImageTile2dCollSplit<TProcessor, TAttribute>::init(const boost::shared_ptr<InputImageType>& pImage,
130  const Tile2dCoordsColl& tile2dCoordsColl,
131  const ipUInt32 nbMinEltsPerSplit,
132  const ipUInt32 nbMaxEltsPerSplit)
133 {
134  // call of base class initialization method
135  return this->initBase(pImage, tile2dCoordsColl, nbMinEltsPerSplit, nbMaxEltsPerSplit);
136 }
137 
138 template <typename TProcessor, typename TAttribute>
139 inline bool
141 {
142  // check for consistency between processor and attribute
144  "This attribute is not part of processor class");
145 
146  return dynamic_cast<const TProcessor*>(&processor) != 0;
147 }
148 
149 template <typename TProcessor, typename TAttribute>
152 {
153  boost::shared_ptr<OutputTileType> pCurTile(boost::make_shared<OutputTileType>());
155  static_cast<ipUInt32>(curTile2dCoords._startOffsetX),
156  static_cast<ipUInt32>(curTile2dCoords._startOffsetY),
157  curTile2dCoords._sizeX, curTile2dCoords._sizeY,
158  *(this->getImagePtr()), *pCurTile);
159 
160  return pCurTile;
161 }
162 
163 template <typename TProcessor, typename TAttribute>
164 inline BoolResult
166  const Tile2dColl& tile2dColl)
167 {
168  // cast of input processor object
169  TProcessor& tProcessor = static_cast<TProcessor&>(processor);
170 
171  // update of processor attribute value
172  tProcessor.TProcessor::template set<TAttribute>(tile2dColl);
173 
174  return true;
175 }
176 
179 
180 } // end of namespace imaproc
181 } // end of namespace ipsdk
182 
183 #endif // __IPSDKIMAGEPROCESSING_IMAGETILE2DCOLLSPLIT_H__
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
void init(const boost::shared_ptr< InputImageType > &pImage, const Tile2dCoordsColl &tile2dCoordsColl, const ipUInt32 nbMinEltsPerSplit=1, const ipUInt32 nbMaxEltsPerSplit=NumericLimits< ipUInt32 >::max())
object initialization method
Definition: ImageTile2dCollSplit.h:129
TAttribute AttributeType
attribute type associated to object
Definition: ImageTile2dCollSplit.h:37
boost::shared_ptr< OutputTileType > Tile2dPtr
shared pointer to tile
Definition: BaseImageTile2dCollSplit.h:75
TProcessor ProcessorType
processor type associated to object
Definition: ImageTile2dCollSplit.h:34
Tile2dPtr extractTile2d(const Tile2dCoords &curTile2dCoords)
method allowing to create a new tile given its coordinates
Definition: ImageTile2dCollSplit.h:151
const std::string & getAttributeToolTip() const
retrieve attribute tooltip associated to split operation
Definition: ImageTile2dCollSplit.h:122
ipUInt64 _sizeY
tile y size
Definition: ImageTileCollSplitTypes.h:58
const std::string & getAttributeName() const
retrieve attribute name associated to split operation
Definition: ImageTile2dCollSplit.h:115
ipInt64 _startOffsetY
tile y start offset
Definition: ImageTileCollSplitTypes.h:52
Definition: NumericLimits.h:27
ipInt64 _startOffsetX
tile x start offset
Definition: ImageTileCollSplitTypes.h:49
Base class for processor class.
Definition: BaseProcessor.h:43
BaseClassType::Tile2dPtr Tile2dPtr
shared pointer to tile
Definition: ImageTile2dCollSplit.h:52
structure allowing to check whether a given attribute exists in attribute collection information ...
Definition: AttributeCollInfoCheckMacros.h:131
TAttribute::TileType OutputTileType
output tile type associated to operation
Definition: ImageTile2dCollSplit.h:49
std::vector< Tile2dPtr > Tile2dColl
tile 2d collection created by splitting operation
Definition: BaseImageTile2dCollSplit.h:78
std::vector< Tile2dCoords > Tile2dCoordsColl
collection of tile 2d coordinates
Definition: ImageTileCollSplitTypes.h:62
BaseClassType::InputImageType InputImageType
input image type associated to operation
Definition: ImageTile2dCollSplit.h:43
BaseClassType::Tile2dColl Tile2dColl
tile 2d collection created by splitting operation
Definition: ImageTile2dCollSplit.h:55
bool checkProcessorType(const processor::BaseProcessor &processor)
check processor type in derived class
Definition: ImageTile2dCollSplit.h:140
BaseImageTile2dCollSplit< typename TAttribute::TileType > BaseClassType
base class type
Definition: ImageTile2dCollSplit.h:40
BoolResult processAttribute(processor::BaseProcessor &processor, const Tile2dColl &tile2dColl)
initialize processor attribute associate to split operation for a given tile 2d collection ...
Definition: ImageTile2dCollSplit.h:165
Concrete class for image tile 2d collection split operations for data dispatch using predefined coord...
Definition: ImageTile2dCollSplit.h:29
boost::shared_ptr< InputImageType > InputImagePtrType
shared pointer to input image type associated to operation
Definition: ImageTile2dCollSplit.h:46
OutputTileType::ImageType InputImageType
input image type associated to operation
Definition: BaseImageTile2dCollSplit.h:38
ipUInt64 _sizeX
tile x size
Definition: ImageTileCollSplitTypes.h:55
static void extractTile2d(const ipUInt64 zPlanIdx, const ipUInt64 cPlanIdx, const ipUInt64 tPlanIdx, const ipUInt64 tileStartOffsetX, const ipUInt64 tileStartOffsetY, const ipUInt64 tileSizeX, const ipUInt64 tileSizeY, typename FragmentType::ImageType &inputImage, FragmentType &imageTile2d)
extraction of an image 2d tile from an image
Base class for image tile 2d collection split operations for data dispatch.
Definition: BaseImageTile2dCollSplit.h:33
structure used to store tile 2d coordinates
Definition: ImageTileCollSplitTypes.h:46
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53