[ITK] write BufferedRegion to file
David Froger
david.froger.ml at mailoo.org
Tue May 6 04:43:08 EDT 2014
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: extract.cxx
Type: text/x-c
Size: 1839 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/community/attachments/20140506/edcbb1e9/attachment-0002.bin>
More information about the Community
mailing list