Closed paskino closed 5 years ago
x_CIL is zero
This is fixed by https://github.com/vais-ral/CCPi-Regularisation-Toolkit/pull/62
And additionally by https://github.com/vais-ral/CCPi-Framework/pull/152 for Python 2.7
x_SIRF = image
is fixed by correcting the use of super
class FGP_TV_SIRF(FGP_TV):
def prox(self, x, sigma):
out = super(FGP_TV_SIRF, self).prox(x, sigma)
y = x.copy()
y.fill(out.as_array())
return y
In the previous implementation the class wasn't doing what expected and described in the issue.
I'm still puzzled that it didn't get into a recursion loop yielding a RuntimeError: maximum recursion depth exceeded
This is interesting. Before with out = super(FGP_TV, self).prox(x, sigma)
we called the parent of FGP_TV
which is Function
and we were surprised about its behavior. This actually reveals dangerous coding currently being done in https://github.com/vais-ral/CCPi-Framework/blob/master/Wrappers/Python/ccpi/optimisation/funcs.py where the prox
(and other functions) has a default behavior that makes no sense for a generic Function
. Perhaps instead of doing the "identity", it should throw an error as one should not be allowed to call this if not overwritten.
From @mehrhardt
Below it follows a full example, but before a little explanation:
To access the CCPi regularisers within the CCPi-Framework for optimisation and image reconstruction, we wrap the regularisers in so-called plugins. Although, this structure seems a bit involved, it allows to keep the regularisers and the CCPi-Framework independent. In particular, the regularisers work on numpy arrays without any notion of
ImageData
orDataContainer
.The role of the plugin is, therefore, to get a
DataContainer
or sibling and pass the relevant data to the regulariser and return the appropriateDataContainer
.However, the CCPi-FrameworkPlugins for the regularisers are CCPi-Framework specific so they cannot be simply used with SIRF
DataContainer
s. @paskino proposed a trick to do this. One would create a classFGP_TV_SIRF
inheriting from the CCPi pluginFGP_TV
, call theprox
method of the parent class of the plugin, i.e.FGP_TV
which extracts the data from theDataContainer
with theas_array()
method'; get the result and put it back into a proper SIRFDataContainer
:Full example which fails.