Skip to content
Snippets Groups Projects
Commit 3d8ddf16 authored by Julien Michel's avatar Julien Michel
Browse files

Merge branch '1516--memory-print-image-list' into 'release-6.4'

Resolve "PipelineMemoryPrintEstimator stops at ImageList"

See merge request orfeotoolbox/otb!9

(cherry picked from commit 51bbe2d9)

0d1911c0 BUG: Track down upstream pipeline for each image in ImageList (fix #1516)
c47e4540 COMP: Fix compilation error (prototype mismatch)
3e227125 BUG: Moving PropageRequestedRegion() at the correct place in ImageList, and…
14c23e6b BUG: Only call UpdateOutputData() if object has Source
parent 62f1f7fa
No related branches found
No related tags found
No related merge requests found
......@@ -68,6 +68,8 @@ public:
throw (itk::InvalidRequestedRegionError) ITK_OVERRIDE;
void UpdateOutputData(void) ITK_OVERRIDE;
void SetRequestedRegion(const itk::DataObject * source);
protected:
/** Constructor */
ImageList() {};
......
......@@ -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
......
......@@ -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 */
......
......@@ -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; \
} \
......
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