@@ -0,0 +1,1742 @@
+lignImage(static, moving, level_iters):%0A    %22%22%22The Symmetric Normalization algorithm uses a multi-resolution approach by building a Gaussian Pyramid.%0A    The static image is used a reference; a transformation that transforms the moving image into the%0A    static image is found and applied to the static image.  Returns overlay images, error image, and transformation matrix. %0A    Uses CrossCorrelation metric which makes sense for aligning AFM topography. %0A    %0A    INPUT: static and moving are both 2d arrays of the same dimension.%0A    Level_iters is a list (typically 4 entries) defines%0A    the number of iterations a user wants at each level of the pyramid, with the 0th entry referring to the %0A    finest resolution.%0A    %0A    OUTPUT: overlayimages: an image with the static, moving, and overlay images%0A            errorimage: the difference between the warped_moving image and the static reference. THe flatter %0A            the better.%0A            transformmatrix: the matrix corresponding to the forward transformation of a matrix.%22%22%22%0A    %0A    from dipy.align.imwarp import SymmetricDiffeomorphicRegistration%0A    from dipy.align.metrics import SSDMetric, CCMetric, EMMetric%0A    from dipy.viz import regtools%0A%0A    dim = static.ndim%0A    metric = CCMetric(dim)%0A    sdr = SymmetricDiffeomorphicRegistration(metric, level_iters, inv_iter = 50)%0A    mapping = sdr.optimize(static, moving)%0A    warped_moving = mapping.transform(moving, 'linear')%0A    overlayimages = regtools.overlay_images(static, warped_moving, 'Static','Overlay','Warped moving',%0A   'direct_warp_result.png')%0A    errorimage = plt.matshow(warped_moving-static, cmap='viridis')%0A    transformmatrix=mapping.forward%0A    %0A    %0A    return overlayimages, errorimage, trasnformmatrix%0A

align image in .py file. same as notebook.