Skip to content

Commit e0f4a93

Browse files
authored
Merge pull request #1466 from thewtex/module-url-to-path
module url to path
2 parents 5d3c42e + 7ec7e46 commit e0f4a93

File tree

32 files changed

+275
-251
lines changed

32 files changed

+275
-251
lines changed

packages/compare-images/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@itk-wasm/compare-images-build",
3-
"version": "5.4.0",
3+
"version": "5.4.1",
44
"private": true,
55
"description": "@itk-wasm/compare-stringify build configuration",
66
"type": "module",

packages/compare-images/pixi.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
[project]
2-
authors = ["Matt McCormick <matt@mmmccormick.com>"]
1+
[workspace]
2+
authors = ["Matt McCormick <matt@fideus.io>"]
33
channels = ["conda-forge"]
44
description = "Compare images with a tolerance for regression testing."
55
name = "compare-images"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "5.4.0"
1+
__version__ = "5.4.1"

packages/compare-images/python/itkwasm-compare-images-emscripten/itkwasm_compare_images_emscripten/js_package.py

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "5.4.0"
1+
__version__ = "5.4.1"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "5.4.0"
1+
__version__ = "5.4.1"

packages/compare-images/typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@itk-wasm/compare-images",
3-
"version": "5.4.0",
3+
"version": "5.4.1",
44
"description": "Compare images with a tolerance for regression testing.",
55
"type": "module",
66
"module": "./dist/index.js",

packages/compare-images/typescript/src/compare-double-images-node.ts

Lines changed: 52 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import {
33
InterfaceTypes,
44
PipelineOutput,
55
PipelineInput,
6-
runPipelineNode
7-
} from 'itk-wasm'
6+
runPipelineNode,
7+
} from "itk-wasm";
88

9-
import CompareDoubleImagesOptions from './compare-double-images-options.js'
10-
import CompareDoubleImagesNodeResult from './compare-double-images-node-result.js'
11-
import CompareImagesMetric from './compare-images-metric.js'
9+
import CompareDoubleImagesOptions from "./compare-double-images-options.js";
10+
import CompareDoubleImagesNodeResult from "./compare-double-images-node-result.js";
11+
import CompareImagesMetric from "./compare-images-metric.js";
1212

13-
import path from 'path'
13+
import path from "path";
14+
import { fileURLToPath } from "url";
1415

1516
/**
1617
* Compare double pixel type images with a tolerance for regression testing.
@@ -22,86 +23,88 @@ import path from 'path'
2223
*/
2324
async function compareDoubleImagesNode(
2425
testImage: Image,
25-
options: CompareDoubleImagesOptions = { baselineImages: [] as Image[], }
26-
) : Promise<CompareDoubleImagesNodeResult> {
27-
26+
options: CompareDoubleImagesOptions = { baselineImages: [] as Image[] }
27+
): Promise<CompareDoubleImagesNodeResult> {
2828
const desiredOutputs: Array<PipelineOutput> = [
2929
{ type: InterfaceTypes.JsonCompatible },
3030
{ type: InterfaceTypes.Image },
3131
{ type: InterfaceTypes.Image },
32-
]
32+
];
3333

3434
const inputs: Array<PipelineInput> = [
3535
{ type: InterfaceTypes.Image, data: testImage },
36-
]
36+
];
3737

38-
const args = []
38+
const args = [];
3939
// Inputs
40-
const testImageName = '0'
41-
args.push(testImageName as string)
40+
const testImageName = "0";
41+
args.push(testImageName as string);
4242

4343
// Outputs
44-
const metricsName = '0'
45-
args.push(metricsName)
44+
const metricsName = "0";
45+
args.push(metricsName);
4646

47-
const differenceImageName = '1'
48-
args.push(differenceImageName)
47+
const differenceImageName = "1";
48+
args.push(differenceImageName);
4949

50-
const differenceUchar2dImageName = '2'
51-
args.push(differenceUchar2dImageName)
50+
const differenceUchar2dImageName = "2";
51+
args.push(differenceUchar2dImageName);
5252

5353
// Options
54-
args.push('--memory-io')
54+
args.push("--memory-io");
5555
if (typeof options.baselineImages !== "undefined") {
56-
if(options.baselineImages.length < 1) {
57-
throw new Error('"baseline-images" option must have a length > 1')
56+
if (options.baselineImages.length < 1) {
57+
throw new Error('"baseline-images" option must have a length > 1');
5858
}
59-
args.push('--baseline-images')
59+
args.push("--baseline-images");
6060

6161
options.baselineImages.forEach((value) => {
62-
const inputCountString = inputs.length.toString()
63-
inputs.push({ type: InterfaceTypes.Image, data: value as Image })
64-
args.push(inputCountString)
65-
66-
})
62+
const inputCountString = inputs.length.toString();
63+
inputs.push({ type: InterfaceTypes.Image, data: value as Image });
64+
args.push(inputCountString);
65+
});
6766
}
6867
if (typeof options.differenceThreshold !== "undefined") {
69-
args.push('--difference-threshold', options.differenceThreshold.toString())
70-
68+
args.push("--difference-threshold", options.differenceThreshold.toString());
7169
}
7270
if (typeof options.radiusTolerance !== "undefined") {
73-
args.push('--radius-tolerance', options.radiusTolerance.toString())
74-
71+
args.push("--radius-tolerance", options.radiusTolerance.toString());
7572
}
7673
if (typeof options.spatialTolerance !== "undefined") {
77-
args.push('--spatial-tolerance', options.spatialTolerance.toString())
78-
74+
args.push("--spatial-tolerance", options.spatialTolerance.toString());
7975
}
8076
if (typeof options.numberOfPixelsTolerance !== "undefined") {
81-
args.push('--number-of-pixels-tolerance', options.numberOfPixelsTolerance.toString())
82-
77+
args.push(
78+
"--number-of-pixels-tolerance",
79+
options.numberOfPixelsTolerance.toString()
80+
);
8381
}
8482
if (typeof options.ignoreBoundaryPixels !== "undefined") {
85-
options.ignoreBoundaryPixels && args.push('--ignore-boundary-pixels')
83+
options.ignoreBoundaryPixels && args.push("--ignore-boundary-pixels");
8684
}
8785

88-
const pipelinePath = path.join(path.dirname(import.meta.url.substring(7)), 'pipelines', 'compare-double-images')
89-
90-
const {
91-
returnValue,
92-
stderr,
93-
outputs
94-
} = await runPipelineNode(pipelinePath, args, desiredOutputs, inputs)
86+
const pipelinePath = path.join(
87+
path.dirname(fileURLToPath(import.meta.url)),
88+
"pipelines",
89+
"compare-double-images"
90+
);
91+
92+
const { returnValue, stderr, outputs } = await runPipelineNode(
93+
pipelinePath,
94+
args,
95+
desiredOutputs,
96+
inputs
97+
);
9598
if (returnValue !== 0) {
96-
throw new Error(stderr)
99+
throw new Error(stderr);
97100
}
98101

99102
const result = {
100103
metrics: outputs[0].data as unknown as CompareImagesMetric,
101104
differenceImage: outputs[1].data as Image,
102105
differenceUchar2dImage: outputs[2].data as Image,
103-
}
104-
return result
106+
};
107+
return result;
105108
}
106109

107-
export default compareDoubleImagesNode
110+
export default compareDoubleImagesNode;

packages/dicom/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@itk-wasm/dicom-build",
3-
"version": "7.6.3",
3+
"version": "7.6.4",
44
"private": true,
55
"description": "@itk-wasm/dicom build configuration.",
66
"type": "module",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "7.6.3"
1+
__version__ = "7.6.4"

0 commit comments

Comments
 (0)