# Registration 2 images visualisation error?

**URL:** <https://discourse.slicer.org/t/registration-2-images-visualisation-error/3961>\
**Category:** Support\
**Created:** [August 31, 2018, 6:33pm UTC](https://discourse.slicer.org/t/registration-2-images-visualisation-error/3961 "2018-08-31T18:33:43Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laura](https://avatars.discourse-cdn.com/v4/letter/l/a4c791/32.png) [@Laura](https://discourse.slicer.org/u/Laura)\
**Post date:** [August 31, 2018, 6:33pm UTC](https://discourse.slicer.org/t/registration-2-images-visualisation-error/3961/1 "2018-08-31T18:33:43Z")

</div>

Good evening,

On the Elastix General Registration Module (on MacOS), I am doing a generic rigid preset.  
However, when I superimpose the 2 images (the one “fixed” and the one “resampled, after the registration”, I have this result visually :  
 ![11](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/5/f5dadf573cfb4bbf162a8bc75884a5c7e1b89ea5.png)

Can you tell me why have I this visualisation ?  
Is it wrong or right ?  
I have checked on Data module and these two images have the same dimensions and spacing.

Maybe do I have to find a way to do a ICP registration instead ?  
I don’t know what to do…

Thanks a lot in advance  
Have a good weekend  
Laura

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 31, 2018, 6:44pm UTC](https://discourse.slicer.org/t/registration-2-images-visualisation-error/3961/2 "2018-08-31T18:44:28Z")

</div>

Fixed image should be aligned well with the computed output image, so the result that you show does not look right.

Do you try to register 2D (single-slice 3D) images?  
Are they binary (black-and-white only) images?

---

<div class="post-metadata">

**Author:** ![Laura](https://avatars.discourse-cdn.com/v4/letter/l/a4c791/32.png) [@Laura](https://discourse.slicer.org/u/Laura)\
**Post date:** [August 31, 2018, 6:48pm UTC](https://discourse.slicer.org/t/registration-2-images-visualisation-error/3961/3 "2018-08-31T18:48:53Z")

</div>

The images (fixed and moving) are both nifti files that I have saved before after doing segmentations so they are in 3D. Do you think that this is the problem ?  
The moving one is binary and the fixed one has been created from volume clip with model so I don’t really know if it is binary volume…how can I check that ?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 31, 2018, 6:55pm UTC](https://discourse.slicer.org/t/registration-2-images-visualisation-error/3961/4 "2018-08-31T18:55:43Z")

</div>

These are binary volumes. Intensity-based registration methods cannot be effectively applied to binary images.

One option is to apply distance transform to them and then use intensity-based registration. This approach is implemented in Segment Registration extension. I would recommend to import your images into segmentation node (convert to labelmap node in Volumes module, if you forgot to click “labelmap” option when loaded the binary volumes) and use Segment Registration module to register them.

---

<div class="post-metadata">

**Author:** ![Laura](https://avatars.discourse-cdn.com/v4/letter/l/a4c791/32.png) [@Laura](https://discourse.slicer.org/u/Laura)\
**Post date:** [August 31, 2018, 7:13pm UTC](https://discourse.slicer.org/t/registration-2-images-visualisation-error/3961/5 "2018-08-31T19:13:00Z")

</div>

I am so sorry but I think that I have misunderstood something…

I have done this :

- Load file1(fixed) and file2 (moving)

- On Volumes, create label map of these 2 files

- on Segment registration,  
Fixed image = file1  
Moving image = file2  
Perform registration

- Then, I have a new file called “file1\_Resampled\_1x1x1mm”

- On General Registration Elastix,  
fixed volume = file1\_Resampled\_1x1x1mm  
moving volume = file2  
Preset = generic rigid  
Output volume : Create new volume  
Apply

- The result of the superimpose is :  
Foreground = new volume created  
Background = file1\_Resampled\_1x1x1mm  
Result =  
 ![22](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/1/61c6e6b3c7945dc6f75634f9ea3aae62b3a677f0.png)

I can’t understand…  
Thanks a lot for your help !  
Laura

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [August 31, 2018, 7:34pm UTC](https://discourse.slicer.org/t/registration-2-images-visualisation-error/3961/6 "2018-08-31T19:34:33Z")

</div>

In Segment Registration you cannot select labelmaps as inputs, only segmentations, and you’re not mentioning that you imported file1 and 2 to segmentation nodes. Are you sure you’re using the module called “Segment Registration”?

---

<div class="post-metadata">

**Author:** ![Laura](https://avatars.discourse-cdn.com/v4/letter/l/a4c791/32.png) [@Laura](https://discourse.slicer.org/u/Laura)\
**Post date:** [August 31, 2018, 7:41pm UTC](https://discourse.slicer.org/t/registration-2-images-visualisation-error/3961/7 "2018-08-31T19:41:14Z")

</div>

OH ! I have forgotten to convert label map to segment nodes !!!

---

<div class="post-metadata">

**Author:** ![Laura](https://avatars.discourse-cdn.com/v4/letter/l/a4c791/32.png) [@Laura](https://discourse.slicer.org/u/Laura)\
**Post date:** [August 31, 2018, 8:02pm UTC](https://discourse.slicer.org/t/registration-2-images-visualisation-error/3961/8 "2018-08-31T20:02:24Z")

</div>

Unfortunately…  
I am so sorry but I think that I have again misunderstood something…

I have done this :

- Load file1(fixed) and file2 (moving)

- On Volumes, create label map of these 2 files (file1\_label and file2\_label)

- on Segmentations :  
Segmentation : segmentation  
Export label map : file1\_label  
Segmentation : segmentation\_1  
Export label map : file2\_label

- on Segment registration,  
Fixed image = file1  
Fixed segmentation = segmentation  
Fixed segment : file1\_label

Moving image = file2  
Moving segmentation = segmentation\_1  
Moving segment : file2\_label  
Perform registration

- Then, I have a new file called “file2 cropped”

- On General Registration Elastix,  
fixed volume = file1  
moving volume = file2 cropped  
Preset = generic rigid  
Output volume : Create new volume  
Apply

- The result of the superimpose is :  
Foreground = new volume created  
Background = file1  
Result = ![03](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/5/75c5c0546999885b7af1103ea8ff4ad7d5ce8e5f.png)

I can’t understand…  
Thanks a lot for your help !  
Laura

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [August 31, 2018, 8:17pm UTC](https://discourse.slicer.org/t/registration-2-images-visualisation-error/3961/9 "2018-08-31T20:17:01Z")

</div>

What is the “On General Registration Elastix” part? If you use Segment Registration then what it does is registration.

Are there any errors after the Segment Registration step in the log? See About / Report an error

---

<div class="post-metadata">

**Author:** ![Laura](https://avatars.discourse-cdn.com/v4/letter/l/a4c791/32.png) [@Laura](https://discourse.slicer.org/u/Laura)\
**Post date:** [August 31, 2018, 8:20pm UTC](https://discourse.slicer.org/t/registration-2-images-visualisation-error/3961/10 "2018-08-31T20:20:35Z")

</div>

Oh so I don’t need to go on Elastix general registration !!!  
Just stop after my “file2 cropped” and superimpose this one with my file1 !!!  
So many thanks ! and so sorry for not having understood before !!!
