Open KrisThielemans opened 4 months ago
From looking at Algorithm.py, I found out I have to do
from cil.optimisation.utilities.callbacks import Callback, ProgressCallback
Obvious? If so, sorry for the noise!
By looking at existing code (but not documentation), I was able to construct a callback that saves images
class SaveCallback(Callback):
def __init__(self, run_every=1):
super().__init__()
self.run_every = run_every
def __call__(self, algorithm):
if not hasattr(algorithm, 'saved_images'):
algorithm.saved_images = []
if (algorithm.iteration % self.run_every == 0):
algorithm.saved_images.append((algorithm.iteration, algorithm.get_output().clone()))
Seems to work ok.
Description
leads to
Is this expected?
Also, the docstring for this class gives no idea how this should work, e.g. what the signature is for the
__call__
method.