question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The result is the same with and without pointset

See original GitHub issue

Hello ITKElastix team,

Thank you very much for your useful library. I want to try the 3D mask registration based on 4 points. My code is as follows. But when I try with and without a pointset, the output is the same.

for m in a:
    for n in b:
        fixed_image = itk.imread(f'mask_prepration_registration_corect/image{m}.nii.gz', itk.F)
        moving_image = itk.imread(f'mask_prepration_registration_corect/image{n}.nii.gz', itk.F)

        moving_mask = itk.imread(f'mask_prepration_registration_corect/mask{n}.nii.gz', itk.F)
        parameter_object = itk.ParameterObject.New()
        parameter_map_rigid = parameter_object.GetDefaultParameterMap('rigid')
        parameter_object.AddParameterMap(parameter_map_rigid)
        parameter_map_affine = parameter_object.GetDefaultParameterMap('affine')
        parameter_object.AddParameterMap(parameter_map_affine)
        parameter_map_bspline = parameter_object.GetDefaultParameterMap('bspline')
        parameter_object.AddParameterMap(parameter_map_bspline)

        result_image, result_transform_parameters = itk.elastix_registration_method(
            fixed_image, moving_image,
            fixed_point_set_file_name=f'data/landmarks/targets{m}.txt',
            moving_point_set_file_name=f'data/landmarks/targets{n}.txt',
            parameter_object=parameter_object,
            log_to_console=False)

        result_transform_parameters.SetParameter('FinalBSplineInterpolationOrder', '0')
        result_moving_mask = itk.transformix_filter(moving_mask, result_transform_parameters)

        itk.imwrite(result_moving_mask, f'masks_registration_result/{m}/reg_{m}_{n}.nii.gz')

Where is my solution wrong?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
sepidehamiricommented, Mar 23, 2022

I believe you have to specify registration parameters that include point based metrics.

Developer docs on the metric: https://elastix.lumc.nl/doxygen/classelastix_1_1CorrespondingPointsEuclideanDistanceMetric.html

This link has some info and code from simpleelastix which is, N.B., not fully transferable but the principle is the same: https://simpleelastix.readthedocs.io/PointBasedRegistration.html

A good strategy may be to make to make two rigid parameter maps, the first with the corresponding points distance metric, and the second without. This workflow assumes your first rigid will use the corresponding points, find a good registration, then proceed with fully automatic approaches.

Heath

I added the following line and the problem was solved! Thank you very much for your help.

        parameter_map_rigid['Metric'] = [original_metric[0],
                                         'CorrespondingPointsEuclideanDistanceMetric']
0reactions
sepidehamiricommented, Mar 23, 2022

Indeed, example 5 shows how to create a parameter map with the correct metrics in this case. Keep in mind that example 5 shows how to use a point set to help the registration of images, and example 9 shows how to transform the point sets.

You were absolutely right. I didn’t notice this difference.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with RESULTSETs - Snowflake Documentation
In Snowflake Scripting, a RESULTSET is a SQL data type that points to the result set of a query. Because a RESULTSET is...
Read more >
Difference-in-Difference Estimation | Columbia Public Health
The Difference-in-Difference estimation is a longitudinal study and is also ... (allocation of intervention was not determined by outcome).
Read more >
4.4.3 Calculating the mode - Statistique Canada
There is no mode when all observed values appear the same number of times ... the results of Number of games by the...
Read more >
Points, Lines, and Planes - Geometry - Cliffs Notes
Points that lie on the same line are called collinear points. If there is no line on which all of the points lie,...
Read more >
What are (discount) points and lender credits and how do they ...
Some lenders may use the word “points” to refer to any upfront fee that is calculated as a percentage of your loan amount,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found