Simple image registration

(Ankita Tiwari) #23

Sir, I want to know whether it is possible to register our own image rather than dicom images by changing the names of images in RegistrationITKv4 program. If it is possible then what properties does a image need (like.jpg format etc)?

(Dženan Zukić) #24

Since DICOM is handled specially, you need to pick another example which takes ordinary images. Ordinary images can be .png, .bmp etc. See list of supported formats.

(Ankita Tiwari) #25

Sir, what changes should I make in program to execute it successfully? Do I need to edit my image name in place of moved image and fixed image or anything else to be done for execution.

(Dženan Zukić) #26

You could use this example. Input images can be in .png, .bmp, .jpg, .nnrd, .mha etc and even in one-slice DICOM format.

(Ankita Tiwari) #27

Sir I am facing this error after I add moving image and fixed image in coomand promp.

(Dženan Zukić) #28

Can you share your bottle01.png and bottle02.png?

(Ankita Tiwari) #29


(Dženan Zukić) #30

On my computer it runs without crashing. Here is the after-checkerboard:
Here are my command-line parameters: C:/Bottle01.png C:/Bottle02.png C:/BottleReg.png C:/BottleBefore.png C:/BottleAfter.png. But this is a horrible registration.

Since the image also includes rotation (and perhaps some scaling?) you should try using 2D rigid or 2D similarity transform instead of 2D translation transform. Example ImageRegistration7.cxx already uses similarity, while ImageRegistration5.cxx and ImageRegistration6.cxx use rigid. On this page you can find more information about included examples. Here is the registered output of ImageRegistration7:

Edit Here is the final output of ImageRegistration7:

498   708.652   [1.0335462012447618, 0.39856625992491423, 190.80755526644373, 233.46134165434157, -0.4572761665491416, 17.556286207548332]
499   711.099   [1.03355770147716, 0.4015412995014569, 190.8074655588225, 233.46228544143096, -0.4549818569254195, 17.556781342023257]
Optimizer stop condition: RegularStepGradientDescentOptimizerv4: Maximum number of iterations (500) exceeded.

Result =
 Scale         = 1.03356
 Angle (radians) 0.401541
 Angle (degrees) 23.0066
 Center X      = 190.807
 Center Y      = 233.462
 Translation X = -0.454982
 Translation Y = 17.5568
 Iterations    = 500
 Metric value  = 711.099
Press any key to continue . . .

(Ankita Tiwari) #31

Sir I want to overlap 2 images of bottle01.png and bottle02.png and find out what changes has been occured in it. So how can I do this using ITK software.

(Dženan Zukić) #32

After registration just subtracting the images will give you a difference image, which is easy. But then interpreting that difference image is the hard part. And what kind of changes are you trying to detect? “bottle has moved 7 cm to the right”, “bottle cap missing”, “no bottle in the image”, “amount of liquid in the bottle has decreased 7%”. These are all very different things, most of them very hard to do, and all of them requiring at least somewhat different approaches.

(Ankita Tiwari) #33

Yes sir I am trying to find these changes. What are the steps to do so?

(Dženan Zukić) #34

That is what I am trying to tell you: that problem has not been solved yet so I don’t know the steps.

(Ankita Tiwari) #35

Okay sir but how to subtract an image and see the difference?

(Dženan Zukić) #36

ImageRegistration7.cxx already calculates the difference image and writes it to disk if enough filenames are given.

(Ankita Tiwari) #37

sir to find out the difference in image from ImageRegistration7.cxx, we need to enter steplength initialscaling initialangle. What values should I enter in it??

(Dženan Zukić) #38

Those three parameters are optional. Just don’t put them on the command line, the file names are enough. Their default values are good enough.

(Ankita Tiwari) #39

Sir I want to make GUI-interface software. In which I have to include all the libraries of ITK. I have to make 2buttons of input images and after running it should automatically register as we see it in ITk software. Sir will you please help me in this.

(Dženan Zukić) #40

How about starting from an existing example? Quick Google search gives this, this, this and this.

(Ibraheem) #41

I would use Slicer is it is very simple to create a plugin that takes the input, process it using itk e.g. calling the binaries from python then load and visualize the output.

If you want a stand alone, here is a more recent example that combines QT, VTK and ITK.