Skip to content
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

ENH: Add ipynb examples Transformix, image, mesh, TranslationTransform #175

Conversation

N-Dekker
Copy link
Collaborator

@N-Dekker N-Dekker commented Nov 3, 2022

Added examples on how to use recently added TransformixFilter member functions, SetTransform, SetInputMesh, and GetOutputMesh.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

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

Choose a reason for hiding this comment

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

Line #9.        print()

Nice.

A possible shortcut here:

import numpy as np

print(np.asarray(image))



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 @thewtex I just replaced my little hand-written "print_image" helper by your suggested print(np.asarray(image)). Much better 👍

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

Choose a reason for hiding this comment

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

Line #27.            moving_image.SetPixel([column, row], pixel_value)

Possible shortcut (untested), something like:

moving_image[:] = np.arange(len(itk.array_view_from_image(moving_image))

Reply via ReviewNB

@thewtex
Copy link
Member

thewtex commented Nov 3, 2022

Cool @N-Dekker !

@N-Dekker
Copy link
Collaborator Author

N-Dekker commented Nov 3, 2022

Thanks for your comments so for @thewtex After the weekend, I think I'll have time to try out your numpy based suggestions. Interesting!

I'm not very experienced with Jupyter Notebook, so I'm very interested to hear any more suggestions. Are the two examples I'm proposing here clear enough?

@thewtex
Copy link
Member

thewtex commented Nov 3, 2022

@N-Dekker looking awesome! The examples are nice and clear. It may help to "tell a story" by breaking up the code into more cells and viewing intermediate output, maybe add some Markdown cells that explain what is going on.

@N-Dekker N-Dekker force-pushed the ITK_Example_Transformix_Translation branch from 2aabcf5 to db606f8 Compare November 7, 2022 11:29
@N-Dekker
Copy link
Collaborator Author

N-Dekker commented Nov 7, 2022

It may help to "tell a story" by breaking up the code into more cells and viewing intermediate output, maybe add some Markdown cells that explain what is going on.

Thanks @thewtex, I included this suggestion with the latest force-push, please check!

@N-Dekker N-Dekker requested a review from ViktorvdValk November 7, 2022 11:38
@N-Dekker N-Dekker force-pushed the ITK_Example_Transformix_Translation branch 2 times, most recently from df7c3e2 to 35165f2 Compare November 8, 2022 13:56
Added examples on how to use recently added TransformixFilter member functions,
`SetTransform`, `SetInputMesh`, and `GetOutputMesh`.

With help from Matt McCormick and Konstantinos Ntatsis.
@N-Dekker N-Dekker force-pushed the ITK_Example_Transformix_Translation branch from 35165f2 to 8353a74 Compare November 8, 2022 16:31
@N-Dekker N-Dekker marked this pull request as ready for review November 8, 2022 17:01
Copy link
Collaborator

@ViktorvdValk ViktorvdValk left a comment

Choose a reason for hiding this comment

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

Looks good to me!

"\n",
"print('Output image:')\n",
"print(np.asarray(output_image))\n",
"print()"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where is this print command for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

print() just prints a line-break. But I guess I could have done print(np.asarray(output_image), "\n"), instead of line 148-149.

@N-Dekker
Copy link
Collaborator Author

python-build-workflow / build-macos-python-packages says:

##[error]The operation was canceled

@thewtex
Copy link
Member

thewtex commented Nov 14, 2022

##[error]The operation was canceled

I restarted the failed jobs.

Copy link
Member

@thewtex thewtex left a comment

Choose a reason for hiding this comment

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

@N-Dekker looks great!! 🥇

@thewtex thewtex merged commit 0508675 into InsightSoftwareConsortium:main Nov 29, 2022
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