Hi Richard,
sorry for the late reply, but I only really get to work on SIRF in the evenings.
I compared the two files and the only difference I found was:
NiftiImageData3D(GadgetronImageData) [resample does not work]
pixdim[0]: 1
iname_offset: 348
NiftImageData3D load from file [resample does work]
pixdim[0]: 0
iname_offset: 352
Does this make sense to you?
I have also attached the output of print_info(). The first column is NiftiImageData3D(GadgetronImageData) and the second column is NiftImageData3D load from file
Regards,
Christoph
--
Christoph Kolbitsch, Ph.D.
Head of Research Group
Quantitative MRI
Physikalisch-Technische Bundesanstalt
Abbestr. 2-12
10587 Berlin, Germany
phone: +49 30 3481 7761
Von: "Brown, Richard" <[log in to unmask]>
An: "Brown, Richard" <[log in to unmask]>, "[log in to unmask]" <[log in to unmask]>
Kopie: "CCP-PETMR Developers list" <[log in to unmask]>
Datum: 17.02.2020 09:12
Betreff: RE: Resampling of GadgetronImageData
Just re-read the 3 examples you gave. Try something like:
im_nii = NiftiImageData3D(GadgetronImage)
im_nii.write(filename)
im_nii2 = NiftiImageData3D(filename)
NiftiImageData::print_info([im_nii, im_nii2])
And compare output.
Sent from my phone. Excuse any mistakes/brevity.
-------- Original message --------
From: "Brown, Richard" <[log in to unmask]>
Date: 17/02/2020 08:07 (GMT+00:00)
To: [log in to unmask], "Brown, Richard" <[log in to unmask]>
Cc: CCP-PETMR Developers list <[log in to unmask]>
Subject: RE: Resampling of GadgetronImageData
Hi Christoph,
Good thinking, that could be the reason that it worked for you during the hackathon when you saved to file first.
There is a method to the effect of "NiftiImageData::print_info([im1, im2])" that will display all the Nifti metadata.
Could you compare the image that results in a single bright voxel with the closest working example to it? I.e., does it work if you save to file first?
Another thing to look at (that I hope won't work) is creating a new resampler for the adjoint. Is there an error in the code that means it'll only work when the adjoint is called before the forward? Again, i doubt it, but it would be good to confirm.
I'll be online in a little bit to help. Feel free to send any dodgy files across and I can play around.
Cheers,
Richard
Sent from my phone. Excuse any mistakes/brevity.
-------- Original message --------
From: [log in to unmask]
Date: 17/02/2020 07:54 (GMT+00:00)
To: "Brown, Richard" <[log in to unmask]>
Cc: CCP-PETMR Developers list <[log in to unmask]>
Subject: Resampling of GadgetronImageData
Good morning Richard,
I tried to apply my non-rigid transformation (NiftyResample()) directly on the Gadgetron image data which I get from the MR image reconstruction (FullySampledReconstructor()).
When I call the forward method, everything works (if I split the data into its real and imaginary part first, as we discussed on Friday) and the transformed image is also in the same orientation as the original GadgetronImage. So that is perfect.
When I call the adjoint method, then I get this weird behaviour where I have only one bright voxel in the centre of my image.
I made sure that the orientation and offcentre of the motion fields and image are the same (otherwise forward would also not work).
I tried a few things:
transf = NiftyResample()
1) transf.adjoint(GadgetronImage) -> does not work -> one bright voxel
2) transf.adjoint(NiftiImageData3D(GadgetronImage)) -> does not work -> one bright voxel
3) im_nii = NiftiImageData3D(GadgetronImage)
im_nii.write(filename)
im_nii = NiftiImageData3D(filename)
transf.adjoine(im_nii) -> WORKS
This suggests to me that the adjoint uses a parameter which only gets set properly (ie to some reasonable default value) during the write/load part of creating a NiftiImage but is not set properly when converting a GadgetronImage to NiftiImage.
Do you have any ideas where I could start looking?
Regards,
Christoph
Christoph Kolbitsch, Ph.D.
Head of Research Group
Quantitative MRI
Physikalisch-Technische Bundesanstalt
Abbestr. 2-12
10587 Berlin, Germany
phone: +49 30 3481 7761
<im_conv_cs_im_nii.docx>