Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions packages/core/typescript/demo-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
"@itk-viewer/element": "^0.3.0",
"@itk-viewer/io": "^0.1.8",
"@shoelace-style/shoelace": "^2.12.0",
"@itk-viewer/element": "^0.6.6",
"@itk-viewer/io": "^0.4.3",
"@shoelace-style/shoelace": "^2.16.0",
"itk-wasm": "workspace:^",
"lit": "^3.1.2"
"lit": "^3.2.0"
},
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,46 @@
export default async function downsampleLoadSampleInputs (model, preRun=false) {
const downsampleButton = document.querySelector('#downsampleBinShrinkInputs sl-button[name=input-file-button]')
export default async function downsampleLoadSampleInputs(
model,
preRun = false,
) {
const downsampleButton = document.querySelector(
"#downsampleBinShrinkInputs sl-button[name=input-file-button]",
);
if (!preRun) {
downsampleButton.loading = true
downsampleButton.loading = true;
}

const fileName = "cthead1.png"
const response = await fetch(`https://bafybeih4fck4ndvsvgo6774xy5w7ip3bzcvh7x7e527m4yvazgrxdzayua.ipfs.w3s.link/ipfs/bafybeih4fck4ndvsvgo6774xy5w7ip3bzcvh7x7e527m4yvazgrxdzayua/input/${fileName}`)
const data = new Uint8Array(await response.arrayBuffer())
const inputFile = { data, path: fileName }
const { image } = await globalThis.readImage(inputFile)
const fileName = "cthead1.png";
const response = await fetch(
`https://bafybeih4fck4ndvsvgo6774xy5w7ip3bzcvh7x7e527m4yvazgrxdzayua.ipfs.w3s.link/ipfs/bafybeih4fck4ndvsvgo6774xy5w7ip3bzcvh7x7e527m4yvazgrxdzayua/input/${fileName}`,
);
const data = new Uint8Array(await response.arrayBuffer());
const inputFile = { data, path: fileName };
const { image } = await globalThis.readImage(inputFile);

model.inputs.set('input', image)
model.options.set('shrinkFactors', [2, 2])
model.inputs.set("input", image);
model.options.set("shrinkFactors", [2, 2]);

if (!preRun) {
const downsampleElement = document.getElementById('downsampleBinShrink-input-details')
downsampleElement.innerHTML = `<pre>${globalThis.escapeHtml(inputFile.path)}</pre>`
downsampleElement.disabled = false
const downsampleElement = document.getElementById(
"downsampleBinShrink-input-details",
);
downsampleElement.setImage(image);
downsampleElement.disabled = false;

const shrinkFactorsElement = document.querySelector('#downsampleBinShrinkInputs sl-input[name=shrink-factors]')
shrinkFactorsElement.value = JSON.stringify(model.options.get('shrinkFactors'))
const shrinkFactorsElement = document.querySelector(
"#downsampleBinShrinkInputs sl-input[name=shrink-factors]",
);
shrinkFactorsElement.value = JSON.stringify(
model.options.get("shrinkFactors"),
);

downsampleButton.loading = false
downsampleButton.loading = false;
}

return model
return model;
}

// Use this function to run the pipeline when this tab group is select.
// This will load the web worker if it is not already loaded, download the wasm module, and allocate memory in the wasm model.
// Set this to `false` if sample inputs are very large or sample pipeline computation is long.
export const usePreRun = true
export const usePreRun = true;
Original file line number Diff line number Diff line change
@@ -1,33 +1,46 @@
export default async function downsampleLoadSampleInputs (model, preRun=false) {
const downsampleButton = document.querySelector('#downsampleLabelImageInputs sl-button[name=input-file-button]')
export default async function downsampleLoadSampleInputs(
model,
preRun = false,
) {
const downsampleButton = document.querySelector(
"#downsampleLabelImageInputs sl-button[name=input-file-button]",
);
if (!preRun) {
downsampleButton.loading = true
downsampleButton.loading = true;
}

const fileName = "2th_cthead1.png"
const response = await fetch(`https://bafybeih4fck4ndvsvgo6774xy5w7ip3bzcvh7x7e527m4yvazgrxdzayua.ipfs.w3s.link/ipfs/bafybeih4fck4ndvsvgo6774xy5w7ip3bzcvh7x7e527m4yvazgrxdzayua/input/${fileName}`)
const data = new Uint8Array(await response.arrayBuffer())
const inputFile = { data, path: fileName }
const { image } = await globalThis.readImage(inputFile)
const fileName = "2th_cthead1.png";
const response = await fetch(
`https://bafybeih4fck4ndvsvgo6774xy5w7ip3bzcvh7x7e527m4yvazgrxdzayua.ipfs.w3s.link/ipfs/bafybeih4fck4ndvsvgo6774xy5w7ip3bzcvh7x7e527m4yvazgrxdzayua/input/${fileName}`,
);
const data = new Uint8Array(await response.arrayBuffer());
const inputFile = { data, path: fileName };
const { image } = await globalThis.readImage(inputFile);

model.inputs.set('input', image)
model.options.set('shrinkFactors', [2, 2])
model.inputs.set("input", image);
model.options.set("shrinkFactors", [2, 2]);

if (!preRun) {
const downsampleElement = document.getElementById('downsampleLabelImage-input-details')
downsampleElement.innerHTML = `<pre>${globalThis.escapeHtml(inputFile.path)}</pre>`
downsampleElement.disabled = false
const downsampleElement = document.getElementById(
"downsampleLabelImage-input-details",
);
downsampleElement.setImage(image);
downsampleElement.disabled = false;

const shrinkFactorsElement = document.querySelector('#downsampleLabelImageInputs sl-input[name=shrink-factors]')
shrinkFactorsElement.value = JSON.stringify(model.options.get('shrinkFactors'))
const shrinkFactorsElement = document.querySelector(
"#downsampleLabelImageInputs sl-input[name=shrink-factors]",
);
shrinkFactorsElement.value = JSON.stringify(
model.options.get("shrinkFactors"),
);

downsampleButton.loading = false
downsampleButton.loading = false;
}

return model
return model;
}

// Use this function to run the pipeline when this tab group is select.
// This will load the web worker if it is not already loaded, download the wasm module, and allocate memory in the wasm model.
// Set this to `false` if sample inputs are very large or sample pipeline computation is long.
export const usePreRun = true
export const usePreRun = true;
Original file line number Diff line number Diff line change
@@ -1,33 +1,46 @@
export default async function downsampleLoadSampleInputs (model, preRun=false) {
const downsampleButton = document.querySelector('#downsampleInputs sl-button[name=input-file-button]')
export default async function downsampleLoadSampleInputs(
model,
preRun = false,
) {
const downsampleButton = document.querySelector(
"#downsampleInputs sl-button[name=input-file-button]",
);
if (!preRun) {
downsampleButton.loading = true
downsampleButton.loading = true;
}

const fileName = "cthead1.png"
const response = await fetch(`https://bafybeih4fck4ndvsvgo6774xy5w7ip3bzcvh7x7e527m4yvazgrxdzayua.ipfs.w3s.link/ipfs/bafybeih4fck4ndvsvgo6774xy5w7ip3bzcvh7x7e527m4yvazgrxdzayua/input/${fileName}`)
const data = new Uint8Array(await response.arrayBuffer())
const inputFile = { data, path: fileName }
const { image } = await globalThis.readImage(inputFile)
const fileName = "cthead1.png";
const response = await fetch(
`https://bafybeih4fck4ndvsvgo6774xy5w7ip3bzcvh7x7e527m4yvazgrxdzayua.ipfs.w3s.link/ipfs/bafybeih4fck4ndvsvgo6774xy5w7ip3bzcvh7x7e527m4yvazgrxdzayua/input/${fileName}`,
);
const data = new Uint8Array(await response.arrayBuffer());
const inputFile = { data, path: fileName };
const { image } = await globalThis.readImage(inputFile);

model.inputs.set('input', image)
model.options.set('shrinkFactors', [2, 2])
model.inputs.set("input", image);
model.options.set("shrinkFactors", [2, 2]);

if (!preRun) {
const downsampleElement = document.getElementById('downsample-input-details')
downsampleElement.innerHTML = `<pre>${globalThis.escapeHtml(inputFile.path)}</pre>`
downsampleElement.disabled = false
const downsampleElement = document.getElementById(
"downsample-input-details",
);
downsampleElement.setImage(image);
downsampleElement.disabled = false;

const shrinkFactorsElement = document.querySelector('#downsampleInputs sl-input[name=shrink-factors]')
shrinkFactorsElement.value = JSON.stringify(model.options.get('shrinkFactors'))
const shrinkFactorsElement = document.querySelector(
"#downsampleInputs sl-input[name=shrink-factors]",
);
shrinkFactorsElement.value = JSON.stringify(
model.options.get("shrinkFactors"),
);

downsampleButton.loading = false
downsampleButton.loading = false;
}

return model
return model;
}

// Use this function to run the pipeline when this tab group is select.
// This will load the web worker if it is not already loaded, download the wasm module, and allocate memory in the wasm model.
// Set this to `false` if sample inputs are very large or sample pipeline computation is long.
export const usePreRun = true
export const usePreRun = true;
Loading
Loading