Skip to content

Downsample register example #342

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

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Conversation

thewtex
Copy link
Member

@thewtex thewtex commented May 16, 2025

No description provided.

@thewtex
Copy link
Member Author

thewtex commented May 16, 2025

@N-Dekker WIP for #341 but reviews welcome!

@thewtex thewtex requested a review from N-Dekker May 16, 2025 16:59
Note: we support std::variant for the ValueVector to support, for
example, the actual boolean or number types being specified in python or
typescript.
@thewtex thewtex force-pushed the downsample-register-example branch from 1fb071f to fc0c7cb Compare May 16, 2025 17:18
thewtex added 3 commits May 16, 2025 13:48
More efficient and enables use in bindings.
More efficient, enables bindings, and improves wasm module size.
@thewtex thewtex force-pushed the downsample-register-example branch 3 times, most recently from aee7c1e to f5f8aff Compare May 16, 2025 20:05
import { downwsampleNode } from "@itk-wasm/downsample";
import { elastixNode } from "@itk-wasm/elastix";

const fixedImageFile =
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just for my understanding (as I don't know MJS) what does it mean to do const fixedImageFile = without an expression at the right-hand-side?

Copy link
Member Author

Choose a reason for hiding this comment

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

This file is incomplete :-)

Copy link
Collaborator

Choose a reason for hiding this comment

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

My very first micro-contribution to this PR 😸

@thewtex
Copy link
Member Author

thewtex commented May 19, 2025

We still have the issue:

ENH: Add transformix wasm pipeline
Resamples the input with the transform.

The test fails with:

7: itk::ExceptionObject (0x5c4199ce1e70)
7: Location: "unknown"
7: File: /home/matt/bin/ITKElastix-GCC-Release/_deps/elx-src/Core/Main/itkTransformixFilter.hxx
7: Line: 377
7: Description: ITK ERROR: No entry Spacing found in transformParameterMap

Should we be adding the output spacing as a parameter?

@N-Dekker
Copy link
Collaborator

We still have the issue:

ENH: Add transformix wasm pipeline
Resamples the input with the transform.

The test fails with:

7: itk::ExceptionObject (0x5c4199ce1e70)
7: Location: "unknown"
7: File: /home/matt/bin/ITKElastix-GCC-Release/_deps/elx-src/Core/Main/itkTransformixFilter.hxx
7: Line: 377
7: Description: ITK ERROR: No entry Spacing found in transformParameterMap

Should we be adding the output spacing as a parameter?

Just checked: "Spacing" should indeed specify the spacing of the output image.

I think the idea is that it important that users explicitly specify the spacing, rather than leave it (1, 1, 1), for example, because for realistic images, it is very relevant. Right, Stefan and Marius (@stefanklein, @mstaring)?

* @param parameterObject Pointer to the elastix::ParameterObject to populate
* @return std::string Error message if reading the parameter object fails, empty string otherwise.
*/
std::string readParameterObject(const std::string & parameterObjectJson, elastix::ParameterObject * parameterObject)
Copy link
Collaborator

@N-Dekker N-Dekker May 20, 2025

Choose a reason for hiding this comment

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

Micro-nitpick: elastix basically follows the ITK naming convention, so function names should preferably start with a capital letter. See https://github.com/InsightSoftwareConsortium/ITKSoftwareGuide/blob/96450bf1b8a882b02d416a5929e44301b59acfe3/SoftwareGuide/Latex/Appendices/CodingStyleGuide.tex#L733

So I think it should be ReadParameterObject, rather than readParameterObject. (Otherwise please propose changing the ITK naming convention 😸!)

@thewtex thewtex force-pushed the downsample-register-example branch from f5f8aff to 8410990 Compare May 27, 2025 21:38
Comment on lines +118 to +119
const auto & valueDouble = std::get<double>(value);
parameterValues.push_back(std::to_string(valueDouble));
Copy link
Collaborator

Choose a reason for hiding this comment

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

std::to_string is not lossless for floating point, please consider using ITK's NumberToString instead:

parameterValues.push_back( ConvertNumberToString(std::get<double>(value)) )

Resamples the input with the transform.
@thewtex thewtex force-pushed the downsample-register-example branch from 8410990 to 6cb5d47 Compare June 2, 2025 14:02
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.

2 participants