SIRF icon indicating copy to clipboard operation
SIRF copied to clipboard

CoilSensitivityData.fill() sets wrong coilmaps

Open johannesmayer opened this issue 3 years ago • 2 comments

Example for, 4 active channels, 10 repetitions, and a 320 by 320 pixel slice. Then having a coilmap object csm of type sirf.Gadgetron.CoilSensitivityData yields csm.as_array().shape = (4,10,320,320)

If you have a numpy array csm_external that you want to fill into the container using where csm_external.shape = (4,10,320,320)

csm.fill( csm_external.astype(csm.as_array().dtype))

it will be filled wrong because it mixes repetition and channel dimension. You would need to fill it as

csm_external = np.swapaxes(csm_external, 0,1)
csm.fill( csm_external.astype(csm.as_array().dtype))

This is of course also the case for multiple slices instead of multiple repetitions. This is counter-intuitive as you would expect the dimensions of the as_array method to be consistent with the dimensions of the fill method

johannesmayer avatar Mar 02 '22 15:03 johannesmayer

@johannesmayer actually, numpy.swapaxes would have no effect on fill, the dimensions of csm would remain (4,10,320,320).

That the second dimension is generally a product of repetitions etc. is, of course, not nice, and we need a more sensible handling of MR images and acquisition data dimensions, but so far we have not succeeded in agreeing on what would be the proper handling. In any case, changing the current design is likely to break backward compatibility, so this is a version 4.* issue.

evgueni-ovtchinnikov avatar Jun 21 '22 14:06 evgueni-ovtchinnikov

@johannesmayer it turned out there was a bug in Gadgetron.ImageData.fill: fill(as_array) was not the identity! Check the latest SIRF master, please.

evgueni-ovtchinnikov avatar Aug 04 '22 16:08 evgueni-ovtchinnikov