Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e61116b
ENH: Update wasm module artifacts
thewtex Apr 28, 2025
e7b0b95
ENH: Bump wasm python package versions to 0.4.0
thewtex Apr 28, 2025
d580450
ENH: Use glaze in wasm for parameter object parsing
thewtex May 14, 2025
26964be
ENH: Use glaze for parameter object parsing in elastix-wasm
thewtex May 16, 2025
ea8a069
ENH: Use itk::wasm::OutputTransform
thewtex May 16, 2025
4c66514
ENH: Use itk::wasm::InputTransform in elastix-wasm
thewtex May 16, 2025
5746516
ENH: Add transformix wasm pipeline
thewtex May 16, 2025
f2db710
COMP: Add full path for itkwasm docker images
thewtex Jun 24, 2025
6ce94f8
BUG: Update Node elastix-test for new tranform interface
thewtex Jun 24, 2025
771d239
ENH: Bump wasm package version to 1.0.0 and update artifacts
thewtex Jun 24, 2025
619ab8b
BUG: Update itkwasm wasm Python dep to 1.0.b189
thewtex Jun 24, 2025
86574b2
BUG: Update test_elastix_wasm.py for API change
thewtex Jun 24, 2025
61205eb
ENH: Add transformix generated typescript sources
thewtex Jun 24, 2025
4e0b8d4
STYLE: Add .vscode to .gitignore
thewtex Jun 24, 2025
d26cf6f
ENH: Add transformix generated python interface artifacts
thewtex Jun 24, 2025
b74eadb
ENH: Bump pnpm to 10.12.3
thewtex Jun 24, 2025
49c26f3
ENH: Update js_package.py default_js_module
thewtex Jun 25, 2025
f8cff8a
BUG: Bump itkwasm Python dependency to 1.0b191
thewtex Jun 25, 2025
bdd2ad3
STYLE: Apply clang-format to wasm files
thewtex Jun 25, 2025
02f3e3f
DOC: downsample-register Node.js example
thewtex Apr 28, 2025
5cc7e7a
ENH: Base wasm on ITK-Wasm 1.0b192
thewtex Jun 26, 2025
d906dc3
BUG: Add wasm CompositeTransform support in bindings
thewtex Sep 3, 2025
2266e70
ENH: Update wasm package versions to 1.0.2
thewtex Sep 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ wasm/typescript/demo/
wasm/test
micromamba/
.pixi/
.vscode/
7 changes: 7 additions & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resampled-moving-via-downsample-transform.mha
resampled-moving.mha
resampledMoving.mha
result-downsampled.mha
result.mha
result.png

118 changes: 118 additions & 0 deletions examples/downsample-register.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#!/usr/bin/env node

/*

This example demonstrates how to use the @itk-wasm/elastix module.

It 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.

*/

import path from "path";

import { readImageNode, writeImageNode } from "@itk-wasm/image-io";
import { downsampleNode } from "@itk-wasm/downsample";
import {
elastixNode,
defaultParameterMapNode,
transformixNode,
} from "@itk-wasm/elastix";

// ------------------------------------------------------------------
// Read output input fixed and moving images
const fixedImagePath = path.join(
import.meta.dirname,
"data",
"CT_2D_head_fixed.mha"
);
const movingImagePath = path.join(
import.meta.dirname,
"data",
"CT_2D_head_moving.mha"
);
const fixedImage = await readImageNode(fixedImagePath);
const movingImage = await readImageNode(movingImagePath);
console.log("Fixed image:", fixedImage);
console.log("Moving image:", movingImage);

// ------------------------------------------------------------------
// Perform registration at full resolution
const { parameterMap: translationParameterMap } = await defaultParameterMapNode(
"translation",
{
numberOfResolutions: 2,
}
);
const { parameterMap: bsplineParameterMap } = await defaultParameterMapNode(
"bspline",
{
numberOfResolutions: 2,
}
);
const parameterObject = [translationParameterMap, bsplineParameterMap];
const { result, transformParameterObject } = await elastixNode(
parameterObject,
{
fixed: fixedImage,
moving: movingImage,
}
);
await writeImageNode(result, "result.mha");

// ------------------------------------------------------------------
// Use the transform to resample the moving image
const { result: resampledMovingImage } = await transformixNode(
movingImage,
transformParameterObject
);
// Same as result.mha
await writeImageNode(resampledMovingImage, "resampled-moving.mha");

// ------------------------------------------------------------------
// Generate a downsampled version of the fixed and moving images
const shrinkFactors = [2, 2];
const { downsampled: downsampledFixedImage } = await downsampleNode(
fixedImage,
{
shrinkFactors,
}
);
const { downsampled: downsampledMovingImage } = await downsampleNode(
movingImage,
{
shrinkFactors,
}
);
console.log("Downsampled fixed image:", downsampledFixedImage);
console.log("Downsampled moving image:", downsampledMovingImage);

// ------------------------------------------------------------------
// Perform registration at downsampled resolution
const {
result: resultDownsampled,
transformParameterObject: transformParameterObjectDownsampled,
} = await elastixNode(parameterObject, {
fixed: downsampledFixedImage,
moving: downsampledMovingImage,
});
await writeImageNode(resultDownsampled, "result-downsampled.mha");

// ------------------------------------------------------------------
// Use the transform to resample the moving image at its original resolution
const { result: resampledMovingImageViaDownsampleTransform } =
await transformixNode(movingImage, transformParameterObjectDownsampled, {
outputOrigin: fixedImage.origin,
outputSpacing: fixedImage.spacing,
outputDirection: fixedImage.direction,
outputSize: fixedImage.size,
});
await writeImageNode(
resampledMovingImageViaDownsampleTransform,
"resampled-moving-via-downsample-transform.mha"
);
Loading
Loading