CIL
CIL copied to clipboard
Change in ImageGeometry behaviour causing reconstruction failures
A change in the behaviour of our ImageGeometry
class is causing issues with reconstruction geometries. Previously, the shape
and dimension_labels
including dimensions of length 1. However, this has been modified to exclude them.
https://github.com/TomographicImaging/CIL/blob/eb254e0bae77e193f05acc03b6e94cd1c189e4ab/Wrappers/Python/cil/framework/framework.py#L309-L313
This change means that reconstruction geometries now fail when reconstructing 3D data to a single slice of voxels.
Steps to Reproduce:
from cil.utilities import dataexample
from cil.recon import FDK
from cil import version
print(version.version)
#%%
data = dataexample.SIMULATED_CONE_BEAM_DATA.get()
data.log(out=data)
data *=-1
data.reorder('tigre')
image_geometry = data.geometry.get_ImageGeometry(1)
image_geometry.voxel_num_z = 1
recon = FDK(data, image_geometry).run()
Error raised on creating the new ImageData with a missmatched geometry in the return
https://github.com/TomographicImaging/CIL/blob/eb254e0bae77e193f05acc03b6e94cd1c189e4ab/Wrappers/Python/cil/framework/framework.py#L3648-L3649
File ~/miniconda3/envs/cil_24.1/lib/python3.12/site-packages/cil/framework/framework.py:3649, in ImageData.__init__(self, array, deep_copy, geometry, **kwargs)
-> [3649](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a227265636f6e564d31227d.vscode-resource.vscode-cdn.net/home/tpc56154/GitHub/CIL/~/miniconda3/envs/cil_24.1/lib/python3.12/site-packages/cil/framework/framework.py:3649) raise ValueError('Shape mismatch {} {}'.format(array.shape, geometry.shape))
ValueError: Shape mismatch (1, 128, 128) (128, 128)
I suppose that the check is too stringent and here we could squeeze the array before filling. Or else change it in the FBP/FDK and PO code, e.g. here: https://github.com/TomographicImaging/CIL/blob/eb254e0bae77e193f05acc03b6e94cd1c189e4ab/Wrappers/Python/cil/plugins/tigre/ProjectionOperator.py#L234