[ITK] Best way to convert 4D image to 3D in-place?
Matt McCormick
matt.mccormick at kitware.com
Wed May 7 01:32:42 EDT 2014
Hi Chris,
On Tue, May 6, 2014 at 7:15 PM, Chris Cooper
<chris.cooper at veranmedical.com> wrote:
> 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?
>
With the contiguous pixel buffer memory layout, this is difficult to do.
Thanks,
Matt
More information about the Community
mailing list