diff --git a/Modules/Core/Streaming/include/otbStreamingManager.hxx b/Modules/Core/Streaming/include/otbStreamingManager.hxx index cabfccae2e3aab142fcc23c0949bd32b01d613f2..fe8f4270078b4ba95af5eafe23dddf7e24c60eaf 100644 --- a/Modules/Core/Streaming/include/otbStreamingManager.hxx +++ b/Modules/Core/Streaming/include/otbStreamingManager.hxx @@ -89,18 +89,25 @@ unsigned int StreamingManager::EstimateOptimalNumberOfDivisions(itk::Dat // Define a small region to run the memory footprint estimation, // around the image center, 100 pixels wide in each dimension SizeType smallSize; - smallSize.Fill(100); IndexType index; - index[0] = region.GetIndex()[0] + region.GetSize()[0] / 2 - 50; - index[1] = region.GetIndex()[1] + region.GetSize()[1] / 2 - 50; + for (int d=0; d < ImageDimension; ++d) + { + if (region.GetSize()[d] < 100) + { + index[d] = 0; + smallSize[d] = region.GetSize()[d]; + } + else + { + index[d] = region.GetIndex()[d] + region.GetSize()[d] / 2 - 50; + smallSize[d] = 100; + } + } RegionType smallRegion; smallRegion.SetSize(smallSize); smallRegion.SetIndex(index); - // In case the image is smaller than 100 pixels in a direction - smallRegion.Crop(region); - extractFilter->SetExtractionRegion(smallRegion); bool smallRegionSuccess = smallRegion.Crop(region); diff --git a/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx b/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx index 4304c7c9e7c83dd9c806e78e05ed5219dd013b7f..deb0b9e93416710beb63f5d01f248b10901c0fc6 100644 --- a/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx +++ b/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx @@ -193,6 +193,42 @@ PipelineMemoryPrintCalculator::MemoryPrintType PipelineMemoryPrintCalculator::Ev print += this->EvaluateDataObjectPrint(it.Get()); \ } \ return print; \ + } \ + if (dynamic_cast*>(data) != NULL) \ + { \ + itk::Image* image = dynamic_cast*>(data); \ + return image->GetRequestedRegion().GetNumberOfPixels() * image->GetNumberOfComponentsPerPixel() * sizeof(type); \ + } \ + if (dynamic_cast*>(data) != NULL) \ + { \ + itk::VectorImage* image = dynamic_cast*>(data); \ + return image->GetRequestedRegion().GetNumberOfPixels() * image->GetNumberOfComponentsPerPixel() * sizeof(type); \ + } \ + if (dynamic_cast>*>(data) != NULL) \ + { \ + ImageList>* imageList = dynamic_cast>*>(data); \ + MemoryPrintType print(0); \ + for (ImageList>::Iterator it = imageList->Begin(); it != imageList->End(); ++it) \ + { \ + if (it.Get()->GetSource()) \ + print += this->EvaluateProcessObjectPrintRecursive(it.Get()->GetSource()); \ + else \ + print += this->EvaluateDataObjectPrint(it.Get()); \ + } \ + return print; \ + } \ + if (dynamic_cast>*>(data) != NULL) \ + { \ + ImageList>* imageList = dynamic_cast>*>(data); \ + MemoryPrintType print(0); \ + for (ImageList>::ConstIterator it = imageList->Begin(); it != imageList->End(); ++it) \ + { \ + if (it.Get()->GetSource()) \ + print += this->EvaluateProcessObjectPrintRecursive(it.Get()->GetSource()); \ + else \ + print += this->EvaluateDataObjectPrint(it.Get()); \ + } \ + return print; \ }