[ITK] Best way to convert 4D image to 3D in-place?

Chris Cooper chris.cooper at veranmedical.com
Tue May 6 19:15:28 EDT 2014


I’ve got a 4-dimensional image (itk::Image<short,4>) and I need to extract the first “slice" of that image into a 3-dimensional image (itk::Image<short,3>) .

I can do it with an ExtractImageFilter, but since my input and output images don’t match, the filter insists on allocating new memory for the new image, and that’s not going to fly.

I can do it with an ImportImageFilter by passing the buffer pointer of the 4-d image to the filter, and that works fine, but (1) it makes assumptions about the layout of the image in memory that I would rather not make, and (2) it requires me to Update() my 4-d image manually prior to continuing the filter pipeline which while not a problem, is not as “clean” as I would like.

Is there a filter that would let me extract the image I need, without making unpleasant assumptions and certainly without allocating more memory?

Thanks,
Chris



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140506/8777e86e/attachment.html>


More information about the Community mailing list