Re: [ITK-users] Can I alter the way SliceBySliceImageFilter defines the origin of the internal slices?
Matt McCormick <[email protected]>
| Newsgroups | gmane.comp.lib.itk.user |
|---|---|
| Message-ID | <CALzTN-S+KHBiEtZ1N=HH3JgRuPq3y5EBpfaNfD-006x4qUWs7Q@mail.gmail.com> |
Hi Fredrik, The Origin set by SlicerBySlicerImageFilter ensures that the slice keeps its position in physical space. An alternative approach to the issue encountered is to inherit from BinaryFunctorImageFilter or SlicerBySliceImageFilter and override VerifyInputInformation so it does not check the Origin. HTH, Matt On Fri, Sep 8, 2017 at 9:31 AM, hellman <[email protected]> wrote: > 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/ > _____________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Kitware offers ITK Training Courses, for more information visit: > http://www.kitware.com/products/protraining.php > > Please keep messages on-topic and check the ITK FAQ at: > http://www.itk.org/Wiki/ITK_FAQ > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/insight-users _____________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users