Visualizing the Registration Progress

Hey,

The Image Registration Workflow is getting significant feedback from the DIPY developer community. The reviews have proved useful for both the code quality and semantics of the code.

While I am constantly improving the code and updating the PR with the new commits, I thought that it will be worthwhile to give a sneak peek into the intuitive visualization that can be achieved with the VTK modules in DIPY.

So, we know that a given pair of images can be registered in primarily four modes, more details about these and how to perform each registration can be seen in my earlier post on the following link,

Testing and benchmarking the Image Registration with DIPY

Today, I will be sharing results about the powerful visualization(s) that can be generated with DIPY for interpreting the results in an intuitive manner.

Comparative assessment of the results generated by various modes of registration

To compare and assess the quality of image registration relatively for different modes, a mosaic is generated for the registered image to show the progress of the registration process. This also helps in comparing the various modes with each other. As will be evident in the later sections of the post, affine registration results in the best possible overlap between the images.

Experiment-1 on forked repository: Creating Overlaying Images

Experiment-2 on forked repository: Creating a mosaic of the registered image

A) Visualising the Mosaic of the Registered Images (Translation based):

The given mosaic is currently displaying all the slices of the registered image. The registered image is produced by using Translations based registration.

A mosaic displaying all the slices of the registered image data. RED: Static Image, GREEN: Moving Image. A proportion of YELLOW shows the areas where the overlap is very good.

As can be seen from the above mosaic, as the slices are displayed progressively from (left-right, top-bottom), the proportion of red and green are overlapping and it increases towards the end of the slices.

This depicts the progress of the registration process as the two images are being aligned in a common space.

B) Visualising the Mosaic of the Registered Images (Rigid body based)

The rigid body registration was done in a progressive manner, meaning that it uses the affine matrix obtained from the translation in step-(A) above. Below mosaic shows, the progress of the rigid registration process and highlights how the two images are being aligned as the color channels overlap with each other.

A mosaic displaying all the slices of the registered image data. RED: Static Image, GREEN: Moving Image. A proportion of YELLOW shows the areas where the overlap is very good.

C) Visualising the Mosaic of the Registered Images (Affine registration based)

The best possible results are obtained with the affine registration mode done in a progressive manner. The below mosaic displays the progress of the registration process as the alignment proceeds and the images are aligned.

Important to note is how in the starting there is only RED and then increasingly the GREEN is introduced in the mosaic which means that the moving image is being bought into the common alignment space. Eventually, the moving image is superimposed on top of the static image.

A mosaic displaying all the slices of the registered image data. RED: Static Image, GREEN: Moving Image. A proportion of YELLOW shows the areas where the overlap is very good.

Mosaic for a relatively larger MRI data

The following mosaic has been created for a different brain image, these are relatively bigger as compared to the earlier data. This can also be noticed from the number of tiles in the mosaic present in the following image.

Visualising the mosaic of the images from two different runs of the same brain MRI.

Notice the varying hue of YELLOW in this image, this indicates the varying degree of superimposition of the voxels between the static and the moving images. The ‘YELLO‘ is also present in the previous mosaic’s but its intensity is relatively poor and that renders the difference between the images hard to comprehend. I am still working on improving the visual quality of these mosaics so that the differences can be made more apparent.

Here is how the different channels are created for the above images.

# Normalize the input images to [0,255]
static_img = 255 * ((static_img - static_img.min()) / (static_img.max() - static_img.min()))
moved_img = 255 * ((moved_img - moved_img.min()) / (moved_img.max() - moved_img.min()))

# Create the color images
overlay = np.zeros(shape=(static_img.shape) + (3,), dtype=np.uint8)

# Copy the normalized intensities into the appropriate channels of the
# color images
overlay[..., 0] = static_img
overlay[..., 1] = moved_img

The overlay contains both the RED and the GREEN channels and is being used afterward to extract the slices out for creating the mosaic.

List of PR’s that are now merged with the code base

Some of my earlier PR’s that I created are now merged with the DIPY code base and are available below for review and further comments,

Showing help when no input parameter is present

Updating the default output strategy

Next blog posts will present more details about the new methods of visualization and optimized code for the Image registration, hopefully, the Image Registration Workflow will be merged with the master codebase by then. 🙂

Adios for now,

Parichit

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *