[ITK] write BufferedRegion to file

David Froger david.froger.ml at mailoo.org
Tue May 6 03:09:23 EDT 2014


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 --------------
cmake_minimum_required(VERSION 2.8)

FIND_PACKAGE(ITK)

SET(CMAKE_BUILD_TYPE debug)

IF(ITK_FOUND)
    INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
    MESSAGE(FATAL_ERROR "ITK not found. Please set ITK_DIR.")
ENDIF(ITK_FOUND)

ADD_EXECUTABLE(create create.cxx)
ADD_EXECUTABLE(extract extract.cxx)

TARGET_LINK_LIBRARIES(create ${ITK_LIBRARIES})
TARGET_LINK_LIBRARIES(extract ${ITK_LIBRARIES})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: create.cxx
Type: text/x-c
Size: 1622 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/community/attachments/20140506/02f41b82/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: extract.cxx
Type: text/x-c
Size: 1592 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/community/attachments/20140506/02f41b82/attachment-0001.bin>


More information about the Community mailing list