[SyneRBI/SIRF-Contribs] MaGeZ (PR #28)

5 views
Skip to first unread message

Casper da Costa-Luis

unread,
Jan 23, 2026, 9:25:40 AMJan 23
to SyneRBI/SIRF-Contribs, Subscribed

/CC @gschramm


You can view, comment on, or merge this pull request online at:

  https://github.com/SyneRBI/SIRF-Contribs/pull/28

Commit Summary

  • 3f0e6b9 add optional argument for giving image size
  • 2d18cb9 preliminary version of BSREM for the mMR NEMA IQ
  • fff935a some more early checks
  • 18abec4 preliminary version of QC utility
  • 871346b make Siemens mMR data appear in better directories
  • bd28698 reduce duration of mMR data from 600 to 500
  • 8c8a55e Merge branch 'main' into BSREM_scripts
  • f1f67d6 more plots
  • 2fb23d2 2 extra BSREM scripts
  • a54540b fixed filename
  • f1434ea parameterise BSREM recon
  • 101e810 lint
  • c809414 add tensorboardX
  • 32ba086 write images and all objectives
  • 21bc466 fix bugs
  • 72d4cec drop matplotlib, log all intervals, add clip & cmax
  • ab32faa improve BSREM_common.py
  • 2d0a911 separate SaveCallback
  • 2593c5e Merge branch 'BSREM_scripts' of github.com:SyneRBI/PETRIC into BSREM_scripts
  • b6ac6f3 add optional savedir to SaveCallback
  • d23ca8f updated README
  • d60a895 read penalty weight from file (if it exists)
  • e88faaa update BSREM files for data-sets
  • aa10f2a misc tidy
  • e65a665 lint
  • a82141d Merge pull request #16 from SyneRBI/BSREM_scripts
  • 80efdd6 main (submission) & petric (backend) framework
  • 2e98031 CI: fix setup
  • 81cab86 update readme
  • 53b1946 minor comment
  • 7ba4b34 optional subsets & priors
  • 2cca32a drop more Dataset items
  • 64d9afc some docs
  • b4e3d85 docker: edge image
  • a8d3155 Merge pull request #20 from SyneRBI/main-backend
  • cc5448e Update README.md
  • 36156a1 Merge pull request #21 from SyneRBI/update-example-description
  • 0160194 slight docs tweaks
  • 0e472e1 Working SGD example with metrics and SIRF objective functions
  • e35b5bf add SGD example
  • 67ce652 update deps
  • 9d8e988 Merge pull request #23 from SyneRBI/sgd-example
  • c371fda image quality callback
  • 5aec470 improve local run docs
  • ac6401c some review comments
  • 5483ba6 Merge pull request #25 from SyneRBI/metrics-and-docs
  • 01178df document --gpus all
  • 0c26d84 fix potentially missing petric module
  • fd7cd97 continue on error
  • aed5cf8 enable logging
  • 5875054 fix per-dataset timeout
  • 5ab9d79 added non-negativity
  • 14e3dc3 git ignore output/ and other files
  • 68756d4 import petric no longer reads data
  • ee948ef typos, and re-instate setting first dataset
  • 99266c6 petric: get_data lazy load (#32)
  • a78fb4a fix checks
  • c607fcf IndicatorBox numpy implementation
  • fcd5f71 fiddle with parameters
  • a4b75e7 final cleanup
  • e3f5300 Merge pull request #35 from SyneRBI/ISTA
  • ba74194 use OSEM image
  • 2bd78f4 added preconditioner
  • dc6a478 add kappa to data
  • 5b1431f lint + print exceptions
  • fffc8bd Apply suggestions from code review
  • 970bb18 lint & comments
  • 4301b7c Merge pull request #36 from SyneRBI/precond
  • 46ec6b6 note about renaming/symlinking
  • c45b39b remove redundant exception types
  • 7fa22f8 update ISTA step_size
  • 85393b1 Merge pull request #39 from SyneRBI/ISTA_step_size
  • b043a13 add metrics as per wiki
  • d397e0e update after review
  • d7e6fe4 drop filters
  • a5860b5 slight tidy
  • beb42e9 Merge pull request #46 from SyneRBI/metrics
  • 479a16b add QC for reference image and VOIs
  • 244d715 pass through options and make saving optional
  • 35e45aa Merge pull request #48 from SyneRBI/data_QC_VOIs
  • 9900487 fix metrics
  • bc5d6c5 more options for data_QC (#52)
  • 23c396a Use CUDA RDP if it exists (#49)
  • fa30ba7 fix objectives.csv
  • f50765f lint
  • c6994b3 Merge pull request #53 from SyneRBI/objectives-csv
  • 086f029 slight doc updates
  • f015da8 replace namedtuple => dataclass
  • dc556ce drop typing.Any
  • 4723355 Merge pull request #55 from SyneRBI/dataclass
  • 247df6c fix mutable default error
  • 6b48deb provide example implementing OSEM
  • c8146b5 misc tidy
  • e56e20d update docstring
  • 835f555 update docstring
  • a62efb0 Merge pull request #54 from SyneRBI/OSEM_example
  • 56e36e8 drop symlink
  • 35a6c4c Merge pull request #56 from SyneRBI/drop-symlink
  • facebd1 metrics: standalone `log()`
  • f31d077 QualityMetrics.evaluate
  • 11112d2 Merge pull request #57 from SyneRBI/metrics-log
  • 2ace675 SaveIters: flush csv each row
  • 78d6904 Merge pull request #60 from SyneRBI/csv-flush
  • 96b66c7 callbacks with custom interval
  • e21ff31 data_QC: plot VOIs with transparancy as well
  • 2a741e9 data_QC: centre VOI images and add COM to plots
  • c5d554c data_QC: fix location of VOI*.png
  • a9ac16c Merge pull request #61 from SyneRBI/data_QC_VOI
  • d1abbc7 Merge pull request #59 from SyneRBI/metrics-interval
  • 4a47f7b minor correction in header
  • 640a3fc add some utilities for reading/plotting
  • f6ff8a9 update README
  • 966d01f lint
  • 67781a4 readability updates
  • 9cc4a52 more pythonic implementation to get keys()
  • 6a0c66b Merge pull request #65 from SyneRBI/evaluation_utilities
  • 4c46a54 tensorboard walltime excluding PETRIC callbacks
  • 00771cf minor correction in header
  • 0df0224 update BSREM ref generation scripts
  • c4ae648 OSEM check Vision600_thorax
  • 10dda2b plot BSREM metrics
  • 0d6800b OSEM NeuroLF_Hoffman and mMR_NEMA_IQ check-in
  • 7d4b113 add Siemens_Vision600_thorax_VOI_prep.sh
  • 3730147 add NeuroLF_VOIs.py
  • 4fbd847 add Siemens_mMR_NEMA_VOIs.py
  • 6b1e738 add __init.py__
  • e92046a avoid unnecessary `time()` call
  • d38a919 Merge pull request #67 from SyneRBI/tb-walltime-offset
  • d1044ff pass_index
  • 7f3cb70 pass_index(window)
  • 8256725 use scipy.ndimage.binary_erosion
  • d9fbdc0 Merge pull request #68 from SyneRBI/metrics-pass
  • 27f9e2a raise runtime to 10 mins
  • daa20bd Merge pull request #75 from SyneRBI/bump-runtime
  • 16f2b64 add examples for common pip/conda packages
  • 62fcfb0 preliminary utility for evolution of metrics
  • 085b2d0 no longer require a template image for the initial OSEM
  • 2bdf0ba Allow initial data preparation without mu-map
  • e9f917c first set of files for the mMR ACR data
  • 4554816 lint
  • 3fa3bea Merge pull request #78 from SyneRBI/BSREM_metric_plots
  • fb2658e add note on conda vs pip
  • e6adc67 Merge pull request #76 from SyneRBI/example-conda-pip
  • c40e87d merging main...
  • 4f2dbd1 a couple of small corrections
  • 89f0bca [ci skip] described EO corrections in Siemens_mMR_ACR/README.md
  • b1dd679 misc tidy & import fixes
  • e72d5ca expose data.path
  • 730325b Merge pull request #80 from SyneRBI/data-path
  • dd25d08 slight lint
  • 2de2769 docker dev instructions
  • eef8f6c Merge pull request #81 from SyneRBI/docker-user-run
  • 94c8022 Merge branch 'main' into Siemens_mMR_ACR
  • 181f864 docs: leaderboard config & metrics runtime
  • 5b584f6 Merge pull request #83 from SyneRBI/doc-leaderboard-metrics
  • 8cea939 docs: slight tidy
  • 14ee30a removed comments explaining EO fixes
  • 50228d6 Merge pull request #79 from SyneRBI/Siemens_mMR_ACR
  • d65095b linting
  • 0777291 mention wiki FAQs
  • 7d26561 update Siemens_mMR_ACR README with additional steps
  • df947d9 initial BSREM for Siemens_mMR_ACR
  • 6641dc9 Merge branch 'main' into kris_eval
  • d6cece0 white-space
  • 72f0de4 moved data-set specific files to subfolders
  • 7109574 reduce overlap in evaluation scripts
  • 52c491c some corrections in VOI conversion scripts
  • 0755f0a Merge remote-tracking branch 'origin/main' into kris_eval
  • ea9ad20 updates to README
  • 9fc66ff remove some user-specific paths
  • 48876af use correct name for folder of NeuroLF data
  • cc8da8b Merge branch 'kris_eval' into Siemens_mMR_ACR2
  • 1940302 clarify path of template_image
  • cc83b45 add the_orgdata_path for downloaded data etc
  • ac3531f add Siemens_mMR_ACR
  • 260a847 Siemens_mMR_ACR processing updates
  • c9163a5 lint
  • ced6a57 import & module tidy
  • c4819ab remove remnant VOI_checks (now in data_QC)
  • 513473a Merge pull request #89 from KrisThielemans/kris_eval
  • 92d40a7 add VOIs for the mMR ACR
  • 6fdda40 Merge remote-tracking branch 'origin/main' into Siemens_mMR_ACR2
  • cba1219 removed obsolete file
  • d9d249f Merge pull request #88 from SyneRBI/Siemens_mMR_ACR2
  • e114f21 lint
  • 0c9cd2c fix prior
  • fb14c87 Merge pull request #92 from SyneRBI/fix-ISTA-prior
  • 24f69b5 fix conda environment.yml
  • 50f28f0 fix conda environment.yml
  • c2b4d38 Merge remote-tracking branch 'upstream/main'
  • 192a757 allow dataset sagittal_slices setting
  • 7ee18b7 data_QC improvements
  • 4f1e1cf add Mediso_NEMA_IQ
  • 9097ae2 restore running 400 OSEM updates in the evaluation scripts
  • 281d57e small fixes to evualuation script
  • a142349 print VOI volume in data_QC
  • 2b8f10c some extra comments in Mediso_NEMA_IQ/README
  • 585f580 Merge pull request #102 from KrisThielemans/Mediso_NEMA_IQ
  • 4bda727 slight lint
  • b1e31da TensorBoard: add sagittal slice
  • 5c1fa8a Merge pull request #104 from SyneRBI/sagittal
  • 955bd0e add DATA_SLICES
  • 4a8a865 Merge pull request #105 from SyneRBI/data-slices
  • 12f1530 update instructions for creating a new dataset
  • 8eab859 correct default for VOI file
  • d89e348 git ignore some more output files
  • f867014 Use dataset_name to get default path
  • be0c011 use more Python modules
  • 1a16838 Merge pull request #107 from SyneRBI/prep_README
  • aae6ed3 Threshold before computing sqrt for kappa
  • cb70ded added Siemens_mMR_NEMA_IQ_lowcounts
  • 375a537 added README
  • 66581cc correct hyperlinks etc
  • c6719d1 Update petric.py
  • 49ac42e Merge pull request #108 from SyneRBI/Siemens_mMR_NEMA_IQ_lowcounts
  • a6a5002 Update README.md
  • 0bb809a Create LICENSE
  • 08e6ff0 install pytorch-cuda & tensorflow-gpu
  • 00bc800 Merge pull request #112 from SyneRBI/gpu-libs
  • dcc50a6 addition of the GE_DMI3_Torso dataset
  • 8bf4314 Merge pull request #111 from SyneRBI/GE_DMI3_Torso
  • 4e8164f add mMR_ACR
  • f351359 add Mediso_NEMA
  • 069f462 fine-grained metrics, skip objective
  • 73490ac add GE_DMI3_Torso
  • 23a1699 add mMR_NEMA_lowcounts
  • 429d8f6 compute metric every 3 updates for now
  • e549237 Merge pull request #91 from SyneRBI/mMR_ACR
  • 0eb98be add FOV_mask to Dataset
  • 8e8a7c4 Merge pull request #116 from SyneRBI/FOV_mask
  • a4915ea update gitignore
  • 0f704b9 resolve merge conflicts
  • f25f2b1 update README
  • 6096dbc add ALG1 files
  • 7fde2c2 update README
  • 06e67a0 use provided FOV mask
  • d035b98 remove MaxIteration callback
  • a196822 code cleanup + documentation
  • 2effc18 correct alg1 description in README
  • cec28de add ALG2 desctription to README
  • 19132d0 Update README.md
  • e56220c merge of paper branch that contains new simulations (#3)
  • 716acd9 Update README.md (#4)
  • 2921277 fix use of to_device (#6)
  • a690205 sim_utils to_device fix (#7)
  • 5890cd0 Cupy fallback (#9)
  • 65548b7 update RDP (boundary conditions) such that they implementation is the exact same (up to float precision) with the one used in STIR's cuda relative difference prior (#11)
  • 4fe14a5 few memory optimisations
  • 9c2a2ef tidy for merge into SIRF-Contribs
  • 0d5ff91 add MaGeZ

File Changes

(5 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28@github.com>

Casper da Costa-Luis

unread,
Jan 23, 2026, 9:29:48 AMJan 23
to SyneRBI/SIRF-Contribs, Push

@casperdcl pushed 2 commits.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/before/0d5ff91064694f9c40cd3727fee2443d77c59b14/after/289b7e65476131a1d39709ec3fcf39dfd91ad5a3@github.com>

Casper da Costa-Luis

unread,
Jan 23, 2026, 9:34:47 AMJan 23
to SyneRBI/SIRF-Contribs, Push

@casperdcl pushed 2 commits.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/before/289b7e65476131a1d39709ec3fcf39dfd91ad5a3/after/21ca8e3bef1c25185236630c6c6140d244897654@github.com>

Casper da Costa-Luis

unread,
Jan 23, 2026, 9:44:21 AMJan 23
to SyneRBI/SIRF-Contribs, Subscribed

@casperdcl commented on this pull request.


In src/Python/sirf/contrib/MaGeZ/__init__.py:

> @@ -0,0 +1 @@
+from .main import Submission, submission_callbacks

potentially want

⬇️ Suggested change
-from .main import Submission, submission_callbacks
+from .main import Submission as MaGeZ, submission_callbacks


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/review/3697873781@github.com>

Casper da Costa-Luis

unread,
Jan 23, 2026, 9:46:45 AMJan 23
to SyneRBI/SIRF-Contribs, Push

@casperdcl pushed 2 commits.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/before/21ca8e3bef1c25185236630c6c6140d244897654/after/e84322c1dd559764b5fd04bc88aadab0c001be76@github.com>

Casper da Costa-Luis

unread,
Jan 23, 2026, 9:50:31 AMJan 23
to SyneRBI/SIRF-Contribs, Push

@casperdcl pushed 2 commits.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/before/e84322c1dd559764b5fd04bc88aadab0c001be76/after/3ab9ae3280e81aae1e066fd197cebded02191c7b@github.com>

Kris Thielemans

unread,
Jan 23, 2026, 12:36:00 PMJan 23
to SyneRBI/SIRF-Contribs, Subscribed

@KrisThielemans commented on this pull request.


In src/Python/sirf/contrib/MaGeZ/__init__.py:

> @@ -0,0 +1 @@
+from .main import Submission, submission_callbacks

good idea


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/review/3698754604@github.com>

Kris Thielemans

unread,
Jan 23, 2026, 12:42:42 PMJan 23
to SyneRBI/SIRF-Contribs, Subscribed

@KrisThielemans requested changes on this pull request.

some minor house-keeping suggestions, but I'm a little bit reluctant to add 75 commits here.

Potentially @casperdcl squashes the first PETRIC commits into 1, and then the actual MaGeZ commits (authored by Georg), and then keep the "clean-up" ones separate?

Maybe too much effort fo rnot enough benefit.


In src/Python/sirf/contrib/MaGeZ/LICENSE:

> +      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]

@gschramm can you suggest what this should be?


In src/Python/sirf/contrib/MaGeZ/main.py:

> @@ -0,0 +1,388 @@
+"""Main file to modify for submissions.
+
+Once renamed or symlinked as `main.py`, it will be used by `petric.py` as follows:

probably needs to change


In src/Python/sirf/contrib/MaGeZ/main.py:

> +    The organisers try to `Submission(data).run(inf)` i.e. for infinite iterations (until timeout).
+    This callback forces stopping after `max_iteration` instead.
+    """
+
+    def __init__(self, max_iteration: int, verbose: int = 1):
+        super().__init__(verbose)
+        self.max_iteration = max_iteration
+
+    def __call__(self, algorithm: Algorithm):
+        if algorithm.iteration >= self.max_iteration:
+            raise StopIteration
+
+
+class Submission(Algorithm):
+    """
+    Better preconditioned SVRG for PETRIC (MaGeZ ALG1)

should this therefore be called MaGeZ1?


In src/Python/sirf/contrib/MaGeZ/README.md:

> +### ALG2 (ALG2 branch, ALG2 tag)
+
+Similar to ALG1 but:
+The stepsize is set to 2.2 in the first epoch, and is then computed using the Barzilai-Borwein rule as described in Algorithm 2 in [https://arxiv.org/abs/1605.04131](https://arxiv.org/abs/1605.04131), 
+with m = 1 but using the short stepsize (see [https://en.wikipedia.org/wiki/Barzilai-Borwein_method]([https://en.wikipedia.org/wiki/Barzilai-Borwein_method])) adapted to preconditioned gradient ascent methods
+
+### ALG3 (ALG3 branch, ALG3 tag)
+
+Using the same setup as in ALG2 but with two minor differences.
+First, we use a slightly smaller number of subsets.
+Second, we use a non-stochastic selection of subset indices by considering the cyclic group corresponding to the given number of subsets, finding all of its generators (i.e. the set of all coprimes of the number of subsets that are smaller), and then creating indices by consider specific generators at a time.

not in this PR?


In src/Python/sirf/contrib/MaGeZ/README.md:

> +
+Similar to ALG1 but:
+The stepsize is set to 2.2 in the first epoch, and is then computed using the Barzilai-Borwein rule as described in Algorithm 2 in [https://arxiv.org/abs/1605.04131](https://arxiv.org/abs/1605.04131), 
+with m = 1 but using the short stepsize (see [https://en.wikipedia.org/wiki/Barzilai-Borwein_method]([https://en.wikipedia.org/wiki/Barzilai-Borwein_method])) adapted to preconditioned gradient ascent methods
+
+### ALG3 (ALG3 branch, ALG3 tag)
+
+Using the same setup as in ALG2 but with two minor differences.
+First, we use a slightly smaller number of subsets.
+Second, we use a non-stochastic selection of subset indices by considering the cyclic group corresponding to the given number of subsets, finding all of its generators (i.e. the set of all coprimes of the number of subsets that are smaller), and then creating indices by consider specific generators at a time.
+
+---
+---
+---
+
+# PETRIC: PET Rapid Image reconstruction Challenge

all of this should go


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/review/3698763976@github.com>

Casper da Costa-Luis

unread,
Jan 23, 2026, 2:22:15 PMJan 23
to SyneRBI/SIRF-Contribs, Subscribed
casperdcl left a comment (SyneRBI/SIRF-Contribs#28)

It was 281 commits before I filtered out all unnecessary files.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/c3791930682@github.com>

Casper da Costa-Luis

unread,
Jan 24, 2026, 4:04:41 PMJan 24
to SyneRBI/SIRF-Contribs, Push

@casperdcl pushed 55 commits.

  • ceec39b add SGD example
  • d9960e7 update deps
  • 8f79c64 Merge pull request #23 from SyneRBI/sgd-example
  • 88a91ad image quality callback
  • 0151706 improve local run docs
  • 40951c3 Merge pull request #25 from SyneRBI/metrics-and-docs
  • 9bc2ed8 document --gpus all
  • b173181 added non-negativity
  • 3706378 final cleanup
  • 5257352 Merge pull request #35 from SyneRBI/ISTA
  • 28ed970 slight doc updates
  • 0c5c5a5 drop symlink
  • 98862a7 Merge pull request #56 from SyneRBI/drop-symlink
  • 425a619 raise runtime to 10 mins
  • 3e5f107 Merge pull request #75 from SyneRBI/bump-runtime
  • 83fc94a add examples for common pip/conda packages
  • 5e0501f add note on conda vs pip
  • 6c1964a Merge pull request #76 from SyneRBI/example-conda-pip
  • e705493 merging main...
  • 76a9d31 docker dev instructions
  • 507a23a Merge pull request #81 from SyneRBI/docker-user-run
  • c963ea1 Merge branch 'main' into Siemens_mMR_ACR
  • 2c345b3 docs: leaderboard config & metrics runtime
  • f23a6ec Merge pull request #83 from SyneRBI/doc-leaderboard-metrics
  • b7ebd0d docs: slight tidy
  • fb32add Merge pull request #79 from SyneRBI/Siemens_mMR_ACR
  • 867f5df mention wiki FAQs
  • 2ac4d2d Merge branch 'main' into kris_eval
  • a79494c Merge remote-tracking branch 'origin/main' into kris_eval
  • 26dcf5a Merge branch 'kris_eval' into Siemens_mMR_ACR2
  • f146e6c Merge pull request #89 from KrisThielemans/kris_eval
  • d396a74 Merge remote-tracking branch 'origin/main' into Siemens_mMR_ACR2
  • daf8c6b Merge pull request #88 from SyneRBI/Siemens_mMR_ACR2
  • b775506 Update README.md
  • d6e3ca2 Create LICENSE
  • 18eb20d install pytorch-cuda & tensorflow-gpu
  • d0919d3 Merge pull request #112 from SyneRBI/gpu-libs
  • 519496f resolve merge conflicts
  • 0d2afaa update README
  • 3b73b23 add ALG1 files
  • d036e98 update README
  • 28409a8 use provided FOV mask
  • ff16048 remove MaxIteration callback
  • 131f2d6 code cleanup + documentation
  • 5397862 correct alg1 description in README
  • bc784c1 add ALG2 desctription to README
  • 4453f79 Update README.md
  • 5707d02 merge of paper branch that contains new simulations (#3)
  • 2a64562 Update README.md (#4)
  • af12e82 fix use of to_device (#6)
  • 4139176 Cupy fallback (#9)
  • aba33e3 update RDP (boundary conditions) such that they implementation is the exact same (up to float precision) with the one used in STIR's cuda relative difference prior (#11)
  • 3499cf7 few memory optimisations
  • fe40b45 tidy for merge into SIRF-Contribs
  • 0ae6241 add MaGeZ


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/before/26e0eb3a6d3afd15d25a8867dbe339c4ee107d3e/after/0ae6241cd61087cfbc9b3cac128a4a1d66ee3117@github.com>

Kris Thielemans

unread,
Jan 25, 2026, 7:10:58 AMJan 25
to SyneRBI/SIRF-Contribs, Subscribed

@KrisThielemans requested changes on this pull request.

Many thanks @casperdcl this (and the history) is looking a lot better.

@gschramm could you (suggest) update(s for) the README and LICENSE?


In src/Python/sirf/contrib/MaGeZ/README.md:

> @@ -0,0 +1,52 @@
+# MaGeZ contribution to the PETRIC reconstruction challenge
+
+This repository contains algorithms developed by the MaGeZ team submitted to
+the [2024 PETRIC reconstruction challenge](https://github.com/SyneRBI/PETRIC) and
+published in the preprint [Fast PET Reconstruction with Variance Reduction and Prior-Aware Preconditioning](https://arxiv.org/abs/2506.04976).

@gschramm I suppose it's best to refer to https://github.com/SyneRBI/PETRIC-MaGeZ here and to the published paper as opposed to the preprint?


In src/Python/sirf/contrib/MaGeZ/README.md:

> +- Matthias Ehrhardt, Univeristy of Bath, United Kingdom
+- Georg Schramm, KU Leuven, Belgium
+- Zeljko Kereta, Univeristy College London, United Kingdom

"Univeristy" spelling


In src/Python/sirf/contrib/MaGeZ/README.md:

> +## Simulation results related to 2024 PETRIC and our paper
+
+To reproduce all simulation results checkout the tag `2024_paper_simulation_results`
+and have a look at the [Readme.md in the simulation_src folder](https://github.com/SyneRBI/PETRIC-MaGeZ/blob/main/simulation_src/README.md).

this should be deleted (or rephrased in terms of https://github.com/SyneRBI/PETRIC-MaGeZ, but I don't think that's appropriate here).


In src/Python/sirf/contrib/MaGeZ/README.md:

> +**To reproduce the PETRIC results of our three submitted algorithms
+(ALG1, ALG2, ALG3), please checkout the respective tag.**

@gschramm I thnk this should be deleted, as well as text below on ALG2, ALG3, unless they get added


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/review/3703787150@github.com>

Edoardo Pasca

unread,
Jan 26, 2026, 4:12:47 AMJan 26
to SyneRBI/SIRF-Contribs, Subscribed

@paskino commented on this pull request.


In src/Python/sirf/contrib/MaGeZ/main.py:

> +        self._fov_mask = data.FOV_mask
+
+        # add a small number in the adjoint ones outside the FOV to avoid NaN in division
+        self._adjoint_ones.maximum(1e-6, out=self._adjoint_ones)
+
+        # initialize list / ImageData for all subset gradients and sum of gradients
+        self._summed_subset_gradients = self.x.get_uniform_copy(0)
+        self._subset_gradients = []
+
+        self._complete_gradient_epochs = complete_gradient_epochs
+
+        self._precond_update_epochs = precond_update_epochs
+
+        # setup python re-implementation of the RDP
+        # only used to get the diagonal of the RDP Hessian for preconditioning!
+        # (diag of RDP Hessian is not available in SIRF yet)

@KrisThielemans @evgueni-ovtchinnikov do you know whether this is still true?

The code could be significantly simplified otherwise.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/review/3705172831@github.com>

Evgueni Ovtchinnikov

unread,
Jan 26, 2026, 6:41:34 AMJan 26
to SyneRBI/SIRF-Contribs, Subscribed

@evgueni-ovtchinnikov commented on this pull request.


In src/Python/sirf/contrib/MaGeZ/main.py:

> +        self._fov_mask = data.FOV_mask
+
+        # add a small number in the adjoint ones outside the FOV to avoid NaN in division
+        self._adjoint_ones.maximum(1e-6, out=self._adjoint_ones)
+
+        # initialize list / ImageData for all subset gradients and sum of gradients
+        self._summed_subset_gradients = self.x.get_uniform_copy(0)
+        self._subset_gradients = []
+
+        self._complete_gradient_epochs = complete_gradient_epochs
+
+        self._precond_update_epochs = precond_update_epochs
+
+        # setup python re-implementation of the RDP
+        # only used to get the diagonal of the RDP Hessian for preconditioning!
+        # (diag of RDP Hessian is not available in SIRF yet)

yes it is not available in SIRF yet


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/review/3705666468@github.com>

Kris Thielemans

unread,
Jan 26, 2026, 8:34:31 AMJan 26
to SyneRBI/SIRF-Contribs, Subscribed

@KrisThielemans commented on this pull request.


In src/Python/sirf/contrib/MaGeZ/main.py:

> +        self._fov_mask = data.FOV_mask
+
+        # add a small number in the adjoint ones outside the FOV to avoid NaN in division
+        self._adjoint_ones.maximum(1e-6, out=self._adjoint_ones)
+
+        # initialize list / ImageData for all subset gradients and sum of gradients
+        self._summed_subset_gradients = self.x.get_uniform_copy(0)
+        self._subset_gradients = []
+
+        self._complete_gradient_epochs = complete_gradient_epochs
+
+        self._precond_update_epochs = precond_update_epochs
+
+        # setup python re-implementation of the RDP
+        # only used to get the diagonal of the RDP Hessian for preconditioning!
+        # (diag of RDP Hessian is not available in SIRF yet)

It is in STIR, which is how we work around it in PETRIC2. https://github.com/SyneRBI/PETRIC2/blob/dc1370277e747ce6c29cee4484c19230819026c9/SIRF_data_preparation/run_LBFGSBPC.py#L101 and all the lines above to get around this problem. @evgueni-ovtchinnikov is there a SIRF issue already to expose this?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/review/3706057108@github.com>

Casper da Costa-Luis

unread,
Jan 27, 2026, 6:35:47 AMJan 27
to SyneRBI/SIRF-Contribs, Push

@casperdcl pushed 2 commits.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/before/bc9dc3bcf5523c14ec5d7b14a81b8af364c367d7/after/b7fe1c28abe584684ae94e8cd92292f3f05f1187@github.com>

Edoardo Pasca

unread,
Jan 29, 2026, 5:52:51 AMJan 29
to SyneRBI/SIRF-Contribs, Subscribed

@paskino commented on this pull request.


In src/Python/sirf/contrib/MaGeZ/README.md:

> @@ -0,0 +1,52 @@
+# MaGeZ contribution to the PETRIC reconstruction challenge
+
+This repository contains algorithms developed by the MaGeZ team submitted to
+the [2024 PETRIC reconstruction challenge](https://github.com/SyneRBI/PETRIC) and
+published in the preprint [Fast PET Reconstruction with Variance Reduction and Prior-Aware Preconditioning](https://arxiv.org/abs/2506.04976).
⬇️ Suggested change
-published in the preprint [Fast PET Reconstruction with Variance Reduction and Prior-Aware Preconditioning](https://arxiv.org/abs/2506.04976).
+published in [Fast PET Reconstruction with Variance Reduction and Prior-Aware Preconditioning](https://doi.org/10.3389/fnume.2025.1641215).


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/review/3721985666@github.com>

Edoardo Pasca

unread,
Jan 29, 2026, 5:53:12 AMJan 29
to SyneRBI/SIRF-Contribs, Subscribed

@paskino commented on this pull request.


In src/Python/sirf/contrib/MaGeZ/README.md:

> @@ -0,0 +1,52 @@
+# MaGeZ contribution to the PETRIC reconstruction challenge
+
+This repository contains algorithms developed by the MaGeZ team submitted to
+the [2024 PETRIC reconstruction challenge](https://github.com/SyneRBI/PETRIC) and
+published in the preprint [Fast PET Reconstruction with Variance Reduction and Prior-Aware Preconditioning](https://arxiv.org/abs/2506.04976
).
+
+## Authors
+
+- Matthias Ehrhardt, Univeristy of Bath, United Kingdom
+- Georg Schramm, KU Leuven, Belgium
+- Zeljko Kereta, Univeristy College London, United Kingdom
⬇️ Suggested change
-- Zeljko Kereta, Univeristy College London, United Kingdom
+- Zeljko Kereta, University College London, United Kingdom


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/review/3721987222@github.com>

Edoardo Pasca

unread,
Jan 29, 2026, 6:00:07 AMJan 29
to SyneRBI/SIRF-Contribs, Subscribed

@paskino commented on this pull request.


In src/Python/sirf/contrib/MaGeZ/README.md:

> +This repository contains algorithms developed by the MaGeZ team submitted to
+the [2024 PETRIC reconstruction challenge](https://github.com/SyneRBI/PETRIC) and
⬇️ Suggested change
-This repository contains algorithms developed by the MaGeZ team submitted to
-the [2024 PETRIC reconstruction challenge](https://github.com/SyneRBI/PETRIC) and
+This repository contains the algorithm [ALG1](https://github.com/SyneRBI/PETRIC-MaGeZ/blob/ALG1/main.py) developed by the MaGeZ team submitted to
+the [2024 PETRIC reconstruction challenge](https://github.com/SyneRBI/PETRIC) and


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/review/3722016888@github.com>

Edoardo Pasca

unread,
Jan 29, 2026, 6:00:59 AMJan 29
to SyneRBI/SIRF-Contribs, Subscribed

@paskino commented on this pull request.


In src/Python/sirf/contrib/MaGeZ/README.md:

> +
+## Simulation results related to 2024 PETRIC and our paper
+
+To reproduce all simulation results checkout the tag `2024_paper_simulation_results`
+and have a look at the [Readme.md in the simulation_src folder](https://github.com/SyneRBI/PETRIC-MaGeZ/blob/main/simulation_src/README.md).
+
+## Algorithms sumbitted to the 2024 PETRIC challenge
+
+**To reproduce the PETRIC results of our three submitted algorithms
+(ALG1, ALG2, ALG3), please checkout the respective tag.**
⬇️ Suggested change
-
-## Simulation results related to 2024 PETRIC and our paper
-
-To reproduce all simulation results checkout the tag `2024_paper_simulation_results`
-and have a look at the [Readme.md in the simulation_src folder](https://github.com/SyneRBI/PETRIC-MaGeZ/blob/main/simulation_src/README.md).
-
-## Algorithms sumbitted to the 2024 PETRIC challenge
-
-**To reproduce the PETRIC results of our three submitted algorithms
-(ALG1, ALG2, ALG3), please checkout the respective tag.**


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/review/3722021157@github.com>

Edoardo Pasca

unread,
Jan 29, 2026, 6:04:20 AMJan 29
to SyneRBI/SIRF-Contribs, Subscribed

@paskino commented on this pull request.


In src/Python/sirf/contrib/MaGeZ/README.md:

> +### ALG2 (ALG2 branch, ALG2 tag)
+
+Similar to ALG1 but:
+The stepsize is set to 2.2 in the first epoch, and is then computed using the Barzilai-Borwein rule as described in Algorithm 2 in [https://arxiv.org/abs/1605.04131](https://arxiv.org/abs/1605.04131),
+with m = 1 but using the short stepsize (see [https://en.wikipedia.org/wiki/Barzilai-Borwein_method]([https://en.wikipedia.org/wiki/Barzilai-Borwein_method])) adapted to preconditioned gradient ascent methods
+
+### ALG3 (ALG3 branch, ALG3 tag)
+
+Using the same setup as in ALG2 but with two minor differences.
+First, we use a slightly smaller number of subsets.
+Second, we use a non-stochastic selection of subset indices by considering the cyclic group corresponding to the given number of subsets, finding all of its generators (i.e. the set of all coprimes of the number of subsets that are smaller), and then creating indices by consider specific generators at a time.
⬇️ Suggested change
-### ALG2 (ALG2 branch, ALG2 tag)
-
-Similar to ALG1 but:
-The stepsize is set to 2.2 in the first epoch, and is then computed using the Barzilai-Borwein rule as described in Algorithm 2 in [https://arxiv.org/abs/1605.04131](https://arxiv.org/abs/1605.04131),
-with m = 1 but using the short stepsize (see [https://en.wikipedia.org/wiki/Barzilai-Borwein_method]([https://en.wikipedia.org/wiki/Barzilai-Borwein_method])) adapted to preconditioned gradient ascent methods
-
-### ALG3 (ALG3 branch, ALG3 tag)
-
-Using the same setup as in ALG2 but with two minor differences.
-First, we use a slightly smaller number of subsets.
-Second, we use a non-stochastic selection of subset indices by considering the cyclic group corresponding to the given number of subsets, finding all of its generators (i.e. the set of all coprimes of the number of subsets that are smaller), and then creating indices by consider specific generators at a time.
+### Further info on MaGeZ submission
+
+Please refer to the original repository by the MaGeZ team for further information and notes on the submitted algorithms: [ALG1](https://github.com/SyneRBI/PETRIC-MaGeZ/tree/ALG1), [ALG2](https://github.com/SyneRBI/PETRIC-MaGeZ/tree/ALG2), [ALG3](https://github.com/SyneRBI/PETRIC-MaGeZ/tree/ALG3) .


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/review/3722035190@github.com>

Edoardo Pasca

unread,
Jan 29, 2026, 6:07:14 AMJan 29
to SyneRBI/SIRF-Contribs, Subscribed

@paskino requested changes on this pull request.

A few changes for the README discussed with @KrisThielemans


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/review/3722046313@github.com>

Kris Thielemans

unread,
Jan 29, 2026, 7:03:05 AMJan 29
to SyneRBI/SIRF-Contribs, Subscribed

@KrisThielemans commented on this pull request.


In src/Python/sirf/contrib/MaGeZ/LICENSE:

> +      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]

@gschramm, last chance before we merge :-)


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/review/3722275627@github.com>

Kris Thielemans

unread,
Jan 29, 2026, 7:07:48 AMJan 29
to SyneRBI/SIRF-Contribs, Subscribed

@KrisThielemans commented on this pull request.


In src/Python/sirf/contrib/MaGeZ/README.md:

> @@ -0,0 +1,52 @@
+# MaGeZ contribution to the PETRIC reconstruction challenge
+
+This repository contains algorithms developed by the MaGeZ team submitted to
+the [2024 PETRIC reconstruction challenge](https://github.com/SyneRBI/PETRIC) and
+published in the preprint [Fast PET Reconstruction with Variance Reduction and Prior-Aware Preconditioning](https://arxiv.org/abs/2506.04976).
+
+## Authors
+
+- Matthias Ehrhardt, Univeristy of Bath, United Kingdom
⬇️ Suggested change
-- Matthias Ehrhardt, Univeristy of Bath, United Kingdom
+- Matthias Ehrhardt, University of Bath, United Kingdom


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/review/3722293913@github.com>

Kris Thielemans

unread,
Jan 29, 2026, 7:09:53 AMJan 29
to SyneRBI/SIRF-Contribs, Push

@KrisThielemans pushed 1 commit.

  • 384d5d9 Update README to make it appropriate for SIRF-Contribs


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/before/b7fe1c28abe584684ae94e8cd92292f3f05f1187/after/384d5d93d9f7b2cc1efbd8f33c5025d2613c9c9c@github.com>

Kris Thielemans

unread,
Jan 29, 2026, 7:11:27 AMJan 29
to SyneRBI/SIRF-Contribs, Subscribed

@KrisThielemans commented on this pull request.


In src/Python/sirf/contrib/MaGeZ/README.md:

> @@ -0,0 +1,35 @@
+# MaGeZ contribution to the PETRIC reconstruction challenge
+
+This repository contains the algorithm [ALG1](https://github.com/SyneRBI/PETRIC-MaGeZ/blob/ALG1/main.py) developed by the MaGeZ team submitted to
+the [2024 PETRIC reconstruction challenge](https://github.com/SyneRBI/PETRIC) (with minor edits by @paskino to reduce the use of video RAM) and
+published in [Fast PET Reconstruction with Variance Reduction and Prior-Aware Preconditioning](https://doi.org/10.3389/fnume.2025.1641215).
+
+## Authors
+
+- Matthias Ehrhardt, Univeristy of Bath, United Kingdom
+- Georg Schramm, KU Leuven, Belgium
+- Zeljko Kereta, University College London, United Kingdom
+
+
+### ALG1 (main branch, ALG1 tag)
⬇️ Suggested change
-### ALG1 (main branch, ALG1 tag)
+### ALG1 description


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/review/3722311521@github.com>

Kris Thielemans

unread,
Jan 29, 2026, 7:11:57 AMJan 29
to SyneRBI/SIRF-Contribs, Push

@KrisThielemans pushed 1 commit.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/before/384d5d93d9f7b2cc1efbd8f33c5025d2613c9c9c/after/4b2a19bb1b9fa5faf1a302204130f9b802c1b9cb@github.com>

Kris Thielemans

unread,
Jan 29, 2026, 7:13:22 AMJan 29
to SyneRBI/SIRF-Contribs, Subscribed

@KrisThielemans approved this pull request.

feel free to squash the last 2 commits (or even squash that with another appropriate commit)


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/review/3722318472@github.com>

Casper da Costa-Luis

unread,
Jan 29, 2026, 9:40:36 AMJan 29
to SyneRBI/SIRF-Contribs, Subscribed

Merged #28 into master.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/issue_event/22378962224@github.com>

Evgueni Ovtchinnikov

unread,
Feb 3, 2026, 1:06:10 PMFeb 3
to SyneRBI/SIRF-Contribs, Subscribed

@evgueni-ovtchinnikov commented on this pull request.


In src/Python/sirf/contrib/MaGeZ/main.py:

> +        self._fov_mask = data.FOV_mask
+
+        # add a small number in the adjoint ones outside the FOV to avoid NaN in division
+        self._adjoint_ones.maximum(1e-6, out=self._adjoint_ones)
+
+        # initialize list / ImageData for all subset gradients and sum of gradients
+        self._summed_subset_gradients = self.x.get_uniform_copy(0)
+        self._subset_gradients = []
+
+        self._complete_gradient_epochs = complete_gradient_epochs
+
+        self._precond_update_epochs = precond_update_epochs
+
+        # setup python re-implementation of the RDP
+        # only used to get the diagonal of the RDP Hessian for preconditioning!
+        # (diag of RDP Hessian is not available in SIRF yet)

is there a SIRF issue already to expose this?

Now there is: issue #1369, fixed by PR #1370, tested by pSTIR/tests/tests_qp_lc_rdp.py.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Contribs/pull/28/review/3746631799@github.com>

Reply all
Reply to author
Forward
0 new messages