[ITK-users] Can I alter the way SliceBySliceImageFilter defines the origin of the internal slices?

hellman fredrik.hellman at gmail.com
Fri Sep 8 09:31:31 EDT 2017


Hi,

I am using the SliceBySliceImageFilter (to slice against the last dimension)
on a 3D image with the following meta data and region settings:

orign = [0, 0, 0]
direction = identity
spacing = [0.3, 0.3, 1]

all regions: index = [5, 5, 0] and size = [770, 710, 200]

The internal 2D images that are produced after slicing (let's call such an
image A) have the following meta data

orign = [1.5, 1.5]
direction = identity
spacing = [0.3, 0.3]

regions: index = [5, 5] and size = [770, 710]

The filter thus **redefines the origin** but keeps the index for the
internal images. This is a problem for me since the filter that I tell
SliceBySliceImageFilter to apply to the slices is a BinaryFunctorImageFilter
where the second input has been set to an image (let's call it B) with
meta-data:

orign = [0, 0]
direction = identity
spacing = [0.3, 0.3]

regions: index = [5, 5] and size = [770, 710].

I would like the the images A and B to have the same physical extent after
slicing. The BinaryFunctorImageFilter is an ImageToImageFilter where the
physical extent of the two images are verified to be the same by comparing
Origin, Direction, and Spacing (in function
ImageToImageFilter::VerifyInputInformation()). In my case, A and B do not
have matching origins (since SliceBySliceImageFilter redefined it), and thus
this verification fails.

Now, if SliceBySliceImageFilter would set the new origin to the projection
of the 3D origin onto the new 2D plane passing through the 3D origin, I
believe this would have worked. Can I make it not to have this default
behavior?

It does not appear like that from the code. The relevant code is on line 216
in SliceBySliceImageFilter.hxx for ITK 4.12.0:



Then, inputOrigin (except for the its last component in my case) is set as
the origin of the new internal inputs. I would like something like:



Perhaps there is a better way to do what I want to do? I am happy to hear
any thoughts on this.

Best regards,
Fredrik Hellman



--
Sent from: http://itk-users.7.n7.nabble.com/


More information about the Insight-users mailing list