Skip to content

ENH: Add ITK_Example_RegistrationWithCorrespondingPointsInMemory.ipynb #303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

N-Dekker
Copy link
Collaborator

@N-Dekker N-Dekker commented Sep 13, 2024

Demonstrates how to help an image registration by using a fixed and a moving set of corresponding points in memory (without file I/O).

@N-Dekker N-Dekker force-pushed the SetFixedPoints-SetMovingPoints branch from 8fda924 to 4efcdd2 Compare November 15, 2024 16:42
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@N-Dekker N-Dekker force-pushed the SetFixedPoints-SetMovingPoints branch from d884538 to 35a278e Compare November 24, 2024 12:14
@N-Dekker N-Dekker force-pushed the SetFixedPoints-SetMovingPoints branch from 35a278e to 32f8b80 Compare March 10, 2025 14:48
@N-Dekker N-Dekker force-pushed the SetFixedPoints-SetMovingPoints branch from 32f8b80 to 268a532 Compare March 18, 2025 12:43
@N-Dekker N-Dekker changed the title WIP: Do not merge! Add SetFixed/MovingPoints to ElastixRegistrationMethod ENH: Add ITK_Example_RegistrationWithCorrespondingPointsInMemory.ipynb Mar 18, 2025
@N-Dekker N-Dekker force-pushed the SetFixedPoints-SetMovingPoints branch 2 times, most recently from 3d3a493 to fcf3501 Compare March 20, 2025 17:16
@N-Dekker N-Dekker marked this pull request as ready for review March 20, 2025 17:19
@@ -0,0 +1,529 @@
{
Copy link
Member

@thewtex thewtex Mar 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #22.    # Converts an itk.Point to a tuple.

We probably want to use pointset_from_dict and itk.dict_from_pointset -- these provide simple, efficient, familiar interfaces for folks who are used to working with NumPy arrays.


Reply via ReviewNB

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Matt, maybe the use of pointset_from_dict/dict_from_pointset could be added as a follow-up.

By the way, I found Python's tuple more convenient than itk.Point, especially when creating a point "manually":

# Just works
my_point = (x, y)

# Causes errors
my_point = itk.Point[itk.D, 2](x, y)

itk.Point[itk.D, 2](x, y) caused the following errors:

TypeError: new_itkPointD2 expected at most 1 arguments, got 2
Additional information:
Wrong number or type of arguments for overloaded function 'new_itkPointD2'.
  Possible C/C++ prototypes are:
    itkPointD2::itkPointD2()
    itkPointD2::itkPointD2(double const *)
    itkPointD2::itkPointD2(double const &)
    itkPointD2::itkPointD2(std::array< double,2 > const &)
    itkPointD2::itkPointD2(itkPointD2 const &)

An extra pair of parentheses works, but it isn't particularly elegant, right?

# Extra pair of parentheses, Works!
my_point = itk.Point[itk.D, 2]((10.0, 15.0))

Is there a more convenient way to create an itk.Point? Something like itk.make_point(x, y) ???

@@ -0,0 +1,529 @@
{
Copy link
Member

@thewtex thewtex Mar 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #60.        ax.imshow(cmap="binary_r", origin="lower", X=itk.GetArrayViewFromImage(image))

itk.array_view_from_image is preferred over itk.GetArrayViewFromImage for style.


Reply via ReviewNB

Copy link
Collaborator Author

@N-Dekker N-Dekker Mar 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Should we eventually deprecate itk.GetArrayViewFromImage in favor of itk.array_view_from_image ?

Anyway, addressed by this force-push, please check!

@thewtex
Copy link
Member

thewtex commented Mar 20, 2025

Very nice, Neils! A few style-related comments inline.

Demonstrates how to help an image registration by using a fixed and a moving set
of corresponding points in memory (without file I/O).
@N-Dekker N-Dekker force-pushed the SetFixedPoints-SetMovingPoints branch from fcf3501 to 78550a1 Compare March 21, 2025 09:09
@N-Dekker N-Dekker merged commit 0e79940 into InsightSoftwareConsortium:main Mar 28, 2025
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants