SIRF icon indicating copy to clipboard operation
SIRF copied to clipboard

Resampling dvfs removes vector information

Open AnderBiguri opened this issue 3 years ago • 0 comments

Context:

I have some image img=sirf.stir.ImageData() and some dvf dvf=stir.Reg.NiftiImageData3DDisplacement()

I want to know the value of dvf at a particular img location [x,y,z]. something like img[z,y,x] dvf[x,y,z,0,:].

As these are not directly indexable, I will need to probably need to do as_array() and index that, however, they are not in the same space, so I need to register them first, so integer indices represent the same location.

if I do

    resampler = reg.NiftyResample()
    resampler.set_padding_value(0)
    resampler.set_interpolation_type_to_linear()
    resampler.set_reference_image(img)

    resampler.set_floating_image(dvf)
    resampler.process()
    dvf_out=resampler.get_output()
    print len(dvf_out.as_array().shape)

it returns 3, i.e. dvf_out now only has 3 indexes. I lost vector info.

I clearly am interested in an alternative solution, but in any case, I think one would expect that while the x,y,z of the dvf is now the same as for img, the vector information to still remain. Similarly, I wonder what shoudl happen with axis order, given that the dvf has a different order than img.

AnderBiguri avatar Dec 13 '20 13:12 AnderBiguri