-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(itk-dicom): Browser package configuration
- Loading branch information
Showing
26 changed files
with
3,480 additions
and
2,954 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineConfig } from "cypress"; | ||
|
||
export default defineConfig({ | ||
e2e: { | ||
defaultCommandTimeout: 5000, | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
describe('structuredReportToText', () => { | ||
beforeEach(function() { | ||
cy.visit('/') | ||
|
||
const fileName = '88.33-comprehensive-SR.dcm' | ||
const testFilePath = `../../build-emscripten/ExternalData/test/Input/${fileName}` | ||
cy.readFile(testFilePath, null).as('inputData') | ||
}) | ||
|
||
it('runs and produces the expected text', function() { | ||
cy.get('input[type=file]').selectFile({ contents: new Uint8Array(this.inputData), fileName: 'inputData.dcm' }) | ||
cy.get('textarea').contains('Comprehensive SR Document') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/// <reference types="cypress" /> | ||
// *********************************************** | ||
// This example commands.ts shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add('login', (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This will overwrite an existing command -- | ||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) | ||
// | ||
// declare global { | ||
// namespace Cypress { | ||
// interface Chainable { | ||
// login(email: string, password: string): Chainable<void> | ||
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element> | ||
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element> | ||
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element> | ||
// } | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const compareImageToBaseline = (itk, testImage, baselineImage) => { | ||
expect(testImage.imageType, 'imageType').to.deep.equal(baselineImage.imageType) | ||
expect(testImage.origin, 'origin').to.deep.equal(baselineImage.origin) | ||
expect(testImage.spacing, 'spacing').to.deep.equal(baselineImage.spacing) | ||
expect(testImage.size, 'size').to.deep.equal(baselineImage.size) | ||
expect(testImage.data, 'data').to.deep.equal(baselineImage.data) | ||
} | ||
|
||
export default compareImageToBaseline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// *********************************************************** | ||
// This example support/e2e.ts is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import './commands' | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>structured-report-to-text example</title> | ||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | ||
<style> | ||
html, body { | ||
height: 90%; | ||
} | ||
|
||
textarea { | ||
resize: none; | ||
overflow-y: scroll; | ||
position: absolute; | ||
box-sizing: border-box; | ||
width: 600px; | ||
height: 600px; | ||
bottom: 0px; | ||
left: 0px; | ||
top: 50px; | ||
} | ||
</style> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/xstate.min.js"></script> | ||
</head> | ||
|
||
<body> | ||
<!-- Input selector --> | ||
<div> | ||
<label>Select dicom file:</label> | ||
<input name="inputFile" type="file" /> | ||
</div> | ||
|
||
<!-- File information --> | ||
<div> | ||
<textarea readonly name="outputTextArea">Output representation...</textarea> | ||
<div name="outputDiv"></div> | ||
</div> | ||
|
||
<!-- Javascript --> | ||
<script type="module" src="./dist/itk-dicom.js"></script> | ||
<script type="module" src="./test/app.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,52 @@ | ||
{ | ||
"name": "itk-vite-example", | ||
"version": "1.0.2", | ||
"description": "This example demonstrates how to use itk-wasm in a Rollup project that targets the browser.", | ||
"main": "index.js", | ||
"name": "itk-dicom", | ||
"version": "0.0.1", | ||
"description": "DICOM IO from itk-wasm", | ||
"type": "module", | ||
"main": "./dist/itk-dicom.umd.cjs", | ||
"module": "./dist/itk-dicom.js", | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./dist/itk-dicom.js", | ||
"require": "./dist/itk-dicom.umd.cjs" | ||
} | ||
}, | ||
"scripts": { | ||
"start": "vite --port 8080", | ||
"build": "vite build", | ||
"start:production": "vite preview --port 8080", | ||
"dev": "vite --port 8173", | ||
"build": "tsc && vite build --sourcemap", | ||
"build:watch": "tsc && vite build --minify false --mode development --watch", | ||
"cypress:open": "npx cypress open", | ||
"cypress:run": "npx cypress run", | ||
"cypress:runChrome": "npx cypress run --browser chrome", | ||
"cypress:runFirefox": "npx cypress run --browser firefox", | ||
"test:debug": "start-server-and-test start http-get://localhost:8080 cypress:open", | ||
"test": "start-server-and-test start:production http-get://localhost:8080 cypress:run", | ||
"test:chrome": "start-server-and-test start:production http-get://localhost:8080 cypress:runChrome", | ||
"test:firefox": "start-server-and-test start:production http-get://localhost:8080 cypress:runFirefox" | ||
"test:debug": "start-server-and-test dev http-get://localhost:8173 cypress:open", | ||
"test": "start-server-and-test dev http-get://localhost:8173 cypress:run", | ||
"test:chrome": "start-server-and-test dev http-get://localhost:8173 cypress:runChrome", | ||
"test:firefox": "start-server-and-test dev http-get://localhost:8173 cypress:runFirefox" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/InsightSoftwareConsortium/itk-wasm.git" | ||
"url": "https://github.com/InsightSoftwareConsortium/itk-wasm.git" | ||
}, | ||
"keywords": [ | ||
"itk", | ||
"rollup", | ||
"vite" | ||
"dicom" | ||
], | ||
"author": "Matt McCormick <[email protected]>", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/InsightSoftwareConsortium/itk-wasm/issues" | ||
}, | ||
"homepage": "https://github.com/InsightSoftwareConsortium/itk-wasm#readme", | ||
"homepage": "https://wasm.itk.org", | ||
"dependencies": { | ||
"curry": "^1.2.0", | ||
"itk-image-io": "^1.0.0-b.18", | ||
"itk-mesh-io": "^1.0.0-b.18", | ||
"itk-wasm": "^1.0.0-b.18" | ||
"itk-wasm": "^1.0.0-b.21" | ||
}, | ||
"devDependencies": { | ||
"cypress": "^10.3.0", | ||
"cypress": "^10.7.0", | ||
"rollup-plugin-copy": "^3.4.0", | ||
"start-server-and-test": "^1.14.0", | ||
"typescript": "^4.7.4", | ||
"vite": "^3.0.9" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
interface StructuredReportToTextOptions { | ||
/** Accept unknown relationship type */ | ||
unknownRelationship?: boolean | ||
|
||
/** Accept invalid content item value */ | ||
invalidItemValue?: boolean | ||
|
||
/** Ignore relationship constraints */ | ||
ignoreConstraints?: boolean | ||
|
||
/** Ignore content item errors */ | ||
ignoreItemErrors?: boolean | ||
|
||
/** Skip invalid content items */ | ||
skipInvalidItems?: boolean | ||
|
||
/** Print no document header */ | ||
noDocumentHeader?: boolean | ||
|
||
/** Number nested items */ | ||
numberNestedItems?: boolean | ||
|
||
/** Shorten long item values */ | ||
shortenLongValues?: boolean | ||
|
||
/** Print SOP Instance UID */ | ||
printInstanceUid?: boolean | ||
|
||
/** Print short SOP class name */ | ||
printSopclassShort?: boolean | ||
|
||
/** Print SOP class name */ | ||
printSopclassLong?: boolean | ||
|
||
/** Print long SOP class name */ | ||
printSopclassUid?: boolean | ||
|
||
/** Print all codes */ | ||
printAllCodes?: boolean | ||
|
||
/** Print invalid codes */ | ||
printInvalidCodes?: boolean | ||
|
||
/** Print template identification */ | ||
printTemplateId?: boolean | ||
|
||
/** Indicate enhanced encoding mode */ | ||
indicateEnhanced?: boolean | ||
|
||
/** Use ANSI escape codes */ | ||
printColor?: boolean | ||
|
||
} | ||
|
||
export default StructuredReportToTextOptions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
interface StructuredReportToTextResult { | ||
/** WebWorker used for computation */ | ||
webWorker: Worker | null | ||
|
||
/** Output text file */ | ||
outputText: string | ||
|
||
} | ||
|
||
export default StructuredReportToTextResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
|
||
import StructuredReportToTextResult from './StructuredReportToTextResult.js' | ||
export type { StructuredReportToTextResult } | ||
|
||
import StructuredReportToTextOptions from './StructuredReportToTextOptions.js' | ||
export type { StructuredReportToTextOptions } | ||
|
||
import structuredReportToText from './structuredReportToText.js' | ||
export { structuredReportToText } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const version = '1.0.0-b.21' | ||
|
||
const itkConfig = { | ||
pipelineWorkerUrl: '/dist/pipelines/web-workers/pipeline.worker.js', | ||
imageIOUrl: `https://cdn.jsdelivr.net/npm/itk-image-io@${version}`, | ||
meshIOUrl: `https://cdn.jsdelivr.net/npm/itk-mesh-io@${version}`, | ||
pipelinesUrl: '/dist/pipelines' | ||
} | ||
|
||
export default itkConfig |
Oops, something went wrong.