Remove empty dimensions from DataContainer array
Changes
- When passed a
numpy.ndarrayAcquisitionDataandImageDatanow remove dimensions of 1 from the numpy meta data before passing toDataContainer. This matchesAcquisitionGeometryandImageGeometry -
ImageDataandAcquisitionDatacompare squeezed array shape with geometry, which does not report 1's in shape. -
DataContainer.(fill)removes shape check fornumpy.ndarrayand relies on numpy raiseing the error. Note:np.copytodoes not care about singleton dimensions. - FBP unittests updated to test reconstruction of a single slice (where bug was initially reported)
- Added unittests on
ImageDataandAcquisitionDatafor initialisation and filling.
Testing you performed
Please add any demo scripts to https://github.com/TomographicImaging/CIL-Demos/tree/main/misc
Tested on example code in issue.
Related issues/links
closes #1884
Checklist
- [x] I have performed a self-review of my code
- [x] I have added docstrings in line with the guidance in the developer guide
- [x] I have updated the relevant documentation
- [x] I have implemented unit tests that cover any new or modified functionality
- [x] CHANGELOG.md has been updated with any functionality change
- [x] Request review from all relevant developers
- [x] Change pull request label to 'Waiting for review'
Contribution Notes
Please read and adhere to the developer guide and local patterns and conventions.
- [x] The content of this Pull Request (the Contribution) is intentionally submitted for inclusion in CIL (the Work) under the terms and conditions of the Apache-2.0 License
- [x] I confirm that the contribution does not violate any intellectual property rights of third parties
@DanicaSTFC have you had a chance to test this?
I cannot, currently, run a test on reconstructing a horizontal slice. Did you test this yourself?
What do you mean by a horizontal slice? Can you paste your acquisition and image geometries.
Hi Gemma, I can't think of any places where this would cause problems in Processors. There are some places where we add empty dimensions to the array for the processing then remove them but I guess that won't be impacted by this because you're only squeezing the AcquisitionData when it's created?