-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SPDHG algorithm from CIL #238
Conversation
added: copy, conjugate closes Hackathon-SIRF/#7
notice that it's not taking into consideration SyneRBI/Hackathon-SIRF#2 (comment)
for MR images dot operator calculates the inner product with conjugate by itself.
changed AcquisitionModel to inherit from object.
closes #7
fixes an assertion error
…ckathon-SIRF into convert_spdhg_to_cil
The PR looks good to me. A general question here is where in STIR/SIRF should all this code go? I.e. the algorithm Also there are a few "hacks" to quickly code things up in examples/Python/PET/interactive/spdhgutils.py like the |
import pSTIR as pet | ||
from ccpi.optimisation.spdhg import spdhg | ||
from ccpi.optimisation.spdhg import KullbackLeibler | ||
from ccpi.optimisation.spdhg import KullbackLeiblerConvexConjugate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The KullbackLeiblerConvexConjugate
is not needed here. It is been used implicitly through KullbackLeibler
.
@@ -1202,6 +1212,10 @@ def backward(self, ad): | |||
(self.handle, ad.handle) | |||
check_status(image.handle) | |||
return image | |||
def direct(self, image): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does CoilImageData
have a method direct
? This is unintuitive to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about adjoint
? Should it be there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I don't know. To me this is a data object and not an operator. So it should neither have direct
, forward
nor adjoint
. But it could be that I did not see any specific CCP-PETMR point of view on this. @KrisThielemans ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree with Matthias - this class should have neither direct nor adjoint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm quite confused about this. The line where this comment is pinned to (here is part of AcquisitionModel
. CoilImageData
doesn't have forward/direct/backward/adjoint
in this PR, as it should be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. A made a few small comments separately from the review.
|
||
|
||
def PowerMethodNonsquare(op, numiters, x0=None): | ||
# Initialise random |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better remove all the comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs more comments on what's going on I'm afraid.
@@ -130,6 +130,10 @@ def main(): | |||
print('norm of image*10: %f' % image.norm()) | |||
diff = image.clone() - image | |||
print('norm of image.clone() - image: %f' % diff.norm()) | |||
|
|||
# test clone vs copy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a test. should it be in an example? I'd rather put it in a test
g_noreg = ZeroFun() | ||
|
||
|
||
g_reg = FGP_TV_SIRF(lambdaReg=.3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some doc please what this does
# Author: Matthias J Ehrhardt, Edoardo Pasca | ||
# | ||
## CCP PETMR Synergistic Image Reconstruction Framework (SIRF) | ||
## Copyright 2015 - 2018 Rutherford Appleton Laboratory STFC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will need some change!
STIR.py: adds: * get_background_term * saves background term in self.bt member of AcquisitionModel * get_linear_acquisition_model * direct * adjoint * is_linear * is_affine addresses #237 (comment)
added get_constant_term added get_additive_term PET acquisition model that relates an image x to the acquisition data y as (F) y = [1/n] (G x + [a]) + [b] where: G is the geometric (ray tracing) projector from the image voxels to the scanner's pairs of detectors (bins); a and b are otional additive and background terms representing the effects of noise and scattering; Returns [a] + [b]
added copy method to SIRF.DatContainer class
Adds an example on using the SPDHG algorithm with OS from CIL
Requires SyneRBI/Hackathon-SIRF-SuperBuild#1 which I am going to port from the hackathon repo to this.