-
Notifications
You must be signed in to change notification settings - Fork 26
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
base: main
Are you sure you want to change the base?
Conversation
aee7c1e to
f5f8aff
Compare
|
We still have the issue: Should we be adding the output spacing as a parameter? |
Just checked: 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)? |
f5f8aff to
8410990
Compare
8410990 to
6cb5d47
Compare
e55ba4a to
aec106b
Compare
I ended up keeping maintaining the behavior of |
8cb4a15 to
4370ecc
Compare
|
@N-Dekker this is ready for review! There are a number of related to Typescript, Javascript, artifacts, etc. that do not need much attention. |
|
@thewtex It appears that your last commit ENH: Base wasm on ITK-Wasm 1.0b192 is not on the branch of your fork! Looking at https://github.com/thewtex/ITKElastix/tree/downsample-register-example Do you know how that is possible? I was reviewing based on your fork, but now your fork seems out of date! |
| pipeline.add_option("-i,--initial-transform", initialTransform, "Initial transform to apply before registration") | ||
| ->type_name("INPUT_TRANSFORM"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering, the elastix.exe command-line interface has "-t0" for the initial transform of a registration, whereas elastix-wasm now has both "-i" and "-t" (but not "-t0"). Should these command-line flags still be brought in sync, one way or another? Or are they different for a fundamental reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can/should bring them into sync! I will update this one -- please let me know if you see any others that should be updated.
@N-Dekker GitHub has a hard time with PR's from my fork, so I have to push this up to this repository to make a PR. But I also updated the same branch on my fork 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thewtex I think ITKElastix should still be adjusted to use TOML, instead of JSON, for parameter files. You know, we discussed JSON vs YAML vs TOML parameter files earlier this year. TOML appeared preferable to JSON, because unlike JSON, TOML allows users to add comments to their parameter files. (I think you suggested TOML to us 😃) So from February, elastix and transformix fully support TOML parameter files, both as input and output.
I think ITKElastix wasm executables (like "default-parameter-map.cxx") can output an elastix parameter map to stream as follows:
#include "Install/elxConversion.h"
...
itk::wasm::OutputTextStream outputTextStream;
outputTextStream.Get() <<
elastix::Conversion::ParameterMapToString(parameterMap,
elastix::ParameterMapStringFormat::Toml);
Right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@N-Dekker yes, for the pipelines like write-parameter-files, we should output the awesome new TOML support instead of the bespoke elastix parameter file format ✨ 🥇 .
For the elastix-wasm pipeline we want to output JSON from the wasm executable. This is for JavaScript / Python binding that transforms the JSON into JavaScript Objects and Python dict's for working with the data in JavaScript and Python. When the goal is to save or load the result to file, these are serialized / deserialized with read-parameter-file, write-parameter-file (soon in TOML!).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thewtex Sorry, can you please clarify? Would it be OK to you to replace JSON parameter files like "wasm/test/data/input/CT_3D_lung.json" with the equivalent TOML parameter files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@N-Dekker We will add wasm/test/data/input/CT_3D_lung.toml, and use this for the data format with read-parameter-files, write-parameter-files. I would like to also keep the wasm/test/data/input/CT_3D_lung.json file to help add tests with native binaries / in the CLI the same codepath used in the JavaScript and Python wrapping. This may be easier to understand after the toml support has been added.
Based on current sources.
For deployment, we also needed to add pip to the build environment.
Note: we support std::variant for the ValueVector to support, for example, the actual boolean or number types being specified in python or typescript.
Simple and fast.
More efficient and enables use in bindings.
More efficient, enables bindings, and improves wasm module size.
Resamples the input with the transform.
The `elastix` function's signature changed (returns transform outputs).
Required for transform interface type support.
Transforms are now outputs.
Easier to track changes.
Generated by VS Code.
To track changes.
Latest.
This is generated based on the javascript module contents.
Addresses: test/test_write_parameter_files_async.py:33: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > ??? E pyodide.ffi.JsException: DataCloneError: Failed to execute 'postMessage' on 'Worker': [object Map] could not be cloned. /lib/python3.12/site-packages/itkwasm_elastix_emscripten/write_parameter_files_async.py:36: JsException via: InsightSoftwareConsortium/ITK-Wasm@f805bf2
Shows how to: 1. Register with elastix 2. Apply the resulting transform with transformix 3. Downsample the input images. 4. Register the downsampled images. 5. Apply the resulting transform at the original resolution.
Improved Transform support.
1f23b48 to
5cc7e7a
Compare
Through: - Bump itk-wasm to 1.0.0-b.196 - Bump itkwasm python package dependency - Bump of supporting Docker images - Rebuild wasm packages
Python and Typescript/JavaScript and downsample register example.
No description provided.