Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- dxchange minimum version set to 0.2.1 to fix #2256 (#2268)
- improve `tqdm` notebook support (#2241)
- cvxpy maximum version set to 1.7.5 to fix #2303 (#2304)
- Update to TomoPhantom v3.0 (#2287)
Comment thread
gfardell marked this conversation as resolved.
- Handle regularisation toolkit CPU only package error message (#2302)
- Documentation:
- Render the user showcase notebooks in the documentation (#2189)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ While building the CIL package we test with specific versions of dependencies. T
| [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) | [2.0.0](https://github.com/dkazanc/TomoPhantom/releases/tag/v2.0.0) | `ccpi::tomophantom=2.0.0` | Generates phantoms to use as test data. | [Apache-2.0](https://github.com/dkazanc/TomoPhantom/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) |
| [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)|
Expand Down
34 changes: 8 additions & 26 deletions Wrappers/Python/cil/plugins/TomoPhantom.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,12 @@
import os
import numpy as np

import ctypes, platform
from ctypes import util
# check for the extension
if platform.system() == 'Linux':
dll = 'libctomophantom.so'
elif platform.system() == 'Windows':
dll_file = 'ctomophantom.dll'
dll = util.find_library(dll_file)
elif platform.system() == 'Darwin':
dll = 'libctomophantom.dylib'
else:
raise ValueError('Not supported platform, ', platform.system())

libtomophantom = ctypes.cdll.LoadLibrary(dll)


import ctypes
import tomophantom.ctypes.external as external

path = os.path.dirname(tomophantom.__file__)
path_library2D = os.path.join(path, "Phantom2DLibrary.dat")
path_library3D = os.path.join(path, "Phantom3DLibrary.dat")
path_library2D = os.path.join(path, "phantomlib", "Phantom2DLibrary.dat")
path_library3D = os.path.join(path, "phantomlib", "Phantom3DLibrary.dat")

def is_model_temporal(num_model, num_dims=2):
'''Returns whether a model in the TomoPhantom library is temporal
Expand Down Expand Up @@ -89,24 +75,20 @@ def check_model_params(num_model, num_dims=2):
:type num_dims: int, default 2
'''
if num_dims == 2:
libtomophantom.checkParams2D.argtypes = [ctypes.POINTER(ctypes.c_int), # pointer to the params array
external.c_checkParams2D.argtypes = [ctypes.POINTER(ctypes.c_int), # pointer to the params array
ctypes.c_int, # model number selector (int)
ctypes.c_char_p] # string to the library file
params = np.zeros([10], dtype=np.int32)
params_p = params.ctypes.data_as(ctypes.POINTER(ctypes.c_int))
lib2d_p = str(path_library2D).encode('utf-8')
libtomophantom.checkParams2D(params_p, num_model, lib2d_p)
external.c_checkParams2D(params, num_model, str(path_library2D))

return params

elif num_dims == 3:
libtomophantom.checkParams3D.argtypes = [ctypes.POINTER(ctypes.c_int), # pointer to the params array
external.c_checkParams3D.argtypes = [ctypes.POINTER(ctypes.c_int), # pointer to the params array
ctypes.c_int, # model number selector (int)
ctypes.c_char_p] # string to the library file
params = np.zeros([11], dtype=np.int32)
params_p = params.ctypes.data_as(ctypes.POINTER(ctypes.c_int))
lib2d_p = str(path_library3D).encode('utf-8')
libtomophantom.checkParams3D(params_p, num_model, lib2d_p)
external.c_checkParams3D(params, num_model, str(path_library3D))

return params

Expand Down
2 changes: 1 addition & 1 deletion Wrappers/Python/test/test_ring_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_L1Norm_2D(self):
model = 12 # select a model number from the library
N = 400 # set dimension of the phantom
path = os.path.dirname(tomophantom.__file__)
path_library2D = os.path.join(path, "Phantom2DLibrary.dat")
path_library2D = os.path.join(path, "phantomlib", "Phantom2DLibrary.dat")

phantom_2D = TomoP2D.Model(model, N, path_library2D)
# data = ImageData(phantom_2D)
Expand Down
4 changes: 2 additions & 2 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test:
- python-wget
- cvxpy <= 1.7.5 # [linux]
- scikit-image
- tomophantom 2.0.0 # [linux]
- tomophantom 3.0.3
- tigre 2.6
- packaging
- ccpi-regulariser 24.0.1 # [not osx]
Expand Down Expand Up @@ -65,7 +65,7 @@ requirements:

# version constraints of optional dependencies
run_constrained:
- tomophantom >=2
- tomophantom >=3.0.3
- astra-toolbox >=1.9.9.dev5
- tigre >=2.4
- ccpi-regulariser >=24.0.1
Expand Down
2 changes: 1 addition & 1 deletion scripts/requirements-test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ dependencies:
- ccpi::cil-data >=22
- ccpi::tigre 2.6
- ccpi::ccpi-regulariser 24.0.1
- ccpi::tomophantom 2.0.0
- astra-toolbox 2.1 cuda*
- ccpi::tomophantom 3.0.3
Comment thread
gfardell marked this conversation as resolved.
- cvxpy <= 1.7.5
- python-wget
- scikit-image
Expand Down
4 changes: 2 additions & 2 deletions scripts/requirements-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ channels:
dependencies:
- python >=3.10
- numpy >=1.23,<2
- libgomp # [linux]
- llvm-openmp
Comment thread
gfardell marked this conversation as resolved.
- ccpi::cil-data >=22
- ccpi::tigre 2.6
- ccpi::ccpi-regulariser 24.0.1
- ccpi::tomophantom 2.0.0
- ccpi::tomophantom 3.0.3
- astra-toolbox 2.1 cuda*
- cvxpy <= 1.7.5
- python-wget
Expand Down
Loading