In [1]:
%matplotlib inline
In [2]:
from ndreg import *
First we read our images. This one is a sparse image
In [3]:
sparseImg = sitk.Cast(imgRead("../dat/sparse/sparse.img"), sitk.sitkFloat32)
imgShow(sparseImg)
This image is a dense image
In [4]:
denseImg = sitk.Cast(imgRead("../dat/sparse/dense.img"), sitk.sitkFloat32)
imgShow(denseImg)
Here's the difference between the 2 images before registration
In [5]:
imgShow(sparseImg - denseImg, cmap=plt.cm.jet)
In [6]:
alpha=0.1
epsilon = None
(field, invField) = imgMetamorphosis(sparseImg, denseImg, alpha=alpha, epsilon=epsilon, verbose=True)
outSparseImg = imgApplyField(sparseImg, field)
imgShow(outSparseImg)
We evaluate the registration using the difference between the deformed sparse image and dense image
In [7]:
imgShow(outSparseImg - denseImg, cmap=plt.cm.jet)
In [8]:
(field, invField) = imgMetamorphosis(denseImg, sparseImg, alpha=alpha, verbose=True)
outDenseImg = imgApplyField(denseImg, field)
imgShow(outDenseImg)
We evaluate the registration using the difference between the sparse image and deformed dense image
In [9]:
imgShow(sparseImg - outDenseImg, cmap=plt.cm.jet)
In [ ]: