Skip to content
Snippets Groups Projects
Commit 6880d809 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

ENH: minor fix in tile streaming

parent 53081125
No related branches found
No related tags found
No related merge requests found
...@@ -35,9 +35,9 @@ namespace otb ...@@ -35,9 +35,9 @@ namespace otb
* *
* This region splitter tries to adapt to the tiling scheme of the * This region splitter tries to adapt to the tiling scheme of the
* input image using the TileHint parameter. It aims at * input image using the TileHint parameter. It aims at
* synchronizing the streaming with the tiling scheme so as to avoid * synchronizing the streaming with the tiling scheme (in a JPEG
* reading the same tile multiple times in the standard pixel-based * 2000 situation for example) so as to avoid reading the same tile
* processing scheme. * multiple times in the standard pixel-based processing scheme.
* *
* If the requested number of splits is lower than the number of * If the requested number of splits is lower than the number of
* tiles in the image region, then the splitter will derive splits * tiles in the image region, then the splitter will derive splits
...@@ -48,7 +48,7 @@ namespace otb ...@@ -48,7 +48,7 @@ namespace otb
* changing to a new tile, ensuring the former tile will be only * changing to a new tile, ensuring the former tile will be only
* read once. * read once.
* *
* If the TileHing is empty, or is VImageDimension is not 2, the * If the TileHint is empty, or is VImageDimension is not 2, the
* splitter falls back to the behaviour of * splitter falls back to the behaviour of
* otb::ImageRegionSquareTileSplitter. * otb::ImageRegionSquareTileSplitter.
* *
...@@ -63,7 +63,7 @@ class ITK_EXPORT ImageRegionAdaptativeSplitter : public itk::ImageRegionSplitter ...@@ -63,7 +63,7 @@ class ITK_EXPORT ImageRegionAdaptativeSplitter : public itk::ImageRegionSplitter
{ {
public: public:
/** Standard class typedefs. */ /** Standard class typedefs. */
typedef ImageRegionAdaptativeSplitter Self; typedef ImageRegionAdaptativeSplitter Self;
typedef itk::ImageRegionSplitter<VImageDimension> Superclass; typedef itk::ImageRegionSplitter<VImageDimension> Superclass;
typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer; typedef itk::SmartPointer<const Self> ConstPointer;
...@@ -82,7 +82,7 @@ public: ...@@ -82,7 +82,7 @@ public:
{ {
return VImageDimension; return VImageDimension;
} }
/** Index typedef support. An index is used to access pixel values. */ /** Index typedef support. An index is used to access pixel values. */
typedef itk::Index<VImageDimension> IndexType; typedef itk::Index<VImageDimension> IndexType;
typedef typename IndexType::IndexValueType IndexValueType; typedef typename IndexType::IndexValueType IndexValueType;
...@@ -101,7 +101,7 @@ public: ...@@ -101,7 +101,7 @@ public:
/** Get the TileHint parameter */ /** Get the TileHint parameter */
itkGetConstReferenceMacro(TileHint, SizeType); itkGetConstReferenceMacro(TileHint, SizeType);
/** Set the ImageRegion parameter */ /** Set the ImageRegion parameter */
itkSetMacro(ImageRegion, RegionType); itkSetMacro(ImageRegion, RegionType);
......
...@@ -99,7 +99,7 @@ ImageRegionAdaptativeSplitter<VImageDimension> ...@@ -99,7 +99,7 @@ ImageRegionAdaptativeSplitter<VImageDimension>
m_IsUpToDate = true; m_IsUpToDate = true;
return; return;
} }
// Now we can handle the case where we have a tile hint and a // Now we can handle the case where we have a tile hint and a
// non-trivial requested number of splits // non-trivial requested number of splits
SizeType tilesPerDim, splitsPerDim; SizeType tilesPerDim, splitsPerDim;
...@@ -115,7 +115,7 @@ ImageRegionAdaptativeSplitter<VImageDimension> ...@@ -115,7 +115,7 @@ ImageRegionAdaptativeSplitter<VImageDimension>
// Try to group splits // Try to group splits
SizeType groupTiles; SizeType groupTiles;
groupTiles.Fill(1); groupTiles.Fill(1);
unsigned int i=0; unsigned int i=0;
// TODO: this should not fall in infinite loop, but add more // TODO: this should not fall in infinite loop, but add more
...@@ -170,7 +170,7 @@ ImageRegionAdaptativeSplitter<VImageDimension> ...@@ -170,7 +170,7 @@ ImageRegionAdaptativeSplitter<VImageDimension>
{ {
SizeType divideTiles; SizeType divideTiles;
divideTiles.Fill(1); divideTiles.Fill(1);
unsigned int i = 1; unsigned int i = 1;
while(totalTiles * (divideTiles[0] * divideTiles[1]) < m_RequestedNumberOfSplits) while(totalTiles * (divideTiles[0] * divideTiles[1]) < m_RequestedNumberOfSplits)
...@@ -199,15 +199,15 @@ ImageRegionAdaptativeSplitter<VImageDimension> ...@@ -199,15 +199,15 @@ ImageRegionAdaptativeSplitter<VImageDimension>
// Build the split // Build the split
RegionType newSplit; RegionType newSplit;
IndexType newSplitIndex; IndexType newSplitIndex;
newSplitIndex[0] = tilex * m_TileHint[0] + divx * splitSize[0]; newSplitIndex[0] = tilex * m_TileHint[0] + divx * splitSize[0];
newSplitIndex[1] = tiley * m_TileHint[1] + divy * splitSize[1]; newSplitIndex[1] = tiley * m_TileHint[1] + divy * splitSize[1];
newSplit.SetIndex(newSplitIndex); newSplit.SetIndex(newSplitIndex);
newSplit.SetSize(splitSize); newSplit.SetSize(splitSize);
newSplit.Crop(m_ImageRegion); newSplit.Crop(m_ImageRegion);
m_StreamVector.push_back(newSplit); m_StreamVector.push_back(newSplit);
} }
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information. PURPOSE. See the above copyright notices for more information.
=========================================================================*/ =========================================================================*/
#ifndef __otbRAMDrivenAdaptativeStreamingManager_txx #ifndef __otbRAMDrivenAdaptativeStreamingManager_txx
#define __otbRAMDrivenAdaptativeStreamingManager_txx #define __otbRAMDrivenAdaptativeStreamingManager_txx
...@@ -60,12 +60,13 @@ RAMDrivenAdaptativeStreamingManager<TImage>::PrepareStreaming( itk::DataObject * ...@@ -60,12 +60,13 @@ RAMDrivenAdaptativeStreamingManager<TImage>::PrepareStreaming( itk::DataObject *
tileHint[0] = tileHintX; tileHint[0] = tileHintX;
tileHint[1] = tileHintY; tileHint[1] = tileHintY;
typename otb::ImageRegionAdaptativeSplitter<itkGetStaticConstMacro(ImageDimension)>::Pointer splitter = otb::ImageRegionAdaptativeSplitter<itkGetStaticConstMacro(ImageDimension)>::New(); typename otb::ImageRegionAdaptativeSplitter<itkGetStaticConstMacro(ImageDimension)>::Pointer splitter =
otb::ImageRegionAdaptativeSplitter<itkGetStaticConstMacro(ImageDimension)>::New();
splitter->SetTileHint(tileHint); splitter->SetTileHint(tileHint);
this->m_Splitter = splitter; this->m_Splitter = splitter;
this->m_ComputedNumberOfSplits = this->m_Splitter->GetNumberOfSplits(region, nbDivisions); this->m_ComputedNumberOfSplits = this->m_Splitter->GetNumberOfSplits(region, nbDivisions);
otbMsgDevMacro(<< "Number of split : " << this->m_ComputedNumberOfSplits) otbMsgDevMacro(<< "Number of split : " << this->m_ComputedNumberOfSplits)
this->m_Region = region; this->m_Region = region;
...@@ -74,4 +75,3 @@ RAMDrivenAdaptativeStreamingManager<TImage>::PrepareStreaming( itk::DataObject * ...@@ -74,4 +75,3 @@ RAMDrivenAdaptativeStreamingManager<TImage>::PrepareStreaming( itk::DataObject *
} // End namespace otb } // End namespace otb
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment