Skip to content

Commit 91e3eb9

Browse files
committed
chore(mesh-filters): add typescript generated files
1 parent 8170a0c commit 91e3eb9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+3161
-0
lines changed

packages/mesh-filters/typescript/.nojekll

Whitespace-only changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
.DS_Store
3+
test
4+
cypress
5+
demo-app

packages/mesh-filters/typescript/README.md

Lines changed: 351 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>@itk-wasm/mesh-filters</title>
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
7+
<meta name="description" content="Mesh filters to repair, remesh, subdivide, decimate, smooth, triangulate, etc.">
8+
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
9+
<link rel="stylesheet" media="(prefers-color-scheme: dark)" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple-dark.css">
10+
<link rel="stylesheet" media="(prefers-color-scheme: light)" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple.css">
11+
<style>
12+
:root {
13+
--base-font-size: 16px;
14+
--theme-color : lightblue;
15+
--code-theme-text : #afcf7f;
16+
--code-font-weight : 750;
17+
--code-inline-background: hsl(var(--mono-hue), var(--mono-saturation), 35%);
18+
--mono-hue : 213;
19+
--mono-saturation : 0%;
20+
}
21+
</style>
22+
</head>
23+
<body>
24+
<div id="app">Loading...</div>
25+
<script>
26+
window.$docsify = {
27+
basePath: '',
28+
logo: '/test/browser/demo-app/logo.svg',
29+
name: '@itk-wasm/mesh-filters',
30+
repo: ''
31+
}
32+
</script>
33+
<!-- Docsify v4 -->
34+
<script src="https://cdn.jsdelivr.net/npm/docsify@4"></script>
35+
<script src="https://cdn.jsdelivr.net/npm/docsify-copy-code/dist/docsify-copy-code.min.js"></script>
36+
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-typescript.min.js"></script>
37+
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-c.min.js"></script>
38+
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-cpp.min.js"></script>
39+
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-python.min.js"></script>
40+
<script src="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/js/docsify-themeable.min.js"></script>
41+
<script src="https://cdn.jsdelivr.net/npm/docsify@4/lib/plugins/search.js"></script>
42+
<script src="https://cdn.jsdelivr.net/npm/docsify@4/lib/plugins/zoom-image.min.js"></script>
43+
</body>
44+
</html>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Generated file. To retain edits, remove this comment.
2+
3+
import { getDefaultWebWorker as itkWasmGetDefaultWebWorker, createWebWorker, ItkWorker } from 'itk-wasm'
4+
import { getPipelineWorkerUrl } from './pipeline-worker-url.js'
5+
6+
let defaultWebWorker: Worker | null = null
7+
8+
async function createNewWorker() {
9+
const pipelineWorkerUrl = getPipelineWorkerUrl()
10+
const pipelineWorkerUrlString = typeof pipelineWorkerUrl !== 'string' && typeof pipelineWorkerUrl?.href !== 'undefined' ? pipelineWorkerUrl.href : pipelineWorkerUrl
11+
defaultWebWorker = await createWebWorker(pipelineWorkerUrlString as string | null)
12+
}
13+
14+
export function setDefaultWebWorker (webWorker: Worker | null): void {
15+
defaultWebWorker = webWorker
16+
}
17+
18+
export async function getDefaultWebWorker (): Promise<Worker> {
19+
if (defaultWebWorker !== null) {
20+
if ((defaultWebWorker as ItkWorker).terminated) {
21+
await createNewWorker()
22+
}
23+
return defaultWebWorker
24+
}
25+
const itkWasmDefaultWebWorker = itkWasmGetDefaultWebWorker()
26+
if (itkWasmDefaultWebWorker !== null) {
27+
return itkWasmDefaultWebWorker
28+
}
29+
30+
await createNewWorker()
31+
return defaultWebWorker as unknown as Worker
32+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Generated file. To retain edits, remove this comment.
2+
3+
import { Mesh } from 'itk-wasm'
4+
5+
interface GeogramConversionNodeResult {
6+
/** The output mesh */
7+
outputMesh: Mesh
8+
9+
}
10+
11+
export default GeogramConversionNodeResult
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Generated file. To retain edits, remove this comment.
2+
3+
import {
4+
Mesh,
5+
InterfaceTypes,
6+
PipelineOutput,
7+
PipelineInput,
8+
runPipelineNode
9+
} from 'itk-wasm'
10+
11+
import GeogramConversionNodeResult from './geogram-conversion-node-result.js'
12+
13+
import path from 'path'
14+
import { fileURLToPath } from 'url'
15+
16+
/**
17+
* A test for reading and writing with geogram, itk::QuadEdgeMesh meshes
18+
*
19+
* @param {Mesh} inputMesh - The input mesh
20+
*
21+
* @returns {Promise<GeogramConversionNodeResult>} - result object
22+
*/
23+
async function geogramConversionNode(
24+
inputMesh: Mesh
25+
) : Promise<GeogramConversionNodeResult> {
26+
27+
const desiredOutputs: Array<PipelineOutput> = [
28+
{ type: InterfaceTypes.Mesh },
29+
]
30+
31+
const inputs: Array<PipelineInput> = [
32+
{ type: InterfaceTypes.Mesh, data: inputMesh },
33+
]
34+
35+
const args = []
36+
// Inputs
37+
const inputMeshName = '0'
38+
args.push(inputMeshName)
39+
40+
// Outputs
41+
const outputMeshName = '0'
42+
args.push(outputMeshName)
43+
44+
// Options
45+
args.push('--memory-io')
46+
47+
const pipelinePath = path.join(path.dirname(fileURLToPath(import.meta.url)), 'pipelines', 'geogram-conversion')
48+
49+
const {
50+
returnValue,
51+
stderr,
52+
outputs
53+
} = await runPipelineNode(pipelinePath, args, desiredOutputs, inputs)
54+
if (returnValue !== 0 && stderr !== "") {
55+
throw new Error(stderr)
56+
}
57+
58+
const result = {
59+
outputMesh: outputs[0]?.data as Mesh,
60+
}
61+
return result
62+
}
63+
64+
export default geogramConversionNode
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Generated file. To retain edits, remove this comment.
2+
3+
import { WorkerPoolFunctionOption } from 'itk-wasm'
4+
5+
interface GeogramConversionOptions extends WorkerPoolFunctionOption {
6+
}
7+
8+
export default GeogramConversionOptions
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Generated file. To retain edits, remove this comment.
2+
3+
import { Mesh, WorkerPoolFunctionResult } from 'itk-wasm'
4+
5+
interface GeogramConversionResult extends WorkerPoolFunctionResult {
6+
/** The output mesh */
7+
outputMesh: Mesh
8+
9+
}
10+
11+
export default GeogramConversionResult
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// Generated file. To retain edits, remove this comment.
2+
3+
import {
4+
Mesh,
5+
InterfaceTypes,
6+
PipelineOutput,
7+
PipelineInput,
8+
runPipeline
9+
} from 'itk-wasm'
10+
11+
import GeogramConversionOptions from './geogram-conversion-options.js'
12+
import GeogramConversionResult from './geogram-conversion-result.js'
13+
14+
import { getPipelinesBaseUrl } from './pipelines-base-url.js'
15+
import { getPipelineWorkerUrl } from './pipeline-worker-url.js'
16+
17+
import { getDefaultWebWorker } from './default-web-worker.js'
18+
19+
/**
20+
* A test for reading and writing with geogram, itk::QuadEdgeMesh meshes
21+
*
22+
* @param {Mesh} inputMesh - The input mesh
23+
* @param {GeogramConversionOptions} options - options object
24+
*
25+
* @returns {Promise<GeogramConversionResult>} - result object
26+
*/
27+
async function geogramConversion(
28+
inputMesh: Mesh,
29+
options: GeogramConversionOptions = {}
30+
) : Promise<GeogramConversionResult> {
31+
32+
const desiredOutputs: Array<PipelineOutput> = [
33+
{ type: InterfaceTypes.Mesh },
34+
]
35+
36+
const inputs: Array<PipelineInput> = [
37+
{ type: InterfaceTypes.Mesh, data: inputMesh },
38+
]
39+
40+
const args = []
41+
// Inputs
42+
const inputMeshName = '0'
43+
args.push(inputMeshName)
44+
45+
// Outputs
46+
const outputMeshName = '0'
47+
args.push(outputMeshName)
48+
49+
// Options
50+
args.push('--memory-io')
51+
52+
const pipelinePath = 'geogram-conversion'
53+
54+
let workerToUse = options?.webWorker
55+
if (workerToUse === undefined) {
56+
workerToUse = await getDefaultWebWorker()
57+
}
58+
const {
59+
webWorker: usedWebWorker,
60+
returnValue,
61+
stderr,
62+
outputs
63+
} = await runPipeline(pipelinePath, args, desiredOutputs, inputs, { pipelineBaseUrl: getPipelinesBaseUrl(), pipelineWorkerUrl: getPipelineWorkerUrl(), webWorker: workerToUse, noCopy: options?.noCopy })
64+
if (returnValue !== 0 && stderr !== "") {
65+
throw new Error(stderr)
66+
}
67+
68+
const result = {
69+
webWorker: usedWebWorker as Worker,
70+
outputMesh: outputs[0]?.data as Mesh,
71+
}
72+
return result
73+
}
74+
75+
export default geogramConversion

0 commit comments

Comments
 (0)