[Insight-users] Streaming and InPlaceImageFilter
Bradley Lowekamp
blowekamp at mail.nih.gov
Mon Mar 21 10:19:43 EDT 2011
Hello Simon,
Can you please report this as a bug in the bug tracker:
http://www.vtk.org/Wiki/ITK_Procedure_for_Contributing_Bug_Fixes#Entering_a_bug
You can assign it to me also.
BTW, if you don't call "reader->Update()" I believe it would work.
Thanks,
Brad
On Mar 21, 2011, at 10:06 AM, Simon Rit wrote:
> Hi,
> I have a problem with InPlaceImageFilter when using streaming. When I
> connect the input of an InPlaceImageFilter to a filter that has been
> updated and try to write the output of this filter with
> SetNumberOfStreamDivisions set e.g. to 2, only the first half of the
> filter is updated. I have written a simple test case to reproduce this
> problem (using ITK 3.20):
>
> ////////////////////////////////////////////////////////////////////////////////////////
> #include <itkImageFileReader.h>
> #include <itkImageFileWriter.h>
> #include <itkMultiplyByConstantImageFilter.h>
>
> int main(int argc, char * argv[])
> {
> typedef double PixelType;
> const unsigned int Dimension = 3;
> typedef itk::Image< PixelType, Dimension > ImageType;
>
> typedef itk::ImageFileReader<ImageType> ReaderType;
> ReaderType::Pointer reader = ReaderType::New();
> reader->SetFileName(argv[1]);
> reader->Update();
>
> typedef itk::MultiplyByConstantImageFilter< ImageType, PixelType,
> ImageType > FilterType;
> FilterType::Pointer filter = FilterType::New();
> filter->SetInput(reader->GetOutput());
> filter->SetConstant(0.);
> filter->SetInPlace(atoi(argv[2]));
>
> typedef itk::ImageFileWriter< ImageType > WriterType;
> WriterType::Pointer writer = WriterType::New();
> writer->SetInput(filter->GetOutput());
> writer->SetFileName(argv[3]);
> writer->SetNumberOfStreamDivisions(2);
> writer->Update();
>
> return EXIT_SUCCESS;
> }
> ////////////////////////////////////////////////////////////////////////////////////////
>
> To run this testPgm, compile it, use a test image input.mha and run
> successively:
> $ testPgm input.mha 0 output0.mha
> $ testPgm input.mha 1 output1.mha
> output0.mha and output1.mha should be the same but are not: only half
> of output1.mha is set to 0 instead of the full image.
>
> I believe that the reason is the test "if (bufferedRegion ==
> largestRegion)" in itkImageFileWriter.txx. With InPlaceImageFilter,
> the region might be buffered but only the requested region has been
> updated...
> Am I missing something? Is this a (known) bug? Any easy fix?
> Obviously, I can disable the inplace capability but I believe this
> should be fixed since it concerns many filters.
> Thanks in advance for your help!
> Simon
>
> NB: I had similar problems with StreamingImageFilter but I did not
> investigate where the problem was in this case.
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
========================================================
Bradley Lowekamp
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine
blowekamp at mail.nih.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110321/cfb2dfae/attachment.htm>
More information about the Insight-users
mailing list