Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fae73eb
misc numpy>=2 safety
casperdcl Sep 30, 2025
3894245
bump numpy, astra-toolbox, ccpi-regulariser, tomophantom
casperdcl Sep 30, 2025
acb5ab9
dtype_like helper
casperdcl Sep 30, 2025
0d33059
fix test precision
casperdcl Oct 1, 2025
a250b43
Fix NaN usage in show_geometry function (#2246)
paskino Dec 8, 2025
af9869a
Fix ISTA initialization by disabling acceleration
paskino Mar 24, 2026
9a586f9
Pass linear acquisition model to sensitivity preconditioner in SIRF test
paskino Mar 24, 2026
2354636
Update test to more numerically stable ROI
gfardell May 1, 2026
058e8c0
Update shape attribute to return as python ints
gfardell May 1, 2026
c864db5
Fixes to unit tests
lauramurgatroyd May 28, 2026
cdfacf2
fix channel dependency hell
casperdcl May 28, 2026
dd69883
relax tigre siddon unittest
gfardell May 29, 2026
b8803af
fix to tigre wrappers to support np 2.4
gfardell Jun 2, 2026
e5b4186
array(range) -> arange
casperdcl Jun 3, 2026
d3c818c
Enhance developer guide with scalar types section (#2335)
lauramurgatroyd Jun 5, 2026
66965cd
show_geometry fix for np2.4
gfardell Jun 5, 2026
29b9e2b
use conda-forge and py package of astra-toolbox for macosx (experimen…
paskino Jun 5, 2026
79f0898
DEBUG: test regulariser pre-release
casperdcl Jun 10, 2026
6f711ed
update reference count logic
gfardell Jun 11, 2026
99eb2fb
tests for dtype_like
gfardell Jun 11, 2026
b6bd39b
Update Wrappers/Python/cil/utilities/__init__.py
lauramurgatroyd Jun 11, 2026
ac89884
Update Change Log
lauramurgatroyd Jun 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
runs-on: [self-hosted, python, cuda]
strategy:
matrix:
python-version: [3.11]
numpy-version: [1.25]
python-version: [3.12]
numpy-version: [2]
steps:
- uses: actions/checkout@v6
with: {fetch-depth: 0, submodules: recursive}
Expand Down Expand Up @@ -75,13 +75,13 @@ jobs:
- id: matrix
run: |
if ${{ startsWith(github.ref, 'refs/tags') || github.event_name == 'workflow_dispatch' }}; then
echo "python-version=['3.10', 3.11]" >> $GITHUB_OUTPUT
echo "numpy-version=[1.23, 1.24, 1.25, 1.26]" >> $GITHUB_OUTPUT
echo "python-version=[3.11, 3.12]" >> $GITHUB_OUTPUT
echo "numpy-version=[1.26, '2.0', 2.1, 2.2, 2.3, 2.4]" >> $GITHUB_OUTPUT
echo "os=['ubuntu', 'windows']" >> $GITHUB_OUTPUT
include_max=true
else
echo "python-version=['3.10']" >> $GITHUB_OUTPUT
echo "numpy-version=[1.23]" >> $GITHUB_OUTPUT
echo "numpy-version=[2]" >> $GITHUB_OUTPUT
if ${{ github.ref == 'refs/heads/master' }}; then
echo "os=['ubuntu', 'windows']" >> $GITHUB_OUTPUT
include_max=true
Expand All @@ -91,8 +91,8 @@ jobs:
fi
fi
if $include_max; then
echo "include=[{'os': 'ubuntu', 'python-version': 3.12, 'numpy-version': 1.26}, {'os': 'windows', 'python-version': 3.12, 'numpy-version': 1.26}]" >> $GITHUB_OUTPUT
echo "conda-include=[{'os': 'ubuntu', 'python-version': 3.12}, {'os': 'windows', 'python-version': 3.12}]" >> $GITHUB_OUTPUT
echo "include=[{'os': 'ubuntu', 'python-version': 3.13, 'numpy-version': 2}, {'os': 'windows', 'python-version': 3.13, 'numpy-version': 2}]" >> $GITHUB_OUTPUT
echo "conda-include=[{'os': 'ubuntu', 'python-version': 3.13}, {'os': 'windows', 'python-version': 3.13}]" >> $GITHUB_OUTPUT
else
echo "include=[]" >> $GITHUB_OUTPUT
echo "conda-include=[]" >> $GITHUB_OUTPUT
Expand All @@ -111,7 +111,7 @@ jobs:
- uses: actions/checkout@v6
with: {fetch-depth: 0, submodules: recursive}
- name: set requirements
run: sed -ri -e 's/(.* python) .*/\1=${{ matrix.python-version }}/' -e 's/(.* numpy) .*/\1=${{ matrix.numpy-version }}/' -e 's/cuda*/py*/' -e '/tigre/d' scripts/cil_development.yml
run: sed -ri -e 's/(.* python) .*/\1=${{ matrix.python-version }}/' -e 's/(.* numpy) .*/\1=${{ matrix.numpy-version }}/' -e 's/cuda*/cpu*/' -e '/tigre/d' scripts/cil_development.yml
- uses: conda-incubator/setup-miniconda@v4
with:
miniforge-version: latest
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
with:
recipe-path: recipe.yaml
rattler-build-version: v0.65.0 # https://github.com/prefix-dev/rattler-build/pull/2484
build-args: --experimental -c conda-forge -c ccpi -c astra-toolbox --variant python=${{ matrix.python-version }}
build-args: --experimental -c astra-toolbox -c conda-forge -c httomo -c ccpi -c ccpi/label/dev --variant python=${{ matrix.python-version }}
artifact-name: conda-py${{ matrix.python-version }}-${{ matrix.os }}
conda-upload:
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')
Expand Down Expand Up @@ -194,7 +194,7 @@ jobs:
- name: install dependencies
run: |
mamba install -c conda-forge -yq conda-merge
sed -ri -e 's/(.* python) .*/\1=3.12/' -e 's/cuda*/py*/' -e '/tigre/d' ../scripts/cil_development.yml
sed -ri -e 's/(.* python) .*/\1=3.12/' -e 's/cuda*/cpu*/' -e '/tigre/d' ../scripts/cil_development.yml
conda-merge ../scripts/cil_development.yml docs_environment.yml > environment.yml
mamba env update -n test --file environment.yml
conda list
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ __pycache__/
/Wrappers/Python/cil-*.dist-info/
/Wrappers/Python/cil/include/
/Wrappers/Python/cil/lib/
/Wrappers/Python/build/
*.vscode*
*.egg*
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
- Update FindIPP.cmake to find IPP libraries in conda environments (#2286)
- Update to ASTRA-TOOLBOX version v2.4 from the `astra-toolbox` channel (#2330)
- Update to TIGRE v3.1.3 (#2317)
- Added support for numpy 2 (#2218)
- Added utililty method `dtype_like` to convert an input value to the same type as a reference array
- Added documentation to developer guide on scalar types with numpy>=2.
- Update to CCPi-Regularisation toolkit v25.0.0 (#2218)
- Update to Tomophantom v3.1.4 (#2218)
- Added support for python 3.13 (#2218)
- Documentation:
- Render the user showcase notebooks in the documentation (#2189)
- Update on build instructions in README and developer guide for all OS (#2286)
Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Binary installation of CIL can be achieved with `conda`.
We recommend using either [`miniconda`](https://docs.conda.io/projects/miniconda/en/latest) or [`miniforge`](https://github.com/conda-forge/miniforge), which are both minimal installers for `conda`. We also recommend a `conda` version of at least `23.10` for quicker installation.

#### Create a conda environment with CIL
We maintain an environment file with the required packages to run the [CIL demos](https://github.com/TomographicImaging/CIL-Demos) which you can use to create a new environment. This will have specific and tested versions of all dependencies that are outlined in the table below:
We maintain an environment file with the required packages to run the [CIL demos](https://github.com/TomographicImaging/CIL-Demos) which you can use to create a new environment. This will have specific and tested versions of all dependencies that are outlined in the table below:

```sh
conda env create -f https://tomographicimaging.github.io/scripts/env/cil_demos.yml
Expand Down Expand Up @@ -47,22 +47,21 @@ While building the CIL package we test with specific versions of dependencies. T

| Package | Tested Version | Conda install command | Description | License |
|----|----|--------|--------|----|
| [Python](https://www.python.org/) | 3.10 - 3.12 | `"python>=3.10,<=3.12"` || [PSF-2.0](https://docs.python.org/3/license.html) |
| [Numpy](https://github.com/numpy/numpy) | 1.23 - 1.26 | `"numpy>=1.23,<2"` || [BSD-3-Clause](https://numpy.org/doc/stable/license.html) |
| [IPP](https://www.intel.com/content/www/us/en/developer/tools/oneapi/ipp.html#gs.gxwq5p) | 2021.12 | `-c https://software.repos.intel.com/python/conda ipp=2021.12` | The Intel Integrated Performance Primitives Library (required for the CIL recon class). | [ISSL](http://www.intel.com/content/www/us/en/developer/articles/license/end-user-license-agreement.html) |
| [Python](https://www.python.org/) | 3.10 - 3.13 | `"python>=3.10,<=3.13"` || [PSF-2.0](https://docs.python.org/3/license.html) |
| [Numpy](https://github.com/numpy/numpy) | 2.0 - 2.4 | `"numpy>=2,<=2.4"` || [BSD-3-Clause](https://numpy.org/doc/stable/license.html) |
| [IPP](https://www.intel.com/content/www/us/en/developer/tools/oneapi/ipp.html#gs.gxwq5p) | 2021.12 | `-c https://tomography.stfc.ac.uk/conda ipp=2021.12` | The Intel Integrated Performance Primitives Library (required for the CIL recon class). | [ISSL](http://www.intel.com/content/www/us/en/developer/articles/license/end-user-license-agreement.html) |
|--|--| **Optional dependencies** |--|--|
| [ASTRA toolbox](http://www.astra-toolbox.com) | 2.1 | CPU: `conda-forge::astra-toolbox=2.1=py*` <br> GPU: `conda-forge::astra-toolbox=2.1=cuda*` | CT projectors, FBP and FDK. | [GPL-3.0](https://github.com/astra-toolbox/astra-toolbox/blob/master/COPYING) |
| [TIGRE](https://github.com/CERN/TIGRE) | 2.6 | `ccpi::tigre=2.6` | CT projectors, FBP and FDK. | [BSD-3-Clause](https://github.com/CERN/TIGRE/blob/master/LICENSE.txt) |
| [CCPi Regularisation Toolkit](https://github.com/TomographicImaging/CCPi-Regularisation-Toolkit) | 24.0.1 | `ccpi::ccpi-regulariser=24.0.1` | Toolbox of regularisation methods. | [Apache-2.0](https://github.com/TomographicImaging/CCPi-Regularisation-Toolkit/blob/master/LICENSE) |
| [TomoPhantom](https://github.com/dkazanc/TomoPhantom) | [3.0.3](https://github.com/dkazanc/TomoPhantom/releases/tag/v3.0) | `ccpi::tomophantom=3.0.3` | Generates phantoms to use as test data. | [Apache-2.0](https://github.com/dkazanc/TomoPhantom/blob/master/LICENSE) |
| [ASTRA toolbox](http://www.astra-toolbox.com) | 2.0 - 2.4 | `astra-toolbox::astra-toolbox=2.4` | CT projectors, FBP and FDK. | [GPL-3.0](https://github.com/astra-toolbox/astra-toolbox/blob/master/COPYING) |
| [TIGRE](https://github.com/CERN/TIGRE) | 3.1.3 | `ccpi::tigre=3.1.3` | CT projectors, FBP and FDK. | [BSD-3-Clause](https://github.com/CERN/TIGRE/blob/master/LICENSE.txt) |
| [CCPi Regularisation Toolkit](https://github.com/TomographicImaging/CCPi-Regularisation-Toolkit) | 25.0.0 | CPU: `ccpi::ccpi-regulariser=25.0.0=cpu*` <br> GPU: `ccpi::ccpi-regulariser=25.0.0=cuda*` | Toolbox of regularisation methods. | [Apache-2.0](https://github.com/TomographicImaging/CCPi-Regularisation-Toolkit/blob/master/LICENSE) |
| [TomoPhantom](https://github.com/dkazanc/TomoPhantom) | 3.0.3 - 3.1.4 | `httomo::tomophantom=3.1.4` | Generates phantoms to use as test data. | [Apache-2.0](https://github.com/dkazanc/TomoPhantom/blob/master/LICENSE) |
| [ipykernel](https://github.com/ipython/ipykernel) || `ipykernel` | Provides the IPython kernel to run Jupyter notebooks. | [BSD-3-Clause](https://github.com/ipython/ipykernel/blob/main/LICENSE) |
| [ipywidgets](https://github.com/jupyter-widgets/ipywidgets) || `ipywidgets` | Enables visualisation tools within jupyter noteboooks. | [BSD-3-Clause](https://github.com/jupyter-widgets/ipywidgets/blob/main/LICENSE) |
|[zenodo_get](https://github.com/dvolgyes/zenodo_get)|>= 1.6|`zenodo_get>=1.6`| Downloads datasets from Zenodo, is used by `dataexample` to get data used in CIL-Demos |[AGPL-3.0](https://github.com/dvolgyes/zenodo_get?tab=AGPL-3.0-1-ov-file)|
|--|--| **CT data readers** |--|--|
|[olefile](https://github.com/decalage2/olefile)|>= 0.46|`olefile>=0.46`|Package to process Microsoft OLE2 files, used to read ZEISS data files.|[BSD-style (custom)](https://github.com/decalage2/olefile?tab=License-1-ov-file)|
|[dxchange](https://github.com/data-exchange/dxchange)|>= 0.2.1|`dxchange>=0.2.1`|Provides an interface with TomoPy for loading tomography data.|[BSD-style (custom)](https://github.com/data-exchange/dxchange?tab=License-1-ov-file)|


### Docker

Finally, CIL can be run via a Jupyter Notebook enabled Docker container:
Expand Down
24 changes: 12 additions & 12 deletions Wrappers/Python/cil/framework/acquisition_data.py
Comment thread
casperdcl marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
class AcquisitionData(DataContainer, Partitioner):
"""
DataContainer for holding 2D or 3D sinogram

Parameters
----------
array : numpy.ndarray or DataContainer
Expand All @@ -36,10 +36,10 @@ class AcquisitionData(DataContainer, Partitioner):
If True, the array will be deep copied. If False, the array will be shallow copied.
geometry : AcquisitionGeometry
The geometry of the data. If the dtype of the array and geometry are different, the geometry dtype will be overridden.

**kwargs:
dtype : numpy.dtype
Specify the data type of the AcquisitionData array, this is useful if you pass None to array and want to over-ride the dtype of the geometry.
Specify the data type of the AcquisitionData array, this is useful if you pass None to array and want to over-ride the dtype of the geometry.
If an array is passed, dtype must match the dtype of the array.

"""
Expand Down Expand Up @@ -84,7 +84,7 @@ def __init__(self,
if dtype is None:
dtype = geometry.dtype
array = numpy.empty(geometry.shape, dtype)

elif issubclass(type(array) , DataContainer):
array = array.as_array()

Expand All @@ -107,12 +107,12 @@ def __eq__(self, other):
'''
Check if two AcquisitionData objects are equal. This is done by checking if the geometry, data and dtype are equal.
Also, if the other object is a numpy.ndarray, it will check if the data and dtype are equal.

Parameters
----------
other: AcquisitionData or numpy.ndarray
The object to compare with.

Returns
-------
bool
Expand All @@ -123,12 +123,12 @@ def __eq__(self, other):
if numpy.array_equal(self.as_array(), other.as_array()) \
and self.geometry == other.geometry \
and self.dtype == other.dtype:
return True
return True
elif numpy.array_equal(self.as_array(), other) and self.dtype==other.dtype:
return True
else:
return False

def _get_slice(self, **kwargs):
'''
Functionality of get_slice
Expand Down Expand Up @@ -165,8 +165,8 @@ def _get_slice(self, **kwargs):
return out
else:
return AcquisitionData(out.array, deep_copy=False, geometry=geometry_new)


def get_slice(self, *args, **kwargs):
'''
Returns a new AcquisitionData of a single slice in the requested direction.
Expand Down Expand Up @@ -205,10 +205,10 @@ def get_slice(self, *args, **kwargs):
raise TypeError(f"Cannot use 'projection' for geometries that use angles. Use 'angle' instead.")
elif key not in AcquisitionDimension and key != 'force':
raise TypeError(f"'{key}' not in allowed labels {AcquisitionDimension}.")

if args:
warnings.warn("Positional arguments for get_slice are deprecated. Use keyword arguments instead.", DeprecationWarning, stacklevel=2)

num_args = len(args)

if num_args > 0:
Expand Down
2 changes: 1 addition & 1 deletion Wrappers/Python/cil/framework/acquisition_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1980,7 +1980,7 @@ def shape(self):
AcquisitionDimension.HORIZONTAL: self.config.panel.num_pixels[0]}


return tuple(shape_dict[label] for label in self.dimension_labels)
return tuple(int(shape_dict[label]) for label in self.dimension_labels)

@property
def dimension_labels(self):
Expand Down
4 changes: 1 addition & 3 deletions Wrappers/Python/cil/framework/block.py
Comment thread
casperdcl marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,7 @@ def __neg__(self):
return -1 * self

def dot(self, other):
#
tmp = [ self.containers[i].dot(other.containers[i]) for i in range(self.shape[0])]
return sum(tmp)
return sum(self.containers[i].dot(other.containers[i]) for i in range(self.shape[0]))

def __len__(self):

Expand Down
Loading
Loading