-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(dcmqi-browser): add e2e browser tests
- Loading branch information
Showing
34 changed files
with
1,430 additions
and
14 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
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
2 changes: 1 addition & 1 deletion
2
packages/dicom/python/itkwasm-dicom-emscripten/itkwasm_dicom_emscripten/js_package.py
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file modified
BIN
-11 Bytes
(100%)
...sm-dicom-wasi/itkwasm_dicom_wasi/wasm_modules/apply-presentation-state-to-image.wasi.wasm
Binary file not shown.
Binary file modified
BIN
-11 Bytes
(100%)
.../itkwasm-dicom-wasi/itkwasm_dicom_wasi/wasm_modules/read-dicom-encapsulated-pdf.wasi.wasm
Binary file not shown.
Binary file modified
BIN
+158 Bytes
(100%)
...itkwasm-dicom-wasi/itkwasm_dicom_wasi/wasm_modules/read-image-dicom-file-series.wasi.wasm
Binary file not shown.
Binary file modified
BIN
+628 Bytes
(100%)
...tkwasm-dicom-wasi/itkwasm_dicom_wasi/wasm_modules/read-overlapping-segmentation.wasi.wasm
Binary file not shown.
Binary file modified
BIN
+639 Bytes
(100%)
...com/python/itkwasm-dicom-wasi/itkwasm_dicom_wasi/wasm_modules/read-segmentation.wasi.wasm
Binary file not shown.
Binary file modified
BIN
-24 Bytes
(100%)
...on/itkwasm-dicom-wasi/itkwasm_dicom_wasi/wasm_modules/structured-report-to-html.wasi.wasm
Binary file not shown.
Binary file modified
BIN
-10 Bytes
(100%)
...on/itkwasm-dicom-wasi/itkwasm_dicom_wasi/wasm_modules/structured-report-to-text.wasi.wasm
Binary file not shown.
Binary file modified
BIN
+597 Bytes
(100%)
...hon/itkwasm-dicom-wasi/itkwasm_dicom_wasi/wasm_modules/write-multi-segmentation.wasi.wasm
Binary file not shown.
Binary file modified
BIN
+600 Bytes
(100%)
...kwasm-dicom-wasi/itkwasm_dicom_wasi/wasm_modules/write-overlapping-segmentation.wasi.wasm
Binary file not shown.
Binary file modified
BIN
+602 Bytes
(100%)
...om/python/itkwasm-dicom-wasi/itkwasm_dicom_wasi/wasm_modules/write-segmentation.wasi.wasm
Binary file not shown.
32 changes: 32 additions & 0 deletions
32
packages/dicom/typescript/cypress/e2e/read-overlapping-segmentation.cy.ts
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,32 @@ | ||
import { demoServer } from './common.ts' | ||
|
||
describe('readOverlappingSegmentation', () => { | ||
beforeEach(function() { | ||
cy.visit(demoServer) | ||
|
||
const testPathPrefix = '../test/data/output/' | ||
|
||
// Read the input file | ||
const inputFile = 'liver_heart_seg.dcm' | ||
const inputFilePath = `${testPathPrefix}${inputFile}` | ||
cy.readFile(inputFilePath, null).as('inputFile') | ||
}) | ||
|
||
it('reads segmentation from a dicom file', function () { | ||
cy.get('sl-tab[panel="readOverlappingSegmentation-panel"]').click() | ||
|
||
cy.get('#readOverlappingSegmentationInputs input[name="dicom-file-file"]').selectFile({ contents: new Uint8Array(this.inputFile), fileName: 'inputData.dcm' }, { force: true }) | ||
|
||
cy.get('#readOverlappingSegmentationInputs sl-button[name="run"]').click() | ||
|
||
cy.get('#readOverlappingSegmentation-seg-image-details').should('exist') | ||
//cy.get('#readOverlappingSegmentation-seg-image-details').should('contain', '"pixelType": "VariableLengthVector"') | ||
|
||
cy.get('#readOverlappingSegmentation-meta-info-details').should('contain', '"SegmentLabel": "Liver"') | ||
cy.get('#readOverlappingSegmentation-meta-info-details').should('contain', '"labelID": 1') | ||
cy.get('#readOverlappingSegmentation-meta-info-details').should('contain', '"SegmentLabel": "Thoracic spine"') | ||
cy.get('#readOverlappingSegmentation-meta-info-details').should('contain', '"labelID": 2') | ||
cy.get('#readOverlappingSegmentation-meta-info-details').should('contain', '"SegmentLabel": "Heart"') | ||
cy.get('#readOverlappingSegmentation-meta-info-details').should('contain', '"labelID": 3') | ||
}) | ||
}) |
27 changes: 27 additions & 0 deletions
27
packages/dicom/typescript/cypress/e2e/read-segmentation.cy.ts
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,27 @@ | ||
import { demoServer } from './common.ts' | ||
|
||
describe('readSegmentation', () => { | ||
beforeEach(function() { | ||
cy.visit(demoServer) | ||
|
||
const testPathPrefix = '../test/data/input/dicom-images/' | ||
|
||
// Read the input file | ||
const inputFile = 'SEG/ReMIND-001/tumor_seg_MR_ref_3DSAGT2SPACE/1-1.dcm' | ||
const inputFilePath = `${testPathPrefix}${inputFile}` | ||
cy.readFile(inputFilePath, null).as('inputFile') | ||
}) | ||
|
||
it('reads segmentation from a dicom file', function () { | ||
cy.get('sl-tab[panel="readSegmentation-panel"]').click() | ||
|
||
cy.get('#readSegmentationInputs input[name="dicom-file-file"]').selectFile({ contents: new Uint8Array(this.inputFile), fileName: 'inputData.dcm' }, { force: true }) | ||
|
||
cy.get('#readSegmentationInputs sl-button[name="run"]').click() | ||
|
||
cy.get('#readSegmentation-seg-image-details').should('exist') | ||
|
||
cy.get('#readSegmentation-meta-info-details').should('contain', '"labelID": 1') | ||
cy.get('#readSegmentation-meta-info-details').should('contain', '"BodyPartExamined": "BRAIN"') | ||
}) | ||
}) |
64 changes: 64 additions & 0 deletions
64
packages/dicom/typescript/cypress/e2e/write-multi-segmentation.cy.ts
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,64 @@ | ||
import { demoServer } from './common.ts' | ||
|
||
describe('writeMultiSegmentation', () => { | ||
beforeEach(function() { | ||
cy.visit(demoServer) | ||
|
||
const dcmqi_lib_SOURCE_DIR = '../emscripten-build/_deps/dcmqi_lib-src/' | ||
|
||
// Read the input file | ||
const segImages = [ | ||
'data/segmentations/partial_overlaps-1.nrrd', | ||
'data/segmentations/partial_overlaps-2.nrrd', | ||
'data/segmentations/partial_overlaps-3.nrrd', | ||
] | ||
cy.readFile(`${dcmqi_lib_SOURCE_DIR}${segImages[0]}`, null).as('input0.nrrd') | ||
cy.readFile(`${dcmqi_lib_SOURCE_DIR}${segImages[1]}`, null).as('input1.nrrd') | ||
cy.readFile(`${dcmqi_lib_SOURCE_DIR}${segImages[2]}`, null).as('input2.nrrd') | ||
|
||
/* | ||
const inputFile = 'SEG/overlapping/overlapping-seg.nrrd' | ||
const inputFilePath = `${dcmqi_lib_SOURCE_DIR}${inputFile}` | ||
cy.readFile(inputFilePath, null).as('inputFile') | ||
*/ | ||
|
||
const metaInfoFile = 'doc/examples/seg-example_partial_overlaps.json' | ||
const metaInfoFilePath = `${dcmqi_lib_SOURCE_DIR}${metaInfoFile}` | ||
cy.readFile(metaInfoFilePath, null).as('metaInfoFile')//.should('not.equal', null) | ||
|
||
const refFiles = [ | ||
'data/segmentations/ct-3slice/01.dcm', | ||
'data/segmentations/ct-3slice/02.dcm', | ||
'data/segmentations/ct-3slice/03.dcm', | ||
] | ||
cy.readFile(`${dcmqi_lib_SOURCE_DIR}${refFiles[0]}`, null).as('ref0.dcm') | ||
cy.readFile(`${dcmqi_lib_SOURCE_DIR}${refFiles[1]}`, null).as('ref1.dcm') | ||
cy.readFile(`${dcmqi_lib_SOURCE_DIR}${refFiles[2]}`, null).as('ref2.dcm') | ||
}) | ||
|
||
it('writes a segmentation image to a dicom file', function () { | ||
cy.get('sl-tab[panel="writeMultiSegmentation-panel"]').click() | ||
|
||
const inputFiles = [] | ||
for(let i = 0; i < 3; i++) { | ||
inputFiles.push({ contents: new Uint8Array(this[`input${i}.nrrd`]), fileName: `input${i}.nrrd` }) | ||
} | ||
cy.get('#writeMultiSegmentationInputs input[name="seg-images-file"]').selectFile( inputFiles, { force: true }) | ||
cy.get('#writeMultiSegmentationInputs input[name=meta-info-file]').selectFile({ contents: new Uint8Array(this.metaInfoFile), fileName: 'input-metainfo.json' }, { force: true }) | ||
cy.get('#writeMultiSegmentationInputs sl-input[name=output-dicom-file]').find('input', { includeShadowDom: true }).type('output-write-segmentation.dcm', { force: true }) | ||
|
||
const refFiles = [] | ||
for(let i = 0; i < 3; i++) { | ||
refFiles.push({ contents: new Uint8Array(this[`ref${i}.dcm`]), fileName: `ref${i}.dcm` }) | ||
} | ||
cy.get('#writeMultiSegmentationInputs input[name="ref-dicom-series-file"]').selectFile( refFiles, { force: true }) | ||
|
||
//cy.get('#writeMultiSegmentationInputs sl-button[name="run"]').should('be.enabled') | ||
cy.get('#writeMultiSegmentationInputs sl-button[name=run]').find('button', { includeShadowDom: true }).should('be.enabled') | ||
cy.get('#writeMultiSegmentationInputs sl-button[name="run"]').click() | ||
|
||
//cy.get('#writeMultiSegmentation-seg-images-details').should('exist') | ||
cy.get('#writeMultiSegmentation-output-dicom-file-details').should('exist') | ||
cy.get('#writeMultiSegmentation-output-dicom-file-details').should('contain', '0,0,0,0,0,0,0,0,0,0,0,') | ||
}) | ||
}) |
48 changes: 48 additions & 0 deletions
48
packages/dicom/typescript/cypress/e2e/write-overlapping-segmentation.cy.ts
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,48 @@ | ||
import { demoServer } from './common.ts' | ||
|
||
describe('writeOverlappingSegmentation', () => { | ||
beforeEach(function() { | ||
cy.visit(demoServer) | ||
|
||
const testPathPrefix1 = '../test/data/input/dicom-images/SEG/writeOverlappingSegmentation/' | ||
const dcmqi_lib_SOURCE_DIR = '../emscripten-build/_deps/dcmqi_lib-src/' | ||
|
||
// Read the input file | ||
const inputFile = 'segImage.nrrd' | ||
cy.readFile(`${testPathPrefix1}${inputFile}`, null).as('inputFile') | ||
|
||
const metaInfoFile = 'metaInfo.json' | ||
cy.readFile(`${testPathPrefix1}${metaInfoFile}`, null).as('metaInfoFile') | ||
|
||
const refFiles = [ | ||
'data/segmentations/ct-3slice/01.dcm', | ||
'data/segmentations/ct-3slice/02.dcm', | ||
'data/segmentations/ct-3slice/03.dcm', | ||
] | ||
cy.readFile(`${dcmqi_lib_SOURCE_DIR}${refFiles[0]}`, null).as('ref0.dcm') | ||
cy.readFile(`${dcmqi_lib_SOURCE_DIR}${refFiles[1]}`, null).as('ref1.dcm') | ||
cy.readFile(`${dcmqi_lib_SOURCE_DIR}${refFiles[2]}`, null).as('ref2.dcm') | ||
}) | ||
|
||
it('writes a segmentation image to a dicom file', function () { | ||
cy.get('sl-tab[panel="writeOverlappingSegmentation-panel"]').click() | ||
|
||
cy.get('#writeOverlappingSegmentationInputs input[name=seg-image-file]').selectFile({ contents: new Uint8Array(this.inputFile), fileName: 'segImage.nrrd' }, { force: true }) | ||
cy.get('#writeOverlappingSegmentationInputs input[name=meta-info-file]').selectFile({ contents: new Uint8Array(this.metaInfoFile), fileName: 'metaInfo.json' }, { force: true }) | ||
cy.get('#writeOverlappingSegmentationInputs sl-input[name=output-dicom-file]').find('input', { includeShadowDom: true }).type('output-write-segmentation.dcm', { force: true }) | ||
|
||
const refFiles = [] | ||
for(let i = 0; i < 3; i++) { | ||
refFiles.push({ contents: new Uint8Array(this[`ref${i}.dcm`]), fileName: `ref${i}.dcm` }) | ||
} | ||
cy.get('#writeOverlappingSegmentationInputs input[name="ref-dicom-series-file"]').selectFile( refFiles, { force: true }) | ||
|
||
// need to click twice for some reason `\/O\/` | ||
cy.get('#writeOverlappingSegmentationInputs sl-button[name=run]').find('button', { includeShadowDom: true }).should('be.enabled') | ||
cy.get('#writeOverlappingSegmentationInputs sl-button[name=run]').click() | ||
|
||
//cy.get('#writeOverlappingSegmentation-seg-image-details').should('exist') | ||
cy.get('#writeOverlappingSegmentation-output-dicom-file-details').should('exist') | ||
cy.get('#writeOverlappingSegmentation-output-dicom-file-details').should('contain', '0,0,0,0,0,0,0,0,0,0,0,') | ||
}) | ||
}) |
54 changes: 54 additions & 0 deletions
54
packages/dicom/typescript/cypress/e2e/write-segmentation.cy.ts
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,54 @@ | ||
import { demoServer } from './common.ts' | ||
|
||
describe('writeSegmentation', () => { | ||
beforeEach(function() { | ||
cy.visit(demoServer) | ||
|
||
const testPathPrefix = '../test/data/input/dicom-images/' | ||
|
||
// Read the input file | ||
const inputFile = 'SEG/ReMIND-001/tumor_seg_MR_ref_3DSAGT2SPACE.nrrd' | ||
const inputFilePath = `${testPathPrefix}${inputFile}` | ||
cy.readFile(inputFilePath, null).as('inputFile') | ||
|
||
const metaInfoFile = 'SEG/MR_ref_3DSAGT2SPACE_tumor_seg.json' | ||
const metaInfoFilePath = `../test/data/baseline/dicom-images/${metaInfoFile}` | ||
cy.readFile(metaInfoFilePath, null).as('metaInfoFile')//.should('not.equal', null) | ||
|
||
const refFiles = [ | ||
"SEG/ReMIND-001/3DSAGT2SPACE/1-001.dcm", | ||
"SEG/ReMIND-001/3DSAGT2SPACE/1-002.dcm", | ||
"SEG/ReMIND-001/3DSAGT2SPACE/1-003.dcm", | ||
] | ||
cy.readFile(`${testPathPrefix}${refFiles[0]}`, null).as('ref0.dcm') | ||
cy.readFile(`${testPathPrefix}${refFiles[1]}`, null).as('ref1.dcm') | ||
cy.readFile(`${testPathPrefix}${refFiles[2]}`, null).as('ref2.dcm') | ||
}) | ||
|
||
it('writes a segmentation image to a dicom file', function () { | ||
cy.get('sl-tab[panel="writeSegmentation-panel"]').click() | ||
|
||
cy.get('#writeSegmentationInputs input[name=seg-image-file]').selectFile({ contents: new Uint8Array(this.inputFile), fileName: 'inputData.nrrd' }, { force: true }) | ||
cy.get('#writeSegmentationInputs input[name=meta-info-file]').selectFile({ contents: new Uint8Array(this.metaInfoFile), fileName: 'inputData.json' }, { force: true }) | ||
|
||
cy.get('#writeSegmentationInputs sl-input[name=output-dicom-file]').find('input', { includeShadowDom: true }).type('output_write_segmentation.dcm', { force: true }) | ||
//cy.get('#niftiWriteImageInputs sl-input[name="serialized-image"]').find('input', { includeShadowDom: true }).type('r16slice.nii.gz', { force: true }) | ||
//cy.get('#writeSegmentationInputs input[name="output-dicom-file"]').type('output_tumor_seg_MR_ref_3DSAGT2SPACE.dcm') | ||
|
||
const inputFiles = [] | ||
for(let i = 0; i < 3; i++) { | ||
inputFiles.push({ contents: new Uint8Array(this[`ref${i}.dcm`]), fileName: `ref${i}.dcm` }) | ||
} | ||
cy.get('#writeSegmentationInputs input[name="ref-dicom-series-file"]').selectFile( inputFiles, { force: true }) | ||
|
||
// need to click twice for some reason `\/O\/` | ||
cy.get('#writeSegmentationInputs sl-button[name="run"]').click() | ||
cy.get('#writeSegmentationInputs sl-button[name="run"]').click() | ||
|
||
cy.get('#writeSegmentation-seg-image-details').should('exist') | ||
cy.get('#writeSegmentation-output-dicom-file-details').should('exist') | ||
cy.get('#writeSegmentation-output-dicom-file-details').should('contain', '0,0,0,0,0,0,0,0,0,0,0,') | ||
//cy.get('#writeSegmentation-meta-info-details').should('contain', '"labelID": 1') | ||
//cy.get('#writeSegmentation-meta-info-details').should('contain', '"BodyPartExamined": "BRAIN"') | ||
}) | ||
}) |
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
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
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
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
Oops, something went wrong.