Commit b235e4ad authored by Sean Fitzgibbon's avatar Sean Fitzgibbon
Browse files

Added alignment plot to slide_reg

parent c51b8c53
......@@ -363,6 +363,31 @@ def initialise_transformations(fixed, p):
# Return the full transformation chain
return Chain(*linear_chain, tx_nonlinear)
#TODO: This will fail if one of the registration steps was skipped. FIX it
def _plot_alignment(d):
fixed = plt.imread(f'{d}/fixed.png')
moving = ['rotation', 'rigid', 'affine', 'nonlinear']
N = len(moving)
fig, ax = plt.subplots(1, N, figsize=(N*5, 5))
for idx, (m0, ax0) in enumerate(zip(moving, ax)):
img = plt.imread(f'{d}/moving{idx+1}_{m0}.png')
ax0.imshow(fixed, cmap='Greys_r')
ax0.imshow(img, alpha=0.5, cmap='Reds_r')
ax0.set_title(m0.title())
ax0.axes.xaxis.set_visible(False)
ax0.axes.yaxis.set_visible(False)
plt.tight_layout()
fig.savefig(f'{d}/alignment.png', dpi=150)
def register(fixed, moving, cnf):
"""
......@@ -464,6 +489,8 @@ def register(fixed, moving, cnf):
else:
logger.info("Non-linear registration was skipped.")
_plot_alignment(p.general.outputdir)
def rotation_search2d(fixed, moving, cnf):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment