/CC @gschramm
https://github.com/SyneRBI/SIRF-Contribs/pull/28
(5 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@casperdcl pushed 2 commits.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@casperdcl pushed 2 commits.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@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.![]()
@casperdcl pushed 2 commits.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@casperdcl pushed 2 commits.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@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.![]()
@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.![]()
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.![]()
@casperdcl pushed 55 commits.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@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.![]()
@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.![]()
@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.![]()
@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.![]()
@casperdcl pushed 2 commits.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@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).
-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.![]()
> @@ -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.![]()
> +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.![]()
> + +## 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.![]()
> +### 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.![]()
@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.![]()
@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.![]()
@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.![]()
@KrisThielemans pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
> @@ -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.![]()
@KrisThielemans pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@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.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@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.![]()