SimpleElastix icon indicating copy to clipboard operation
SimpleElastix copied to clipboard

Plot metric values after each iteration

Open AmericaBG opened this issue 4 years ago • 1 comments

Hi! I would like to plot the metric value after each iteration to check that my registration converges.

Could you say me how to do that? In Elastix documentation, I have seen some class and parameters [https://elastix.lumc.nl/doxygen/classelastix_1_1MetricBase.html] but I don't know how to apply them in Python with simpleElastix.

Thank you very much in advance!

AmericaBG avatar Sep 16 '20 15:09 AmericaBG

Hi, You can switch on output of the iteration log file for this:

SimpleElastix.SetParameter("WriteIterationInfo",["true"]) and then

td = tempfile.mkdtemp() SimpleElastix.SetOutputDirectory(td)

.. execute registration ....

then

xfms = sorted(glob.glob(os.path.join(td, 'TransformParameters..R'))) dbg_xfms = dict([ (os.path.basename(k),sitk.ReadParameterFile(k)) for k in xfms])

Then parse the dbg_xfms as you see fit.

Soren

On Wed, Sep 16, 2020 at 5:34 PM América Bueno Gómez < [email protected]> wrote:

Hi! I would like to plot the metric value after each iteration to check that my registration converges.

Could you say me how to do that? In Elastix documentation, I have seen some class and parameters ([ https://elastix.lumc.nl/doxygen/classelastix_1_1MetricBase.html]) but I don't know how to apply them in Python with simpleElastix.

Thank you very much in advance!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SuperElastix/SimpleElastix/issues/391, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHBDDIZAE3GYVILKAIB6F3SGDLGRANCNFSM4RPAPVZQ .

sorenchr2011 avatar Sep 17 '20 13:09 sorenchr2011