CIL icon indicating copy to clipboard operation
CIL copied to clipboard

Remove empty dimensions from DataContainer array

Open gfardell opened this issue 6 months ago • 3 comments

Changes

  • When passed a numpy.ndarray AcquisitionData and ImageData now remove dimensions of 1 from the numpy meta data before passing to DataContainer. This matches AcquisitionGeometry and ImageGeometry
  • ImageData and AcquisitionData compare squeezed array shape with geometry, which does not report 1's in shape.
  • DataContainer.(fill) removes shape check for numpy.ndarray and relies on numpy raiseing the error. Note: np.copyto does not care about singleton dimensions.
  • FBP unittests updated to test reconstruction of a single slice (where bug was initially reported)
  • Added unittests on ImageData and AcquisitionData for 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

gfardell avatar Aug 06 '24 15:08 gfardell