Scaling in Surface Registration

Hi
I use the following module:

Registration/ CMF Registration/ Surface Registration to register two stl models.

My understanding(after looking up the linearTransform marices) is here it only uses Rotation and Translation in calculating linearTransforms either with affine or RigidBody transforms.

but I need scaling too!

What should I do?

There are other modules for surface registration:

  • SlicerIGT extension’s Model registration module: uses ICP and supports rigid and similarity (rigid+scaling) transforms
  • SegmentRegistration extension’s Segment registration module: uses distance map based registration and supports rigid and deformable (warping) transforms. You need to import your models into segmentation node using Segmentations module (takes 3-4 mouse clicks).

Thanks for your reply. I found “Distance Map Based Registration” in Registration/Label Registration. Is this the one you referred?
I think I can not use stl files and maybe I have to use LabelMapVolume? Is there a way I can convert stl or wrl files to LabelMappVolume in Slicer?

You need “Segment registration” module (in Registration category). The module is provided by SegmentRegistration extension.

You need to import your models into segmentation node using Segmentations module (takes 3-4 mouse clicks). Then you can use Segment Registration module to register them.

1 Like

After using this module, when I go to save the files:
I have for example: PreAlignmentMoving2FixedLinearTransform_3.h file.
However, Affine Transform and Deformable Transform have status “Not Modified”

And I am not even sure if the modification that I see is results of a complete alignment or not!

Are the segments aligned before registration? Do they look aligned after the registration?

What are the next steps of your workflow? Do you want to save the transforms and/or the transformed segments? In what format (nrrd, ITK, DICOM,…)?

The segments move close to each other after registration but they are not aligned. I feel they are only rotated and translated. They are on top of each other after registration.

I need to save the transform and be able to apply it to new data. Also I want to save the transformed segments too. I prefer nrrd for now but I can also work with other formats as long as I can open them with Slicer and work with them.

It is helpful also if I have access to parameters of the Transform and Registration and can understand how parameters will affect my registration.

Thanks

To clarify my problem:

I think I don’t have scaling in my transformed model although I used segment registration module.
I think they are just pre-aligned with translation and rotation and not aligned with deformed or affine transformation.
I want to know why this happens?

Rigid registration by definition does not include scaling. Segment Registration however performs deformable registration as well, which does. You need to make sure that the deformable transform is applied on your segmentation.

It is also possible that the registration fails. If you open the Python Interactor do you see any red text in there? If so, can you please post the log? You can find it in About / Report a problem.

This is my log:

Python 2.7.13 (default, Dec 20 2017, 00:16:35)

[GCC 4.6.4] on linux2

>>>

Performing registration workflow

Cropping moving volume

Pre-aligning segmentations

Fixed segment bounds: [21.5, 87.5, 204.856399536133, 384.85639953613304, -139.567398071289, 84.432601928711]

Moving segment bounds: [18.5, 75.5, 65.85639953613301, 217.856399536133, 69.432601928711, 213.432601928711]

Moving to fixed segment translation: [7.5, 153.00000000000003, -169.0]

Resampling fixed volume

Creating contour labelmaps

Performing distance based registration

Traceback (most recent call last):

File "/home/marzieh/.config/NA-MIC/Extensions-26813/SlicerProstate/lib/Slicer-4.8/qt-scripted-modules/DistanceMapBasedRegistration.py", line 249, in onApplyButton

logic.run(self.parameterNode)

File "/home/marzieh/.config/NA-MIC/Extensions-26813/SlicerProstate/lib/Slicer-4.8/qt-scripted-modules/DistanceMapBasedRegistration.py", line 356, in run

(bbMin,bbMax) = self.getBoundingBox(fixedLabelNodeID, movingLabelNodeID)

File "/home/marzieh/.config/NA-MIC/Extensions-26813/SlicerProstate/lib/Slicer-4.8/qt-scripted-modules/DistanceMapBasedRegistration.py", line 501, in getBoundingBox

unionLabelImage = (cast.Execute(fixedLabelImage) + cast.Execute(movingLabelImage)) > 0

File "/home/marzieh/Downloads/Slicer-4.8.1-linux-amd64/lib/Python/lib/python2.7/site-packages/SimpleITK/SimpleITK.py", line 4254, in __add__

return Add( self, other )

File "/home/marzieh/Downloads/Slicer-4.8.1-linux-amd64/lib/Python/lib/python2.7/site-packages/SimpleITK/SimpleITK.py", line 11002, in Add

return _SimpleITK.Add(*args)

RuntimeError: Exception thrown in SimpleITK Add: /home/kitware/Dashboards/Package/Slicer-481-package/ITKv4/Modules/Core/Common/include/itkImageToImageFilter.hxx:241:

itk::ERROR: AddImageFilter(0x7f469c0): Inputs do not occupy the same physical space!

InputImage Origin: [-9.4500000e+01, -5.3800000e+02, -3.0900000e+02], InputImage_1 Origin: [-8.2500000e+01, -3.7100000e+02, -1.6900000e+02]

Tolerance: 1.0000000e-06

Setting up result visualization

Performing registration workflow

Cropping moving volume

Pre-aligning segmentations

Fixed segment bounds: [29.0, 95.0, 357.85639953613304, 537.856399536133, -308.567398071289, -84.567398071289]

Moving segment bounds: [26.0, 83.0, 218.85639953613304, 370.85639953613304, -99.567398071289, 44.432601928710994]

Moving to fixed segment translation: [7.5, 153.0, -169.0]

Resampling fixed volume

Creating contour labelmaps

Performing distance based registration

Traceback (most recent call last):

File "/home/marzieh/.config/NA-MIC/Extensions-26813/SlicerProstate/lib/Slicer-4.8/qt-scripted-modules/DistanceMapBasedRegistration.py", line 249, in onApplyButton

logic.run(self.parameterNode)

File "/home/marzieh/.config/NA-MIC/Extensions-26813/SlicerProstate/lib/Slicer-4.8/qt-scripted-modules/DistanceMapBasedRegistration.py", line 356, in run

(bbMin,bbMax) = self.getBoundingBox(fixedLabelNodeID, movingLabelNodeID)

File "/home/marzieh/.config/NA-MIC/Extensions-26813/SlicerProstate/lib/Slicer-4.8/qt-scripted-modules/DistanceMapBasedRegistration.py", line 501, in getBoundingBox

unionLabelImage = (cast.Execute(fixedLabelImage) + cast.Execute(movingLabelImage)) > 0

File "/home/marzieh/Downloads/Slicer-4.8.1-linux-amd64/lib/Python/lib/python2.7/site-packages/SimpleITK/SimpleITK.py", line 4254, in __add__

return Add( self, other )

File "/home/marzieh/Downloads/Slicer-4.8.1-linux-amd64/lib/Python/lib/python2.7/site-packages/SimpleITK/SimpleITK.py", line 11002, in Add

return _SimpleITK.Add(*args)

RuntimeError: Exception thrown in SimpleITK Add: /home/kitware/Dashboards/Package/Slicer-481-package/ITKv4/Modules/Core/Common/include/itkImageToImageFilter.hxx:241:

itk::ERROR: AddImageFilter(0xa6c97a0): Inputs do not occupy the same physical space!

InputImage Origin: [-1.0200000e+02, -6.9100000e+02, -4.7800000e+02], InputImage_1 Origin: [-9.0000000e+01, -5.2400000e+02, -3.3800000e+02]

Tolerance: 1.0000000e-06

Setting up result visualization