[ITK] PipelineMonitorImageFilter

David Froger david.froger.ml at mailoo.org
Thu Jan 15 03:07:47 EST 2015


Hello Bradley,

Thanks, that's now much clearer for me!

Quoting Bradley Lowekamp (2015-01-14 14:11:07)
> Hello David,
> 
> Thanks for looking into this.
> 
> The PipelineMonitorImageFilter always runs InPlace, that is it is derived from the InPlaceImageFilter[1] and InPlace ivar is always true. Running a filter InPlace is a great way to reduce memory usage, and frequently improve performance of a filter.
> 
> What running InPlace means for a filter is that the buffer of the input image is reused on the output image, and removed from the input image. So your ImageIterator points to an image which was the input of the PipelineMonitorFilter, and not it has to image buffer.
> 
> Brad
> 
> [1] http://www.itk.org/Doxygen/html/classitk_1_1InPlaceImageFilter.html
> 
> On Jan 14, 2015, at 3:27 AM, David Froger <david.froger.ml at mailoo.org> wrote:
> 
> > Hi,
> > 
> > I'm trying to use PipelineMonitorImageFilter to monitor the regions of an
> > image written to a file with streaming.
> > 
> > I've modified the file itkHDF5ImageIOStreamingReadWriteTest.cxx like this
> > (attached):
> > 
> > diff --git a/Modules/IO/HDF5/test/itkHDF5ImageIOStreamingReadWriteTest.cxx
> > b/Modules/IO/HDF5/test/itkHDF5ImageIOStreamingReadWriteTest.cxx
> > index b1f26b8..ab9072e 100644
> > --- a/Modules/IO/HDF5/test/itkHDF5ImageIOStreamingReadWriteTest.cxx
> > +++ b/Modules/IO/HDF5/test/itkHDF5ImageIOStreamingReadWriteTest.cxx
> > @@ -54,8 +54,13 @@ int HDF5ReadWriteTest2(const char *fileName)
> >     }
> >   typedef typename itk::ImageFileWriter<ImageType> WriterType;
> >   typename WriterType::Pointer writer = WriterType::New();
> > +
> > +  typedef typename itk::PipelineMonitorImageFilter<ImageType> MonitorFilter;
> > +  typename MonitorFilter::Pointer writerMonitor = MonitorFilter::New();
> > +  writerMonitor->SetInput(im);
> > +
> >   writer->SetFileName(fileName);
> > -  writer->SetInput(im);
> > +  writer->SetInput(writerMonitor->GetOutput());
> >   writer->SetNumberOfStreamDivisions(5);
> >   try
> >     {
> > @@ -76,7 +81,6 @@ int HDF5ReadWriteTest2(const char *fileName)
> >   reader->SetFileName(fileName);
> >   reader->SetUseStreaming(true);
> > 
> > -  typedef typename itk::PipelineMonitorImageFilter<ImageType> MonitorFilter;
> >   typename MonitorFilter::Pointer monitor = MonitorFilter::New();
> >   monitor->SetInput(reader->GetOutput());
> > 
> > This change causes an "Exception: Numerical" later (line 106), when trying to
> > use "it" to iterate on "im".
> > 
> > I don't understand what's happening and what I did wrong.  Is "im" deallocated by
> > "writerMonitor"?
> > 
> > Thanks,
> > David
> > <itkHDF5ImageIOStreamingReadWriteTest.cxx>_______________________________________________
> > Community mailing list
> > Community at itk.org
> > http://public.kitware.com/mailman/listinfo/community
> 


More information about the Community mailing list