[ITK] write BufferedRegion to file

David Froger david.froger.ml at mailoo.org
Wed May 7 05:15:16 EDT 2014


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



More information about the Community mailing list