SyneRBI / SIRF

Main repository for the CCP SynerBI software
http://www.ccpsynerbi.ac.uk
Other
60 stars 29 forks source link

NiftiImageDataDisplacement superimposes grid with non-isotropic resolution #325

Closed johannesmayer closed 5 years ago

johannesmayer commented 5 years ago

@rijobro I encountered a strange problem when using the constructor NiftiImageData3DDisplacement(const inputType * const data, const VoxelisedGeometricalInfo3D &geom) in combination with a non-isotropic grid spacing.

I amended a screenshot of what happens. Displayed is the z-component of a displacementfield(DVF) for respiration [all 3 directions show the same behavior though].

The only difference between the two images is the following: in the VoxelisedGeometricalInfo3D object passed to the constructor in the left case the member VoxelisedGeometricalInfo3D::spacing was set to [3.2, 3.2, 1.92] (which is the actual spacing of the DVFs underlying geometry) and in the right to [3.2, 3.2, 3.2] (as a check if this parameter is what screws up my DVFs). The right image is what the data actually looks like. However, when giving it non-isotropic resolution somehow the constructor superimposes a grid over the motion field [as indicated by the line profile]. Of course this does not yield realistic motion when applied to a matching anatomy.

Unbenannt
rijobro commented 5 years ago

Sorry, let me just see if I've understood correctly:

Are you saying that you want to use the left-hand parameters (i.e., [3.2, 3.2, 1.92]), but this gives unexpected results (e.g., the jumpy line profile)?

...giving it non-isotropic resolution somehow the constructor superimposes a grid over the motion field...

Sorry, but you've lost me with this bit.

johannesmayer commented 5 years ago

Yes that is indeed what I try to do. I would like to generate a NiftiImageData3D<float> and corresponding NiftiImageData3DDisplacement<float>. Then I want to apply the DVF to the image. The image needs the spacings [3.2, 3.2, 1.92]. But somehow the DVFs generated a very strange motion tearing the image apart.

So I compared the input data to the data held by the nifti objects after construction. The data held by the objects was assessed by writing them to nii and then looking at them using a viewer.

Using the constructor with the input data passed as a float * and a VoxelizedGeometricalInfo3D the data in the NiftiImageData3DDisplacement<float> objects is corrupted [i.e. there are thos jags in the line profile, left image] for the case where VoxelizedGeometricalInfo3D contains a non-isotropic spacing. If VoxelizedGeometricalInfo3D contains isotropic spacing then the data contained in the object is the same as the input [right image].

johannesmayer commented 5 years ago

whoops, I blundered somewhere else.

rijobro commented 5 years ago

Apologies i hadn't got back to you yet, but glad you figured it out!