Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a164114
added numpy array to possible SIRF image data algebra operands
evgueni-ovtchinnikov Nov 17, 2025
c53d80b
added to User Guide a subsection on SIRF/numpy data algebra peculiari…
evgueni-ovtchinnikov Nov 24, 2025
9f2ecf8
updated CHANGES.md [ci skip]
evgueni-ovtchinnikov Nov 24, 2025
80b3c07
added tests for #1358
evgueni-ovtchinnikov Nov 25, 2025
57d9e15
attended to Codacy issues
evgueni-ovtchinnikov Nov 25, 2025
0477cc0
simpliied mixed data algebra
evgueni-ovtchinnikov Nov 27, 2025
f249547
resolved conflicts
evgueni-ovtchinnikov Jan 15, 2026
6bfdf52
fixed mixing SIRF and numpy data algebra issue #1357
evgueni-ovtchinnikov Feb 3, 2026
9b67e9e
added algebra tests for ax/x, 2/x etc.
evgueni-ovtchinnikov Feb 5, 2026
a00488d
Merge branch 'master' of https://github.com/SyneRBI/SIRF
evgueni-ovtchinnikov Feb 10, 2026
c3aa576
Merge branch 'master' into mda-priority-fix
evgueni-ovtchinnikov Feb 10, 2026
856c7ee
added the result type checks for mixed data algebra
evgueni-ovtchinnikov Feb 11, 2026
0d8f93f
[ci skip] updated User Guide description of data algebra and CHANGES.md
evgueni-ovtchinnikov Feb 11, 2026
7ce286d
fixed sirf.Reg.ImageData.asarray() bug
evgueni-ovtchinnikov Feb 17, 2026
608074e
made corrections required by replacing as_array with asarray in data …
evgueni-ovtchinnikov Feb 18, 2026
1e65fb5
[ci skip] explained strides setting in sirf.Reg.ImageData.__array_int…
evgueni-ovtchinnikov Feb 18, 2026
6d1d3e5
Merge branch 'master' of https://github.com/SyneRBI/SIRF
evgueni-ovtchinnikov Mar 12, 2026
a50a20c
asarray -> as_array
evgueni-ovtchinnikov Mar 26, 2026
07e4b6a
moved t = y.norm() back to where it was on master
evgueni-ovtchinnikov Mar 26, 2026
ff2a60b
Merge branch 'master' into reg-asarray-fix
evgueni-ovtchinnikov Mar 26, 2026
6bce975
trying to placate Codacy
evgueni-ovtchinnikov Mar 26, 2026
0ab9500
Merge branch 'master' into reg-asarray-fix
evgueni-ovtchinnikov Mar 26, 2026
0c7707c
Replace string with comment
KrisThielemans Mar 26, 2026
109496f
[ci skip] restored missing lines in CHANGES.md
evgueni-ovtchinnikov Mar 27, 2026
4ebe9a9
Merge branch 'reg-asarray-fix' of https://github.com/SyneRBI/SIRF int…
evgueni-ovtchinnikov Mar 27, 2026
df9feae
[ci skip] pulled and fixed CHANGES.md
evgueni-ovtchinnikov Mar 27, 2026
eb7d1de
[ci skip] restored the last (hopefully) couple of lines in CHANGES.md
evgueni-ovtchinnikov Mar 27, 2026
5f4e227
Merge branch 'master' into reg-asarray-fix
evgueni-ovtchinnikov Mar 27, 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
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
* SIRF/STIR
- The implementation of the creation of `sirf.STIR.ImageData` from `sirf.STIR.AcquisitionData` has been revised to ensure compatibility of `ImageData` dimensions and voxel sizes with `AcquisitionData`.
- Missing `__del__` added to sirf.STIR.AcquisitionModel.
Comment thread
evgueni-ovtchinnikov marked this conversation as resolved.
* SIRF/Registration
- sirf.Reg.ImageData stores voxels values in a 3D Fortran-style array, hence strides had to be set in `ImageData.__array_interface__` accordingly (other SIRF ImageData objects use default C-style).
* Python interface
- Restored functionality for algebraic operations mixing SIRF data containers and numpy arrays and corrected the description of the result type in User Guide.
- Adjoint operator added in `common/SIRF.py`.
- Error raised if `AcquisitionModel.adjoint` ran when the model is not linear.
* SIRF
- `common/SIRF.py` adding adjoint operator
Expand Down
14 changes: 11 additions & 3 deletions src/Registration/pReg/Reg.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,17 @@ def __array_interface__(self):
"""As per https://numpy.org/doc/stable/reference/arrays.interface.html"""
if not self.supports_array_view:
raise ContiguousError("please make an array-copy first with `asarray(copy=True)` or `as_array()`")
return {
'shape': self.shape, 'typestr': '<f4', 'version': 3,
'data': (parms.size_t_par(self.handle, 'NiftiImageData', 'address'), False)}
# NiftiImageData stores voxels values in a 3D Fortran-style array,
# hence strides need to be arranged accordingly (default is C-style).
shape = self.shape
dims = len(shape)
strides = ()
stride = 4
Comment thread
evgueni-ovtchinnikov marked this conversation as resolved.
for i in range(dims):
strides += (stride,)
stride *= shape[i]
return {'shape': self.shape, 'typestr': '<f4', 'strides': strides, 'version': 3,
'data': (parms.size_t_par(self.handle, 'NiftiImageData', 'address'), False)}


class NiftiImageData3D(NiftiImageData):
Expand Down
1 change: 1 addition & 0 deletions src/common/Utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ def is_operator_adjoint(operator, num_tests=5, max_err=10e-5, verbose=True):
def data_container_algebra_tests(test, x, eps=1e-4):

ax = x.as_array()

ay = numpy.ones_like(ax)
y = x.clone()
y.fill(ay)
Expand Down
Loading