diff --git a/Modules/Core/ObjectList/include/otbImageList.h b/Modules/Core/ObjectList/include/otbImageList.h index 611d84a47a18efdb93a79085fa4a764968338ddf..4cb77bddec306437bccb05b45b81bdf71c9b9610 100644 --- a/Modules/Core/ObjectList/include/otbImageList.h +++ b/Modules/Core/ObjectList/include/otbImageList.h @@ -68,6 +68,8 @@ public: throw (itk::InvalidRequestedRegionError) ITK_OVERRIDE; void UpdateOutputData(void) ITK_OVERRIDE; + void SetRequestedRegion(const itk::DataObject * source); + protected: /** Constructor */ ImageList() {}; diff --git a/Modules/Core/ObjectList/include/otbImageList.txx b/Modules/Core/ObjectList/include/otbImageList.txx index dc0cbc9b6fef35e3430891fb9cd08a7e4324aefd..426a594027aee6a61bc0d529acde1f300d71b487 100644 --- a/Modules/Core/ObjectList/include/otbImageList.txx +++ b/Modules/Core/ObjectList/include/otbImageList.txx @@ -39,10 +39,33 @@ ImageList<TImage> || it.Get()->GetDataReleased() || it.Get()->RequestedRegionIsOutsideOfTheBufferedRegion()) { + if(it.Get()->GetSource()) + { + it.Get()->GetSource()->UpdateOutputData(it.Get()); + } + } + } +} + +template <class TImage> +void +ImageList<TImage> +::PropagateRequestedRegion() throw (itk::InvalidRequestedRegionError) + { + Superclass::PropagateRequestedRegion(); + + for (ConstIterator it = this->Begin(); it != this->End(); ++it) + { + if (it.Get()->GetUpdateMTime() < it.Get()->GetPipelineMTime() + || it.Get()->GetDataReleased() + || it.Get()->RequestedRegionIsOutsideOfTheBufferedRegion()) + { + + std::cout<<"Requested region: "<<it.Get()<<" "<<it.Get()->GetRequestedRegion()<<std::endl; if (it.Get()->GetSource()) { it.Get()->GetSource()->PropagateRequestedRegion(it.Get()); - + // Check that the requested region lies within the largest possible region if (!it.Get()->VerifyRequestedRegion()) { @@ -51,23 +74,24 @@ ImageList<TImage> e.SetLocation(ITK_LOCATION); e.SetDataObject(it.Get()); e.SetDescription("Requested region is (at least partially) outside the largest possible region."); - + throw e; } - - it.Get()->GetSource()->UpdateOutputData(it.Get()); } } } -} + } -template <class TImage> +template<class TImage> void ImageList<TImage> -::PropagateRequestedRegion() throw (itk::InvalidRequestedRegionError) - { - Superclass::PropagateRequestedRegion(); - } +::SetRequestedRegion(const itk::DataObject * source) +{ + for (ConstIterator it = this->Begin(); it != this->End(); ++it) + { + it.Get()->SetRequestedRegion(source); + } +} template <class TImage> void diff --git a/Modules/Core/Streaming/include/otbPipelineMemoryPrintCalculator.h b/Modules/Core/Streaming/include/otbPipelineMemoryPrintCalculator.h index 826478711d24b2c9ab3ac7e75d4e8586354c8afb..41fe7808e9d84a0d0ae3017996e417ea0cd97c3a 100644 --- a/Modules/Core/Streaming/include/otbPipelineMemoryPrintCalculator.h +++ b/Modules/Core/Streaming/include/otbPipelineMemoryPrintCalculator.h @@ -121,7 +121,7 @@ public: static const double MegabyteToByte; /** Evaluate the print (in bytes) of a single data object */ - MemoryPrintType EvaluateDataObjectPrint(DataObjectType * data) const; + MemoryPrintType EvaluateDataObjectPrint(DataObjectType * data); protected: /** Constructor */ diff --git a/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx b/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx index 033c58bc379fed6aba092e28e346b1d58ab35b84..d7d62e8c88cd6a779425feb92d5c9eeea7a71497 100644 --- a/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx +++ b/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx @@ -162,7 +162,7 @@ PipelineMemoryPrintCalculator PipelineMemoryPrintCalculator::MemoryPrintType PipelineMemoryPrintCalculator -::EvaluateDataObjectPrint(DataObjectType * data) const +::EvaluateDataObjectPrint(DataObjectType * data) { otbMsgDevMacro(<< "EvaluateMemoryPrint for " << data->GetNameOfClass() << " (" << data << ")") @@ -183,11 +183,13 @@ PipelineMemoryPrintCalculator { \ ImageList<Image<type, 2> > * imageList = dynamic_cast<otb::ImageList<otb::Image<type, 2> > *>(data); \ MemoryPrintType print(0); \ - for(ImageList<Image<type, 2> >::ConstIterator it = imageList->Begin(); \ + for(ImageList<Image<type, 2> >::Iterator it = imageList->Begin(); \ it != imageList->End(); ++it) \ { \ - print += it.Get()->GetRequestedRegion().GetNumberOfPixels() \ - * it.Get()->GetNumberOfComponentsPerPixel() * sizeof(type); \ + if(it.Get()->GetSource()) \ + print += this->EvaluateProcessObjectPrintRecursive(it.Get()->GetSource());\ + else \ + print += this->EvaluateDataObjectPrint(it.Get()); \ } \ return print; \ } \ @@ -198,8 +200,10 @@ PipelineMemoryPrintCalculator for(ImageList<VectorImage<type, 2> >::ConstIterator it = imageList->Begin(); \ it != imageList->End(); ++it) \ { \ - print += it.Get()->GetRequestedRegion().GetNumberOfPixels() \ - * it.Get()->GetNumberOfComponentsPerPixel() * sizeof(type); \ + if(it.Get()->GetSource()) \ + print += this->EvaluateProcessObjectPrintRecursive(it.Get()->GetSource());\ + else \ + print += this->EvaluateDataObjectPrint(it.Get()); \ } \ return print; \ } \