|
| 1 | +import { PROSTATEX_DATASET } from './configTestUtils'; |
| 2 | +import { downloadFile, openVolViewPage, writeManifestToZip } from './utils'; |
| 3 | + |
| 4 | +describe('Sparse manifest with prostate rectangle', () => { |
| 5 | + it('loads prostate dataset with lesion rectangle annotation', async () => { |
| 6 | + await downloadFile(PROSTATEX_DATASET.url, PROSTATEX_DATASET.name); |
| 7 | + |
| 8 | + const sparseManifest = { |
| 9 | + version: '6.1.0', |
| 10 | + dataSources: [ |
| 11 | + { |
| 12 | + id: 0, |
| 13 | + type: 'uri', |
| 14 | + uri: `/tmp/${PROSTATEX_DATASET.name}`, |
| 15 | + }, |
| 16 | + ], |
| 17 | + tools: { |
| 18 | + rectangles: { |
| 19 | + tools: [ |
| 20 | + { |
| 21 | + imageID: '0', |
| 22 | + frameOfReference: { |
| 23 | + planeNormal: [ |
| 24 | + 1.4080733262381892e-17, 0.24192188680171967, |
| 25 | + 0.9702957272529602, |
| 26 | + ], |
| 27 | + planeOrigin: [ |
| 28 | + -117.91325380387, -75.35208187384475, 52.136969503946816, |
| 29 | + ], |
| 30 | + }, |
| 31 | + slice: 9, |
| 32 | + firstPoint: [ |
| 33 | + -65.36087045590452, -15.919061788109012, 37.31865385684797, |
| 34 | + ], |
| 35 | + secondPoint: [ |
| 36 | + 22.78165684736155, 47.65944636974224, 21.46675198654735, |
| 37 | + ], |
| 38 | + label: 'lesion', |
| 39 | + }, |
| 40 | + ], |
| 41 | + labels: { |
| 42 | + lesion: { |
| 43 | + labelName: 'lesion', |
| 44 | + color: 'red', |
| 45 | + strokeWidth: 1, |
| 46 | + fillColor: 'transparent', |
| 47 | + }, |
| 48 | + }, |
| 49 | + }, |
| 50 | + }, |
| 51 | + }; |
| 52 | + |
| 53 | + const fileName = 'sparse-prostate-lesion-rectangle.volview.zip'; |
| 54 | + await writeManifestToZip(sparseManifest, fileName); |
| 55 | + await openVolViewPage(fileName); |
| 56 | + |
| 57 | + const annotationsTab = await $( |
| 58 | + 'button[data-testid="module-tab-Annotations"]' |
| 59 | + ); |
| 60 | + await annotationsTab.click(); |
| 61 | + |
| 62 | + const measurementsTab = await $('button.v-tab*=Measurements'); |
| 63 | + await measurementsTab.waitForClickable(); |
| 64 | + await measurementsTab.click(); |
| 65 | + |
| 66 | + await browser.waitUntil( |
| 67 | + async () => { |
| 68 | + const rectangleEntries = await $$( |
| 69 | + '.v-list-item i.mdi-vector-square.tool-icon' |
| 70 | + ); |
| 71 | + const count = await rectangleEntries.length; |
| 72 | + return count >= 1; |
| 73 | + }, |
| 74 | + { |
| 75 | + timeout: 10000, |
| 76 | + timeoutMsg: 'Rectangle tool not found in measurements list', |
| 77 | + } |
| 78 | + ); |
| 79 | + |
| 80 | + await browser.waitUntil( |
| 81 | + async () => { |
| 82 | + const listItemTitles = await $$('.v-list-item .v-list-item-title'); |
| 83 | + for (const title of listItemTitles) { |
| 84 | + const text = await title.getText(); |
| 85 | + if (text.includes('lesion')) return true; |
| 86 | + } |
| 87 | + return false; |
| 88 | + }, |
| 89 | + { |
| 90 | + timeout: 5000, |
| 91 | + timeoutMsg: 'Lesion label not found on rectangle annotation', |
| 92 | + } |
| 93 | + ); |
| 94 | + }); |
| 95 | +}); |
0 commit comments