Unexpected Results for "MultiResImageRegistration1.cxx."

Hello everyone!

I just started out with ITK, with base knowledge from VTK. I wanted to work through some Registration examples towards Multi-Resolution Registration.

The Hello World Registration example worked for me, so I wanted to continue with “MultiResImageRegistration1”. I simply created a new CMake Project within Visual Studio 2019 (ITK was also build with Visual Studio 2019, 64 bit in debug), copied the source code and let i compile and run afterwards without any problems. The weird thing are the results, using the simple test *.png images of the MRI brain scan.

The CheckerBoardBefore image is the following:
checkerBoardBefore

The CheckerBoardAfter and Output image are those:
checkerBoardAfter output

Why are the images speckled? I literally just copied the example Sourcecode from https://itk.org/Doxygen/html/Examples_2RegistrationITKv4_2MultiResImageRegistration1_8cxx-example.html. Is it a possible, breaking, problem that the example is targeted for ITK Version 5.3 and I am using Version 5.2.1?

I am currently using Windows 10, with Visual Studio 2019 as IDE. I configured ITK with CMake 3.16.2 and build it with Visual Studio 2019 as well. The latest Release of ITK (Version 5.2.1) was used. During the configuration I did not change any default setting except the installation prefix and the build shared libraries flag. Everything went smooth except that I encountered the Windows specific “path too long” problem which was obviously easy to fix.

I would be grateful for any suggestion.
Thank you in advance!

That example uses casting from float to uchar pixels. That causes intensity wrap-around. If you replace cast by rescale, the results should be sane. Or if you started with images which have pixel intensities in 0-255 range. If you update the example to work correctly, submitting a PR with the fix would be highly appreciated.

2 Likes

Thank you for the response. I checked the intensity values of the used images with ITK-Snap. They appear to be within the 0-255 range.
But i will test for the rescale approach you suggested. Thank you very much so far.

Edit: Changing the Cast to Rescale definitely resolved the issues of speckles in the images. Thank you very much again.

2 Likes