[ITK] write BufferedRegion to file

David Froger david.froger.ml at mailoo.org
Wed May 7 08:39:52 EDT 2014


I didn't noticed that I should use ExtractImageFilter to run inplace,
so I will use ExtractImageFilter!

Thanks.

Quoting Bradley Lowekamp (2014-05-07 14:34:14)
> The ExtractImageFilter has some optimization to run "InPlace" so I prefer to use it for this streaming case. There really isn't anything wrong with using the ROI Filter. I think I miss something it the prior e-mail.
> 
> Brad
> 
> On May 7, 2014, at 5:15 AM, David Froger <david.froger.ml at mailoo.org> wrote:
> 
> > Hi,
> > 
> >> You are going to need to place an ExtractImageFilter between you reader and your writer.
> > 
> > I do not need to change the number of dimension of the image, can I use 
> > RegionOfInterestImageFilter instead?
> > 
> > David
> > 
> >> 
> >> Brad
> >> 
> >> On May 6, 2014, at 4:43 AM, David Froger <david.froger.ml at mailoo.org> wrote:
> >> 
> >>> Solved.
> >>> 
> >>> The segfault was indeed a bug in my example, line:
> >>> WriterType::Pointer writer;
> >>> should be replaced:
> >>> WriterType::Pointer writer = WriterType::New();
> >>> 
> >>> The RegionOfInterestImageFilter filter work as expected (example attached).
> >>> 
> >>> Without RegionOfInterestImageFilter, it doesn't segault, but the largest
> >>> possible region is automatically read by the reader, and written by the 
> >>> writter.
> >>> 
> >>> David
> >>> 
> >>> Quoting David Froger (2014-05-06 09:09:23)
> >>>> Dear all,
> >>>> 
> >>>> I'm reading in an HDF5 file a subregion of an image, and want to create a new
> >>>> file with this subregion.
> >>>> 
> >>>> For example, the HDF5 file contains a vector image of dimensions (4,4,4,4),
> >>>> and I read (2,2,2) pixels starting from pixel (1,1,1).
> >>>> 
> >>>> If I try to write the subregion in a new file, ITK try to write the largest
> >>>> possible region, and it yields to a segfault.
> >>>> 
> >>>> I tried to use image->SetLargestPossibleRegion, image->SetRequestedRegion, 
> >>>> image->SetBufferedRegion, writer->SetIORegion, RegionOfInterestImageFilter,
> >>>> ExtractImageFilter without success.
> >>>> 
> >>>> Does someone has the solution?
> >>>> 
> >>>> Example files of what I'm trying to do are attached.
> >>>> 
> >>>> Thanks for reading.
> >>>> 
> >>>> Best regards,
> >>>> David
> >>> <extract.cxx>_______________________________________________
> >>> Community mailing list
> >>> Community at itk.org
> >>> http://public.kitware.com/cgi-bin/mailman/listinfo/community
> > _______________________________________________
> > Community mailing list
> > Community at itk.org
> > http://public.kitware.com/cgi-bin/mailman/listinfo/community



More information about the Community mailing list