@3cr/viewer-browser 0.0.200 → 0.0.220
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +46 -22
- package/.prettierrc +6 -0
- package/components.d.ts +23 -10
- package/dist/Viewer3CR.js +37 -46
- package/dist/Viewer3CR.mjs +22625 -20892
- package/dist/Viewer3CR.umd.js +37 -46
- package/dist/android-chrome-192x192.png +0 -0
- package/dist/android-chrome-512x512.png +0 -0
- package/dist/apple-touch-icon.png +0 -0
- package/dist/browserconfig.xml +9 -0
- package/dist/favicon-16x16.png +0 -0
- package/dist/favicon-32x32.png +0 -0
- package/dist/favicon.ico +0 -0
- package/dist/mstile-144x144.png +0 -0
- package/dist/mstile-150x150.png +0 -0
- package/dist/mstile-310x150.png +0 -0
- package/dist/mstile-310x310.png +0 -0
- package/dist/mstile-70x70.png +0 -0
- package/dist/safari-pinned-tab.svg +50 -0
- package/dist/site.webmanifest +19 -0
- package/index.html +34 -41
- package/package.json +23 -20
- package/playground/android-chrome-192x192.png +0 -0
- package/playground/android-chrome-512x512.png +0 -0
- package/playground/apple-touch-icon.png +0 -0
- package/playground/browserconfig.xml +9 -0
- package/playground/favicon-16x16.png +0 -0
- package/playground/favicon-32x32.png +0 -0
- package/playground/favicon.ico +0 -0
- package/playground/index.html +26 -29
- package/playground/mstile-144x144.png +0 -0
- package/playground/mstile-150x150.png +0 -0
- package/playground/mstile-310x150.png +0 -0
- package/playground/mstile-310x310.png +0 -0
- package/playground/mstile-70x70.png +0 -0
- package/playground/safari-pinned-tab.svg +50 -0
- package/playground/site.webmanifest +19 -0
- package/playground/sw.js +15 -1
- package/public/android-chrome-192x192.png +0 -0
- package/public/android-chrome-512x512.png +0 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/browserconfig.xml +9 -0
- package/public/favicon-16x16.png +0 -0
- package/public/favicon-32x32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/mstile-144x144.png +0 -0
- package/public/mstile-150x150.png +0 -0
- package/public/mstile-310x150.png +0 -0
- package/public/mstile-310x310.png +0 -0
- package/public/mstile-70x70.png +0 -0
- package/public/safari-pinned-tab.svg +50 -0
- package/public/site.webmanifest +19 -0
- package/src/App.vue +35 -45
- package/src/__tests__/app.spec.ts +7 -8
- package/{__tests__/index.spec.ts → src/__tests__/main.spec.ts} +5 -6
- package/src/assets/logos/3dicom/white-mini.svg +20 -0
- package/src/assets/logos/3dicom/white.svg +30 -0
- package/src/assets/styles.scss +14 -4
- package/src/components/demo/__tests__/DemoModal.spec.ts +9 -8
- package/src/components/demo/__tests__/DemoPatientModal.spec.ts +11 -10
- package/src/components/demo/__tests__/options.spec.ts +1 -1
- package/src/components/demo/licence/__tests__/DemoLicenceEnableCloudStorageModal.spec.ts +11 -10
- package/src/components/demo/licence/__tests__/DemoLicenceInfoModal.spec.ts +21 -11
- package/src/components/demo/licence/__tests__/DemoLicenceSendToPartyModal.spec.ts +10 -10
- package/src/components/demo/licence/__tests__/DemoLicenceShareToMobileModal.spec.ts +14 -13
- package/src/components/demo/options.ts +54 -59
- package/src/components/demo/patient/__tests__/DemoPatientEnableCloudStorageModal.spec.ts +11 -10
- package/src/components/demo/patient/__tests__/DemoPatientInfoModal.spec.ts +12 -11
- package/src/components/demo/patient/__tests__/DemoPatientSendToPartyModal.spec.ts +10 -10
- package/src/components/demo/patient/__tests__/DemoPatientShareToMobileModal.spec.ts +14 -13
- package/src/components/modal/ActionRail.vue +7 -11
- package/src/components/modal/AskAI.vue +35 -50
- package/src/components/modal/CloseViewerModal.vue +22 -57
- package/src/components/modal/MftpWebGL3DRModal.vue +152 -570
- package/src/components/modal/ViewerActionRail.vue +50 -39
- package/src/components/modal/ViewerNavigationDrawer.vue +10 -8
- package/src/components/modal/ViewerNavigationDrawerContent.vue +82 -49
- package/src/components/modal/ViewerNavigationDrawerFooter.vue +57 -60
- package/src/components/modal/ViewerNavigationDrawerHeader.vue +13 -48
- package/src/components/modal/ViewerScanView.vue +114 -0
- package/src/components/modal/WebGL3DR.vue +84 -0
- package/src/components/modal/__tests__/ActionRail.spec.ts +10 -0
- package/src/components/modal/__tests__/AskAI.spec.ts +33 -0
- package/src/components/modal/__tests__/CloseViewerModal.spec.ts +24 -14
- package/src/components/modal/__tests__/MftpWebGL3DRModal.spec.ts +147 -176
- package/src/components/modal/__tests__/ViewerActionRail.spec.ts +11 -0
- package/src/components/modal/__tests__/ViewerNavigationDrawer.spec.ts +10 -12
- package/src/components/modal/__tests__/ViewerNavigationDrawerContent.spec.ts +4 -22
- package/src/components/modal/__tests__/ViewerNavigationDrawerFooter.spec.ts +35 -32
- package/src/components/modal/__tests__/ViewerNavigationDrawerHeader.spec.ts +11 -9
- package/src/components/modal/__tests__/ViewerScanView.spec.ts +60 -0
- package/src/components/modal/__tests__/WebGL3DR.spec.ts +57 -0
- package/src/components/modal/actions/Flip3dAction.vue +1 -1
- package/src/components/modal/actions/FlipHorizontalAction.vue +5 -10
- package/src/components/modal/actions/FlipVerticalAction.vue +5 -10
- package/src/components/modal/actions/FullscreenAction.vue +6 -11
- package/src/components/modal/actions/HideViewAction.vue +38 -0
- package/src/components/modal/actions/NavigationCubeAction.vue +7 -14
- package/src/components/modal/actions/PanAction.vue +4 -4
- package/src/components/modal/actions/ResetViewAction.vue +1 -1
- package/src/components/modal/actions/Rotate2dAction.vue +8 -20
- package/src/components/modal/actions/Slice3dAction.vue +10 -32
- package/src/components/modal/actions/ZoomAction.vue +1 -1
- package/src/components/modal/actions/__tests__/Action.spec.ts +8 -9
- package/src/components/modal/actions/__tests__/Flip3dAction.spec.ts +6 -8
- package/src/components/modal/actions/__tests__/FlipHorizontalAction.spec.ts +6 -7
- package/src/components/modal/actions/__tests__/FlipVerticalAction.spec.ts +6 -7
- package/src/components/modal/actions/__tests__/FullscreenAction.spec.ts +9 -10
- package/src/components/modal/actions/__tests__/NavigationCubeAction.spec.ts +11 -11
- package/src/components/modal/actions/__tests__/PanAction.spec.ts +9 -10
- package/src/components/modal/actions/__tests__/ResetViewAction.spec.ts +7 -7
- package/src/components/modal/actions/__tests__/Rotate2dAction.spec.ts +6 -8
- package/src/components/modal/actions/__tests__/Slice3dAction.spec.ts +23 -5
- package/src/components/modal/actions/__tests__/ZoomAction.spec.ts +8 -10
- package/src/components/modal/buttons/AutoAnnotateBtn.vue +29 -0
- package/src/components/modal/buttons/__tests__/AutoAnnotateBtn.spec.ts +28 -0
- package/src/components/modal/menus/FileMenu.vue +80 -0
- package/src/components/modal/menus/SettingsMenu.vue +111 -0
- package/src/components/modal/menus/__tests__/FileMenu.spec.ts +110 -0
- package/src/components/modal/menus/__tests__/SettingsMenu.spec.ts +71 -0
- package/src/components/shared/DoubleSliderSelector.vue +142 -0
- package/src/components/shared/UpdateSnackbar.vue +72 -0
- package/src/components/{selectors → shared}/ValueSelector.vue +9 -12
- package/src/components/shared/__tests__/DoubleSliderSelector.spec.ts +83 -0
- package/src/components/shared/__tests__/LoadingSpinner.spec.ts +9 -0
- package/src/components/shared/__tests__/UpdateSnackbar.spec.ts +116 -0
- package/src/components/shared/__tests__/ValueSelector.spec.ts +39 -0
- package/src/components/shared/__tests__/VerticalSliderSelector.spec.ts +50 -0
- package/src/components/views/AnnotationTreeView.vue +234 -0
- package/src/components/{modal/ViewerDisplaySettings.vue → views/DisplaySettings.vue} +7 -15
- package/src/components/views/MarkupTreeView.vue +199 -0
- package/src/components/views/McadObjectTreeView.vue +119 -0
- package/src/components/views/__tests__/AnnotationTreeView.spec.ts +62 -0
- package/src/components/{modal/__tests__/ViewerDisplaySettings.spec.ts → views/__tests__/DisplaySettings.spec.ts} +24 -20
- package/src/components/views/__tests__/MarkupTreeView.spec.ts +41 -0
- package/src/components/views/__tests__/McadObjectTreeView.spec.ts +47 -0
- package/src/components/views/modals/DataOverlayModal.vue +89 -0
- package/src/components/views/modals/DataOverlayModalManager.vue +104 -0
- package/src/components/views/modals/__tests__/DataOverlayModal.spec.ts +33 -0
- package/src/components/views/modals/__tests__/DataOverlayModalManager.spec.ts +93 -0
- package/src/components/views/shared/MaskIcon.vue +44 -0
- package/src/components/views/shared/ObjectColor.vue +31 -0
- package/src/components/views/shared/ObjectLabel.vue +30 -0
- package/src/components/views/shared/Opacity.vue +66 -0
- package/src/components/views/shared/VisibilityBtn.vue +25 -0
- package/src/components/views/shared/__tests__/MaskIcon.spec.ts +10 -0
- package/src/components/views/shared/__tests__/ObjectColor.spec.ts +10 -0
- package/src/components/views/shared/__tests__/ObjectLabel.spec.ts +10 -0
- package/src/components/views/shared/__tests__/Opacity.spec.ts +24 -0
- package/src/components/views/shared/__tests__/VisibilityBtn.spec.ts +11 -0
- package/src/components/views/types/annotation-tree-view-item-child-action.ts +6 -0
- package/src/components/views/types/annotation-tree-view-item-child.ts +9 -0
- package/src/components/views/types/annotation-tree-view-item.ts +13 -0
- package/src/components/views/types/markup-tree-view-item-child.ts +6 -0
- package/src/components/views/types/markup-tree-view-item.ts +14 -0
- package/src/components/views/types/mcad-object-tree-view-item.ts +13 -0
- package/src/composables/__tests__/useAnnotations.spec.ts +35 -0
- package/src/composables/__tests__/useEventListener.spec.ts +32 -0
- package/src/composables/__tests__/useIntroJs.spec.ts +51 -0
- package/src/composables/__tests__/useMarkups.spec.ts +39 -0
- package/src/composables/__tests__/useMcadObjects.spec.ts +36 -0
- package/src/composables/__tests__/useMouse.spec.ts +20 -0
- package/src/{components/modal/composables → composables}/__tests__/useNavigationCubeObserver.spec.ts +17 -12
- package/src/{dataLayer → composables}/__tests__/useViewer3cr.spec.ts +1 -2
- package/src/composables/useAnnotations.ts +37 -0
- package/src/composables/useEventListener.ts +25 -0
- package/src/composables/useIntroJs.ts +125 -0
- package/src/composables/useMarkups.ts +41 -0
- package/src/composables/useMcadObjects.ts +32 -0
- package/src/composables/useMouse.ts +14 -0
- package/src/{components/modal/composables → composables}/useNavigationCubeObserver.ts +35 -25
- package/src/composables/useScanMovement.ts +25 -0
- package/src/composables/useScanSliders.ts +36 -0
- package/src/composables/useVersion3cr.ts +7 -0
- package/src/composables/useViewer3cr.ts +7 -0
- package/src/composables/useViewerOptions.ts +35 -0
- package/src/{dataLayer → functions}/__tests__/clamp.spec.ts +1 -2
- package/src/functions/__tests__/layoutOverlayStyle.spec.ts +325 -0
- package/src/{helpers/__tests__/model-helper.spec.ts → functions/__tests__/modelHelper.spec.ts} +77 -40
- package/src/{notifications → functions}/__tests__/notification.spec.ts +19 -29
- package/src/functions/__tests__/parseAction.spec.ts +9 -0
- package/src/functions/__tests__/parseCallToAction.spec.ts +11 -0
- package/src/functions/__tests__/parseDataOverlay.spec.ts +15 -0
- package/src/functions/__tests__/parseDataOverlayData.spec.ts +9 -0
- package/src/functions/__tests__/parseDataOverlayEvent.spec.ts +10 -0
- package/src/functions/__tests__/parseMcadEvent.spec.ts +10 -0
- package/src/functions/layoutOverlayStyle.ts +84 -0
- package/src/{helpers → functions}/modelHelper.ts +79 -18
- package/src/{notifications → functions}/notification.ts +12 -14
- package/src/functions/parseAction.ts +9 -0
- package/src/functions/parseCallToAction.ts +9 -0
- package/src/functions/parseDataOverlay.ts +10 -0
- package/src/functions/parseDataOverlayData.ts +10 -0
- package/src/functions/parseDataOverlayEvent.ts +17 -0
- package/src/functions/parseMcadEvent.ts +10 -0
- package/src/functions/rgbaToCss.ts +13 -0
- package/src/main.ts +48 -9
- package/src/{dataLayer → models}/__tests__/eventHandlers.spec.ts +2 -3
- package/src/models/__tests__/loadViewerOptions.spec.ts +72 -0
- package/src/models/__tests__/loadViewerPayload.spec.ts +10 -0
- package/src/models/__tests__/scanState.spec.ts +190 -0
- package/src/models/callbacks.ts +4 -0
- package/src/models/loadViewerOptions.ts +40 -0
- package/src/models/loadViewerPayload.ts +24 -0
- package/src/{dataLayer → models}/scanState.ts +63 -74
- package/src/plugins/__tests__/usePlugins.spec.ts +12 -0
- package/src/plugins/__tests__/vuetify.spec.ts +3 -4
- package/src/plugins/usePlugins.ts +8 -0
- package/src/plugins/vuetify.ts +31 -65
- package/src/services/{gpt/__tests__ → __tests__}/gpt.service.spec.ts +2 -2
- package/src/services/__tests__/service-worker.service.spec.ts +32 -0
- package/src/{dataLayer/__tests__/viewer3cr.spec.ts → services/__tests__/viewer-3cr.service.spec.ts} +97 -36
- package/src/services/gpt.service.ts +17 -0
- package/src/services/service-worker.service.ts +16 -0
- package/src/{dataLayer/viewer3cr.ts → services/viewer-3cr.service.ts} +269 -150
- package/src/types/action.ts +13 -0
- package/src/types/call-to-action.ts +9 -0
- package/src/types/colour.ts +6 -0
- package/src/types/data-overlay-angle.ts +16 -0
- package/src/types/data-overlay-annotation.ts +18 -0
- package/src/types/data-overlay-data.ts +15 -0
- package/src/types/data-overlay-info.ts +14 -0
- package/src/types/data-overlay-interaction.ts +15 -0
- package/src/types/data-overlay-length.ts +16 -0
- package/src/types/data-overlay-markup.ts +7 -0
- package/src/types/data-overlay-mcad.ts +20 -0
- package/src/types/data-overlay-polygon.ts +18 -0
- package/src/types/data-overlay.ts +16 -0
- package/src/types/gpt-question.ts +4 -0
- package/src/types/gpt-response-payload.ts +6 -0
- package/src/types/mcad-object-interaction.ts +15 -0
- package/src/types/segment-angle.ts +5 -0
- package/src/types/vector2.ts +4 -0
- package/src/types/vector3.ts +5 -0
- package/test/fakers/action-data.faker.ts +11 -0
- package/test/fakers/action.faker.ts +19 -0
- package/test/fakers/call-to-action.faker.ts +17 -0
- package/test/fakers/colour.faker.ts +17 -0
- package/test/fakers/data-overlay-angle.faker.ts +37 -0
- package/test/fakers/data-overlay-annotation.faker.ts +41 -0
- package/test/fakers/data-overlay-data.faker.ts +97 -0
- package/test/fakers/data-overlay-info.faker.ts +29 -0
- package/test/fakers/data-overlay-interaction.faker.ts +62 -0
- package/test/fakers/data-overlay-length.faker.ts +37 -0
- package/test/fakers/data-overlay-mcad.faker.ts +40 -0
- package/test/fakers/data-overlay-polygon.faker.ts +39 -0
- package/test/fakers/gpt-question.faker.ts +11 -0
- package/test/fakers/gpt-response.faker.ts +12 -0
- package/test/fakers/invert-transform.faker.ts +16 -0
- package/test/fakers/mcad-object-interaction.faker.ts +22 -0
- package/test/fakers/orientation.faker.ts +17 -0
- package/test/fakers/segment-angle.faker.ts +12 -0
- package/test/fakers/vector2.faker.ts +12 -0
- package/test/fakers/vector3.faker.ts +16 -0
- package/test/plugins/findByTestId.ts +25 -0
- package/test/plugins/vuetify.ts +16 -0
- package/test/setup.ts +16 -5
- package/tsconfig.json +4 -15
- package/vite.config.mts +20 -46
- package/vitest.config.mts +24 -43
- package/index.ts +0 -72
- package/src/assets/images/dark/3DICOM.png +0 -0
- package/src/assets/images/dark/3dicom-logo.svg +0 -1
- package/src/assets/images/light/3DICOM.png +0 -0
- package/src/assets/images/light/3dicom-logo.svg +0 -1
- package/src/assets/logo.png +0 -0
- package/src/assets/logo.svg +0 -6
- package/src/components/WebGL3DR.vue +0 -102
- package/src/components/__tests__/webgl3dr.spec.ts +0 -37
- package/src/components/icons/liver.vue +0 -21
- package/src/components/loading/__tests__/loading-spinner.spec.ts +0 -11
- package/src/components/modal/ViewerAnnotationModal.vue +0 -111
- package/src/components/modal/ViewerAnnotations.vue +0 -289
- package/src/components/modal/__tests__/ViewerAnnotationModal.spec.ts +0 -79
- package/src/components/modal/composables/useEventListener.ts +0 -22
- package/src/components/selectors/__tests__/value-selector.spec.ts +0 -53
- package/src/components/sliders/DoubleSliderSelector.vue +0 -141
- package/src/components/sliders/__tests__/double-slider-selector.spec.ts +0 -104
- package/src/components/sliders/__tests__/vertical-slider-selector.spec.ts +0 -61
- package/src/dataLayer/__tests__/getIconForPreset.spec.ts +0 -40
- package/src/dataLayer/__tests__/patchDataOverlay.spec.ts +0 -88
- package/src/dataLayer/__tests__/scanState.spec.ts +0 -93
- package/src/dataLayer/getIconForPreset.ts +0 -11
- package/src/dataLayer/patchDataOverlay.ts +0 -101
- package/src/dataLayer/useViewer3cr.ts +0 -7
- package/src/helpers/__tests__/layout-overlay-style.spec.ts +0 -290
- package/src/helpers/__tests__/utils.spec.ts +0 -70
- package/src/helpers/layoutOverlayStyle.ts +0 -96
- package/src/helpers/utils.ts +0 -16
- package/src/models/Callbacks.ts +0 -2
- package/src/models/LoadViewerOptions.ts +0 -31
- package/src/models/LoadViewerPayload.ts +0 -9
- package/src/models/__tests__/load-viewer-options.spec.ts +0 -22
- package/src/plugins/__tests__/index.spec.ts +0 -19
- package/src/plugins/index.ts +0 -17
- package/src/services/gpt/gpt.service.ts +0 -35
- package/static/3cr-types-browser/index.ts +0 -74
- package/static/3cr-types-browser/types/Action.ts +0 -6
- package/static/3cr-types-browser/types/AlphaKeys.ts +0 -5
- package/static/3cr-types-browser/types/AnchorPoint.ts +0 -12
- package/static/3cr-types-browser/types/CallToAction.ts +0 -5
- package/static/3cr-types-browser/types/ColourData.ts +0 -7
- package/static/3cr-types-browser/types/ColourPresetData.ts +0 -9
- package/static/3cr-types-browser/types/CurrentDataOverlayState.ts +0 -6
- package/static/3cr-types-browser/types/CurrentScanState.ts +0 -22
- package/static/3cr-types-browser/types/DataOverlay.ts +0 -22
- package/static/3cr-types-browser/types/DataOverlayActions.ts +0 -14
- package/static/3cr-types-browser/types/DataOverlayData.ts +0 -8
- package/static/3cr-types-browser/types/DataOverlayEvent.ts +0 -8
- package/static/3cr-types-browser/types/DecryptionKey.ts +0 -4
- package/static/3cr-types-browser/types/DisplaySettings.ts +0 -10
- package/static/3cr-types-browser/types/EmptyPayload.ts +0 -3
- package/static/3cr-types-browser/types/EnumPayload.ts +0 -4
- package/static/3cr-types-browser/types/FileManagementActions.ts +0 -11
- package/static/3cr-types-browser/types/FlipValue.ts +0 -7
- package/static/3cr-types-browser/types/FrontEndInterfaces.ts +0 -14
- package/static/3cr-types-browser/types/GradientKeys.ts +0 -7
- package/static/3cr-types-browser/types/GreyscalePresetData.ts +0 -6
- package/static/3cr-types-browser/types/InitialDataOverlayState.ts +0 -6
- package/static/3cr-types-browser/types/InitialScanState.ts +0 -19
- package/static/3cr-types-browser/types/InteractionType.ts +0 -8
- package/static/3cr-types-browser/types/InteractivityActions.ts +0 -6
- package/static/3cr-types-browser/types/InteractivityState.ts +0 -4
- package/static/3cr-types-browser/types/InvertTransformData.ts +0 -6
- package/static/3cr-types-browser/types/LayoutActions.ts +0 -6
- package/static/3cr-types-browser/types/LayoutData.ts +0 -7
- package/static/3cr-types-browser/types/LoadDataSet.ts +0 -6
- package/static/3cr-types-browser/types/LoadSessionState.ts +0 -4
- package/static/3cr-types-browser/types/LocalLoadDataset.ts +0 -3
- package/static/3cr-types-browser/types/MovementData.ts +0 -7
- package/static/3cr-types-browser/types/NavigationCubeActions.ts +0 -8
- package/static/3cr-types-browser/types/NavigationCubeData.ts +0 -12
- package/static/3cr-types-browser/types/NavigationCubeTransform.ts +0 -9
- package/static/3cr-types-browser/types/NotificationPayload.ts +0 -7
- package/static/3cr-types-browser/types/NotificationsActions.ts +0 -6
- package/static/3cr-types-browser/types/Object.ts +0 -1
- package/static/3cr-types-browser/types/ObjectColour.ts +0 -7
- package/static/3cr-types-browser/types/ObjectIcon.ts +0 -5
- package/static/3cr-types-browser/types/ObjectInvert.ts +0 -7
- package/static/3cr-types-browser/types/ObjectSize.ts +0 -7
- package/static/3cr-types-browser/types/ObjectSize2D.ts +0 -7
- package/static/3cr-types-browser/types/ObjectVisible.ts +0 -5
- package/static/3cr-types-browser/types/PositionData.ts +0 -14
- package/static/3cr-types-browser/types/PresetsActions.ts +0 -4
- package/static/3cr-types-browser/types/RotationValue.ts +0 -7
- package/static/3cr-types-browser/types/ScanMovementActions.ts +0 -27
- package/static/3cr-types-browser/types/ScanMovementData.ts +0 -3
- package/static/3cr-types-browser/types/ScanOrientationActions.ts +0 -6
- package/static/3cr-types-browser/types/ScanStateActions.ts +0 -4
- package/static/3cr-types-browser/types/ScanView.ts +0 -6
- package/static/3cr-types-browser/types/SettingsData.ts +0 -12
- package/static/3cr-types-browser/types/SlicerData.ts +0 -9
- package/static/3cr-types-browser/types/SliderValue.ts +0 -4
- package/static/3cr-types-browser/types/SlidersActions.ts +0 -18
- package/static/3cr-types-browser/types/Vector2Data.ts +0 -5
- package/static/3cr-types-browser/types/Vector3Data.ts +0 -6
- package/static/3cr-types-browser/types/VectorMovementData.ts +0 -8
- package/static/3cr-types-browser/types/ViewInteractiveMode.ts +0 -5
- package/static/3cr-types-browser/types/ViewOrientation.ts +0 -8
- package/static/3cr-types-browser/types/ViewOrientations.ts +0 -10
- package/static/3cr-types-browser/types/ViewSelectionActions.ts +0 -9
- package/static/3cr-types-browser/types/ViewToggleData.ts +0 -7
- package/static/3cr-types-browser/types/VolumeOrientation.ts +0 -7
- package/test/helper.ts +0 -44
- /package/src/components/{loading → shared}/LoadingSpinner.vue +0 -0
- /package/src/components/{sliders → shared}/VerticalSliderSelector.vue +0 -0
- /package/{config.ts → src/config.ts} +0 -0
- /package/src/{dataLayer → functions}/clamp.ts +0 -0
- /package/src/{dataLayer → models}/eventHandlers.ts +0 -0
- /package/{static/3cr-types-browser/types/ActionData.ts → src/types/action-data.ts} +0 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-treeview
|
|
3
|
+
class="py-0 annotation-treeview"
|
|
4
|
+
:items="data"
|
|
5
|
+
item-value="id"
|
|
6
|
+
density="compact"
|
|
7
|
+
open-strategy="single"
|
|
8
|
+
@click:open="focusSlices"
|
|
9
|
+
>
|
|
10
|
+
<template #prepend="{ item }">
|
|
11
|
+
<visibility-btn :is-visible="item.isVisible" @click.stop="toggleVisibility(item)" />
|
|
12
|
+
</template>
|
|
13
|
+
<template #title="{ item }">
|
|
14
|
+
<object-label :label="item.title">
|
|
15
|
+
<template #prepend>
|
|
16
|
+
<mask-icon class="mr-2" :data="item.icon!" :color="getColor(item)" />
|
|
17
|
+
</template>
|
|
18
|
+
</object-label>
|
|
19
|
+
</template>
|
|
20
|
+
<template #item="{ props }">
|
|
21
|
+
<v-row no-gutters class="px-6 py-2">
|
|
22
|
+
<v-col cols="4">
|
|
23
|
+
<b>{{ props.key }}</b>
|
|
24
|
+
</v-col>
|
|
25
|
+
<v-col>
|
|
26
|
+
<span v-html="props.value"></span>
|
|
27
|
+
<template v-for="action in props.actions">
|
|
28
|
+
<v-chip
|
|
29
|
+
v-if="action.isBtn"
|
|
30
|
+
size="small"
|
|
31
|
+
label
|
|
32
|
+
variant="tonal"
|
|
33
|
+
class="action text-wrap mb-2"
|
|
34
|
+
@click="selectAction(action)"
|
|
35
|
+
>
|
|
36
|
+
{{ action.description }}
|
|
37
|
+
</v-chip>
|
|
38
|
+
<a v-else :href="action.url">{{ action.description }}</a>
|
|
39
|
+
<br />
|
|
40
|
+
</template>
|
|
41
|
+
</v-col>
|
|
42
|
+
</v-row>
|
|
43
|
+
</template>
|
|
44
|
+
</v-treeview>
|
|
45
|
+
<AskAI
|
|
46
|
+
v-model:modal="m_askAi"
|
|
47
|
+
:title="title"
|
|
48
|
+
:question-key="questionKey"
|
|
49
|
+
:question-text="questionText"
|
|
50
|
+
@askFollowup="askFollowUpQuestion"
|
|
51
|
+
>
|
|
52
|
+
</AskAI>
|
|
53
|
+
<div class="px-4 py-2 text-caption" style="font-size: 9px !important; line-height: 12px !important">
|
|
54
|
+
* 3Dicom's Annotiva AI is powered by AI Large Language Models (LLMs) which generate general health information for
|
|
55
|
+
improved patient comprehension.
|
|
56
|
+
<br /><br />It is NOT for diagnostic usage.
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script setup lang="ts">
|
|
61
|
+
import { nextTick, ref, watch } from 'vue';
|
|
62
|
+
import { SlidersActions } from '@3cr/types-ts';
|
|
63
|
+
import { initialScanState } from '@/models/scanState';
|
|
64
|
+
import { GptService } from '@/services/gpt.service';
|
|
65
|
+
import { useViewer3cr } from '@/composables/useViewer3cr';
|
|
66
|
+
import { rgbaNormalizedToCss } from '@/functions/rgbaToCss';
|
|
67
|
+
import { AnnotationTreeViewItem } from '@/components/views/types/annotation-tree-view-item';
|
|
68
|
+
import { AnnotationTreeViewItemChildAction } from '@/components/views/types/annotation-tree-view-item-child-action';
|
|
69
|
+
import { AnnotationTreeViewItemChild } from '@/components/views/types/annotation-tree-view-item-child';
|
|
70
|
+
import { DataOverlayAnnotation } from '@/types/data-overlay-annotation';
|
|
71
|
+
import { DataOverlayData } from '@/types/data-overlay-data';
|
|
72
|
+
import { GptResponsePayload } from '@/types/gpt-response-payload';
|
|
73
|
+
import { GptQuestion } from '@/types/gpt-question';
|
|
74
|
+
|
|
75
|
+
interface Props {
|
|
76
|
+
items: DataOverlayData<DataOverlayAnnotation>[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
80
|
+
items: () => []
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const viewer3cr = useViewer3cr();
|
|
84
|
+
const data = ref<AnnotationTreeViewItem[]>([]);
|
|
85
|
+
const aiData = ref<Record<string, GptResponsePayload>>({});
|
|
86
|
+
const m_askAi = ref<boolean>(false);
|
|
87
|
+
const questionKey = ref<number>(0);
|
|
88
|
+
const questionText = ref<string>('');
|
|
89
|
+
const title = ref<string>('');
|
|
90
|
+
|
|
91
|
+
function setTreeViewData(annotations: DataOverlayData<DataOverlayAnnotation>[]): void {
|
|
92
|
+
data.value = annotations.map((annotation) => mapToTreeViewItem(annotation));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
watch(
|
|
96
|
+
() => props.items,
|
|
97
|
+
async (items) => {
|
|
98
|
+
await generateAiData(items);
|
|
99
|
+
setTreeViewData(items);
|
|
100
|
+
},
|
|
101
|
+
{ immediate: true }
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
async function selectAction(action: AnnotationTreeViewItemChildAction): Promise<void> {
|
|
105
|
+
questionKey.value = Number(action.url);
|
|
106
|
+
questionText.value = action.description;
|
|
107
|
+
title.value = action.title;
|
|
108
|
+
m_askAi.value = true;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async function askFollowUpQuestion(question: GptQuestion): Promise<void> {
|
|
112
|
+
m_askAi.value = false;
|
|
113
|
+
await nextTick();
|
|
114
|
+
questionKey.value = question.ApiPreFilledRequestKey;
|
|
115
|
+
questionText.value = question.Question;
|
|
116
|
+
m_askAi.value = true;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async function toggleVisibility(annotation: AnnotationTreeViewItem): Promise<void> {
|
|
120
|
+
const value = { Id: annotation.id, Visibility: !annotation.isVisible };
|
|
121
|
+
await viewer3cr.toggle2dAnnotation(value);
|
|
122
|
+
await viewer3cr.toggle3dAnnotation(value);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function getColor(annotation: AnnotationTreeViewItem): string {
|
|
126
|
+
const { r, g, b, a } = annotation.colour;
|
|
127
|
+
return rgbaNormalizedToCss(r + 0.2, g + 0.2, b + 0.2, a - 0.2);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function mapToTreeViewItem(data: DataOverlayData<DataOverlayAnnotation>): AnnotationTreeViewItem {
|
|
131
|
+
return {
|
|
132
|
+
id: data.Data.Id,
|
|
133
|
+
title: data.Data.Title,
|
|
134
|
+
icon: data.Data.Icon2d,
|
|
135
|
+
isVisible: !!data.Data.Visibility2d && !!data.Data.Visibility3d,
|
|
136
|
+
colour: {
|
|
137
|
+
r: data.Data.Colour2d.R,
|
|
138
|
+
g: data.Data.Colour2d.G,
|
|
139
|
+
b: data.Data.Colour2d.B,
|
|
140
|
+
a: data.Data.Colour2d.A
|
|
141
|
+
},
|
|
142
|
+
position: {
|
|
143
|
+
x: data.Data.Position.X,
|
|
144
|
+
y: data.Data.Position.Y,
|
|
145
|
+
z: data.Data.Position.Z
|
|
146
|
+
},
|
|
147
|
+
children: mapToTreeViewItemChild(data)
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function mapToTreeViewItemChild(data: DataOverlayData<DataOverlayAnnotation>): AnnotationTreeViewItemChild[] {
|
|
152
|
+
return [
|
|
153
|
+
{
|
|
154
|
+
props: {
|
|
155
|
+
key: data.Data.Description ? 'Description' : 'Smart Description',
|
|
156
|
+
value: data.Data.Description || aiData.value[data.Data.Title]?.GptResponse || '',
|
|
157
|
+
actions: []
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
props: {
|
|
162
|
+
key: 'Resources',
|
|
163
|
+
value: '',
|
|
164
|
+
actions:
|
|
165
|
+
data.Data.CallToAction?.Actions.map((action) => ({
|
|
166
|
+
title: '',
|
|
167
|
+
description: action.ActionData.Description,
|
|
168
|
+
url: action.ActionData.Url,
|
|
169
|
+
isBtn: false
|
|
170
|
+
})) ?? []
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
props: {
|
|
175
|
+
key: 'Annotiva AI',
|
|
176
|
+
value: '',
|
|
177
|
+
actions:
|
|
178
|
+
aiData.value[data.Data.Title]?.FollowupQuestions.map((question) => ({
|
|
179
|
+
title: data.Data.Title,
|
|
180
|
+
description: question.Question,
|
|
181
|
+
url: question.ApiPreFilledRequestKey.toString(),
|
|
182
|
+
isBtn: true
|
|
183
|
+
})) ?? []
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
async function generateAiData(data: DataOverlayData<DataOverlayAnnotation>[]): Promise<void> {
|
|
190
|
+
await Promise.all(
|
|
191
|
+
data.map(async (d) => {
|
|
192
|
+
const key = d.Data.Title;
|
|
193
|
+
if (!(key in aiData.value)) {
|
|
194
|
+
aiData.value[key] = await GptService.Instantiate()
|
|
195
|
+
.GenerateAnnotations(key)
|
|
196
|
+
.then((data) => data.data)
|
|
197
|
+
.catch(() => ({ GptResponse: 'failed to execute', FollowupQuestions: [] }));
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
async function focusSlices(value: { id: unknown; value: boolean }): Promise<void> {
|
|
204
|
+
const item = data.value.find((annotation) => annotation.id === value.id);
|
|
205
|
+
if (value.value && item) {
|
|
206
|
+
const sagittal = Math.round(item.position.x / (initialScanState.value.XSpacing || 1));
|
|
207
|
+
const transverse = Math.round(item.position.y / (initialScanState.value.YSpacing || 1));
|
|
208
|
+
const coronal = Math.round(item.position.z / (initialScanState.value.ZSpacing || 1));
|
|
209
|
+
|
|
210
|
+
await viewer3cr.sliderHandler(SlidersActions.sl12, sagittal);
|
|
211
|
+
await viewer3cr.sliderHandler(SlidersActions.sl09, coronal);
|
|
212
|
+
await viewer3cr.sliderHandler(SlidersActions.sl15, transverse);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
</script>
|
|
216
|
+
|
|
217
|
+
<style lang="scss">
|
|
218
|
+
.annotation-treeview {
|
|
219
|
+
font-size: 12px;
|
|
220
|
+
|
|
221
|
+
.v-list-group ~ .v-list-group {
|
|
222
|
+
border-top: thin solid rgb(100%, 100%, 100%, var(--v-border-opacity));
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.v-chip.action {
|
|
226
|
+
text-wrap: wrap;
|
|
227
|
+
word-wrap: break-word;
|
|
228
|
+
min-height: 42px;
|
|
229
|
+
line-height: 14px !important;
|
|
230
|
+
height: unset;
|
|
231
|
+
padding: 4px 8px;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
</style>
|
|
@@ -3,20 +3,16 @@
|
|
|
3
3
|
<v-row no-gutters>
|
|
4
4
|
<v-col>
|
|
5
5
|
<DoubleSliderSelector
|
|
6
|
-
id="skin-to-bone"
|
|
7
|
-
v-model:value="windowSlider"
|
|
8
6
|
v-bind="huMinMax"
|
|
7
|
+
v-model:model-value="windowSlider"
|
|
8
|
+
id="skin-to-bone"
|
|
9
9
|
label="Skin to Bone"
|
|
10
10
|
/>
|
|
11
11
|
</v-col>
|
|
12
12
|
</v-row>
|
|
13
13
|
<v-row no-gutters>
|
|
14
14
|
<v-col>
|
|
15
|
-
<DoubleSliderSelector
|
|
16
|
-
v-model:value="thresholdSlider"
|
|
17
|
-
v-bind="huMinMax"
|
|
18
|
-
label="Fine Adjustment"
|
|
19
|
-
/>
|
|
15
|
+
<DoubleSliderSelector v-bind="huMinMax" v-model:model-value="thresholdSlider" label="Fine Adjustment" />
|
|
20
16
|
</v-col>
|
|
21
17
|
</v-row>
|
|
22
18
|
<v-row no-gutters>
|
|
@@ -37,11 +33,7 @@
|
|
|
37
33
|
@update:model-value="onGreyscalePresetChange"
|
|
38
34
|
>
|
|
39
35
|
<template #item="{ props, item }">
|
|
40
|
-
<v-list-item
|
|
41
|
-
v-bind="props"
|
|
42
|
-
:title="item.raw.Name"
|
|
43
|
-
lines="three"
|
|
44
|
-
>
|
|
36
|
+
<v-list-item v-bind="props" :title="item.raw.Name" lines="three">
|
|
45
37
|
<template v-slot:subtitle>
|
|
46
38
|
Skin Density:
|
|
47
39
|
<span class="text-mono">{{ item.raw.Lower }}</span>
|
|
@@ -86,9 +78,9 @@ import {
|
|
|
86
78
|
initialScanState,
|
|
87
79
|
thresholdSlider,
|
|
88
80
|
windowSlider
|
|
89
|
-
} from
|
|
90
|
-
import { ColourPresetData, GreyscalePresetData, PresetsActions } from
|
|
91
|
-
import { useViewer3cr } from
|
|
81
|
+
} from '@/models/scanState';
|
|
82
|
+
import { ColourPresetData, GreyscalePresetData, PresetsActions } from '@3cr/types-ts';
|
|
83
|
+
import { useViewer3cr } from '@/composables/useViewer3cr';
|
|
92
84
|
|
|
93
85
|
const viewer3cr = useViewer3cr();
|
|
94
86
|
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-treeview
|
|
3
|
+
class="py-0"
|
|
4
|
+
:items="data"
|
|
5
|
+
item-value="id"
|
|
6
|
+
density="compact"
|
|
7
|
+
open-strategy="single"
|
|
8
|
+
@click:open="focusSlices"
|
|
9
|
+
>
|
|
10
|
+
<template #prepend="{ item }">
|
|
11
|
+
<visibility-btn :is-visible="item.isVisible" @click.stop="toggleVisibility(item)" />
|
|
12
|
+
</template>
|
|
13
|
+
<template #title="{ item }">
|
|
14
|
+
<object-label :label="item.title" :icon="item.icon" :color="item.colour" />
|
|
15
|
+
</template>
|
|
16
|
+
<template #item="{ props }">
|
|
17
|
+
<v-list-item class="info" density="compact">
|
|
18
|
+
<v-row no-gutters>
|
|
19
|
+
<v-col class="key">
|
|
20
|
+
<b>{{ props.key }}</b>
|
|
21
|
+
</v-col>
|
|
22
|
+
<v-col class="value">
|
|
23
|
+
<span class="text-mono" v-html="props.value"></span>
|
|
24
|
+
</v-col>
|
|
25
|
+
</v-row>
|
|
26
|
+
</v-list-item>
|
|
27
|
+
</template>
|
|
28
|
+
</v-treeview>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script setup lang="ts">
|
|
32
|
+
import { ref, watch } from 'vue';
|
|
33
|
+
import { DataOverlayType, SlidersActions } from '@3cr/types-ts';
|
|
34
|
+
import { useViewer3cr } from '@/composables/useViewer3cr';
|
|
35
|
+
import { initialScanState } from '@/models/scanState';
|
|
36
|
+
import { MarkupTreeViewItem } from '@/components/views/types/markup-tree-view-item';
|
|
37
|
+
import { DataOverlayLength } from '@/types/data-overlay-length';
|
|
38
|
+
import { DataOverlayPolygon } from '@/types/data-overlay-polygon';
|
|
39
|
+
import { DataOverlayAngle } from '@/types/data-overlay-angle';
|
|
40
|
+
import { MarkupTreeViewItemChild } from '@/components/views/types/markup-tree-view-item-child';
|
|
41
|
+
import { DataOverlayData } from '@/types/data-overlay-data';
|
|
42
|
+
import { DataOverlayMarkup } from '@/types/data-overlay-markup';
|
|
43
|
+
|
|
44
|
+
interface Props {
|
|
45
|
+
items: DataOverlayData<DataOverlayMarkup>[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
49
|
+
items: () => []
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const viewer3cr = useViewer3cr();
|
|
53
|
+
const data = ref<MarkupTreeViewItem[]>([]);
|
|
54
|
+
|
|
55
|
+
watch(
|
|
56
|
+
() => props.items,
|
|
57
|
+
(items) => {
|
|
58
|
+
setTreeViewData(items);
|
|
59
|
+
},
|
|
60
|
+
{ immediate: true }
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
function setTreeViewData(markups: DataOverlayData<DataOverlayMarkup>[]): void {
|
|
64
|
+
data.value = markups.map((markup) => mapToTreeViewItem(markup));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function getMarkupColour(data: DataOverlayData<DataOverlayMarkup>): string {
|
|
68
|
+
switch (data.DataType) {
|
|
69
|
+
case DataOverlayType.Length:
|
|
70
|
+
return 'green';
|
|
71
|
+
case DataOverlayType.Polygon:
|
|
72
|
+
return 'red';
|
|
73
|
+
case DataOverlayType.Angle:
|
|
74
|
+
return 'blue';
|
|
75
|
+
default:
|
|
76
|
+
return 'white';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function getMarkupIcon(data: DataOverlayData<DataOverlayMarkup>): string {
|
|
81
|
+
switch (data.DataType) {
|
|
82
|
+
case DataOverlayType.Length:
|
|
83
|
+
return 'straighten';
|
|
84
|
+
case DataOverlayType.Polygon:
|
|
85
|
+
return 'pentagon';
|
|
86
|
+
case DataOverlayType.Angle:
|
|
87
|
+
return 'circle';
|
|
88
|
+
default:
|
|
89
|
+
return 'question_mark';
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function getMarkupTooltip(data: DataOverlayData<DataOverlayMarkup>): string {
|
|
94
|
+
switch (data.DataType) {
|
|
95
|
+
case DataOverlayType.Length:
|
|
96
|
+
return 'Length';
|
|
97
|
+
case DataOverlayType.Polygon:
|
|
98
|
+
return 'Polygon';
|
|
99
|
+
case DataOverlayType.Angle:
|
|
100
|
+
return 'Angle';
|
|
101
|
+
default:
|
|
102
|
+
return '';
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function getMarkupInfo(data: DataOverlayData<DataOverlayMarkup>): MarkupTreeViewItemChild[] {
|
|
107
|
+
switch (data.DataType) {
|
|
108
|
+
case DataOverlayType.Length:
|
|
109
|
+
return getLengthInfo(data.Data as DataOverlayLength);
|
|
110
|
+
case DataOverlayType.Polygon:
|
|
111
|
+
return getPolygonInfo(data.Data as DataOverlayPolygon);
|
|
112
|
+
case DataOverlayType.Angle:
|
|
113
|
+
return getAngleInfo(data.Data as DataOverlayAngle);
|
|
114
|
+
default:
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function getLengthInfo(markup: DataOverlayLength): MarkupTreeViewItemChild[] {
|
|
120
|
+
return [
|
|
121
|
+
...markup.SegmentLengths.map((seg, idx) => ({
|
|
122
|
+
props: { key: `Segment ${idx + 1}`, value: `${seg}${markup.Units}` }
|
|
123
|
+
})),
|
|
124
|
+
{ props: { key: 'Total Length', value: `${markup.TotalLength}${markup.Units}` } }
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function getPolygonInfo(markup: DataOverlayPolygon): MarkupTreeViewItemChild[] {
|
|
129
|
+
return [
|
|
130
|
+
{ props: { key: 'Area', value: `${markup.Area}` } },
|
|
131
|
+
{ props: { key: 'Perimeter', value: `${markup.Perimeter}` } },
|
|
132
|
+
{ props: { key: 'Average HU', value: `${markup.AverageHU}` } },
|
|
133
|
+
{ props: { key: 'Lowest HU', value: `${markup.LowestHU}` } },
|
|
134
|
+
{ props: { key: 'Highest HU', value: `${markup.HighestHU}` } }
|
|
135
|
+
];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function getAngleInfo(markup: DataOverlayAngle): MarkupTreeViewItemChild[] {
|
|
139
|
+
return markup.SegmentAngles.map((seg, idx) => {
|
|
140
|
+
return { props: { key: `Segment ${idx + 1}`, value: `${seg.Acute}${markup.Units}` } };
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async function toggleVisibility(item: MarkupTreeViewItem): Promise<void> {
|
|
145
|
+
await viewer3cr.setMarkupVisibility(item.id, !item.isVisible);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function mapToTreeViewItem(data: DataOverlayData<DataOverlayMarkup>): MarkupTreeViewItem {
|
|
149
|
+
return {
|
|
150
|
+
id: data.Data.Id,
|
|
151
|
+
title: data.Data.Title,
|
|
152
|
+
description: data.Data.Description,
|
|
153
|
+
isVisible: !!data.Data.Visibility2d && !!data.Data.Visibility3d,
|
|
154
|
+
tooltip: getMarkupTooltip(data),
|
|
155
|
+
colour: getMarkupColour(data),
|
|
156
|
+
icon: getMarkupIcon(data),
|
|
157
|
+
position: {
|
|
158
|
+
x: data.Data.Points[0].X,
|
|
159
|
+
y: data.Data.Points[0].Y,
|
|
160
|
+
z: data.Data.Points[0].Z
|
|
161
|
+
},
|
|
162
|
+
children: getMarkupInfo(data)
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async function focusSlices(value: { id: unknown; value: boolean }): Promise<void> {
|
|
167
|
+
const item = data.value.find((markup) => markup.id === value.id);
|
|
168
|
+
if (value.value && item) {
|
|
169
|
+
const { x, y, z } = item.position;
|
|
170
|
+
const { XSpacing, YSpacing, ZSpacing } = initialScanState.value;
|
|
171
|
+
await viewer3cr.sliderHandler(SlidersActions.sl09, z / (ZSpacing || 1));
|
|
172
|
+
await viewer3cr.sliderHandler(SlidersActions.sl12, x / (XSpacing || 1));
|
|
173
|
+
await viewer3cr.sliderHandler(SlidersActions.sl15, y / (YSpacing || 1));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
</script>
|
|
177
|
+
|
|
178
|
+
<style scoped>
|
|
179
|
+
.info {
|
|
180
|
+
min-height: 20px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.key,
|
|
184
|
+
.value {
|
|
185
|
+
font-size: 12px;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.key {
|
|
189
|
+
text-align: left;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.value {
|
|
193
|
+
text-align: right;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
:deep(.v-list-group ~ .v-list-group) {
|
|
197
|
+
border-top: thin solid rgb(100%, 100%, 100%, var(--v-border-opacity));
|
|
198
|
+
}
|
|
199
|
+
</style>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-treeview class="py-0" :items="data" item-value="id" density="compact" open-strategy="single">
|
|
3
|
+
<template #prepend="{ item }">
|
|
4
|
+
<visibility-btn :is-visible="item.isVisible" @click.stop="toggleVisibility(item)" />
|
|
5
|
+
</template>
|
|
6
|
+
<template #title="{ item }">
|
|
7
|
+
<div class="d-flex align-center pr-2">
|
|
8
|
+
<object-label class="mr-1" :label="item.title">
|
|
9
|
+
<template #prepend>
|
|
10
|
+
<object-color class="ml-1 mr-2" :color="getColor(item)" />
|
|
11
|
+
</template>
|
|
12
|
+
</object-label>
|
|
13
|
+
<v-spacer />
|
|
14
|
+
<opacity
|
|
15
|
+
:model-value="getOpacity(item)"
|
|
16
|
+
@update:model-value="onOpacityUpdate(item, $event)"
|
|
17
|
+
@mousedown.stop
|
|
18
|
+
@click.stop
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
<template #append="{ item }">
|
|
23
|
+
<v-menu>
|
|
24
|
+
<template #activator="{ props }">
|
|
25
|
+
<v-btn v-bind="props" data-testid="menu" size="32" variant="text" icon="more_vert" />
|
|
26
|
+
</template>
|
|
27
|
+
<v-list>
|
|
28
|
+
<v-list-item data-testid="download" prepend-icon="download" @click="downloadMcad(item.key)">
|
|
29
|
+
<v-list-item-title>Download</v-list-item-title>
|
|
30
|
+
</v-list-item>
|
|
31
|
+
</v-list>
|
|
32
|
+
</v-menu>
|
|
33
|
+
</template>
|
|
34
|
+
</v-treeview>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script setup lang="ts">
|
|
38
|
+
import { ref, watch } from 'vue';
|
|
39
|
+
import { useViewer3cr } from '@/composables/useViewer3cr';
|
|
40
|
+
import { clamp } from '@/functions/clamp';
|
|
41
|
+
import { rgbaNormalizedToCss } from '@/functions/rgbaToCss';
|
|
42
|
+
import { useViewerOptions } from '@/composables/useViewerOptions';
|
|
43
|
+
import { McadObjectTreeViewItem } from '@/components/views/types/mcad-object-tree-view-item';
|
|
44
|
+
import { DataOverlayMcad } from '@/types/data-overlay-mcad';
|
|
45
|
+
|
|
46
|
+
interface Props {
|
|
47
|
+
items: DataOverlayMcad[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
51
|
+
items: () => []
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const viewer3cr = useViewer3cr();
|
|
55
|
+
const options = useViewerOptions();
|
|
56
|
+
const data = ref<McadObjectTreeViewItem[]>([]);
|
|
57
|
+
|
|
58
|
+
watch(
|
|
59
|
+
() => props.items,
|
|
60
|
+
(items) => {
|
|
61
|
+
setTreeViewData(items);
|
|
62
|
+
},
|
|
63
|
+
{ immediate: true }
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
function setTreeViewData(mcadObjects: DataOverlayMcad[]): void {
|
|
67
|
+
data.value = mcadObjects.map((mcadObject) => mapToTreeViewItem(mcadObject));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async function downloadMcad(id: string): Promise<void> {
|
|
71
|
+
if (options.value.OnDownloadMcad) {
|
|
72
|
+
await options.value.OnDownloadMcad(id);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function getColor(item: McadObjectTreeViewItem): string {
|
|
77
|
+
const { r, g, b, a } = item.colour;
|
|
78
|
+
return rgbaNormalizedToCss(r + 0.2, g + 0.2, b + 0.2, a - 0.2);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function getOpacity(item: McadObjectTreeViewItem): number {
|
|
82
|
+
return Math.round(item.colour.a * 100);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function mapToTreeViewItem(data: DataOverlayMcad): McadObjectTreeViewItem {
|
|
86
|
+
return {
|
|
87
|
+
id: data.Id,
|
|
88
|
+
key: data.Key,
|
|
89
|
+
title: data.Title,
|
|
90
|
+
description: data.Description,
|
|
91
|
+
isVisible: data.Visibility,
|
|
92
|
+
colour: {
|
|
93
|
+
r: data.Colour.R,
|
|
94
|
+
g: data.Colour.G,
|
|
95
|
+
b: data.Colour.B,
|
|
96
|
+
a: data.Colour.A
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async function onOpacityUpdate(item: McadObjectTreeViewItem, value: number): Promise<void> {
|
|
102
|
+
if (value) {
|
|
103
|
+
const a = clamp(value, 0, 100) / 100;
|
|
104
|
+
const { r, g, b } = item.colour;
|
|
105
|
+
await viewer3cr.setMcadObjectColour({ Id: item.id, Colour: { Version: '1.2.0', R: r, G: g, B: b, A: a } });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async function toggleVisibility(item: McadObjectTreeViewItem): Promise<void> {
|
|
110
|
+
const visibility = !item.isVisible;
|
|
111
|
+
await viewer3cr.setMcadObjectVisibility({ Id: item.id, Visibility: visibility });
|
|
112
|
+
}
|
|
113
|
+
</script>
|
|
114
|
+
|
|
115
|
+
<style scoped>
|
|
116
|
+
:deep(.v-list-group ~ .v-list-group) {
|
|
117
|
+
border-top: thin solid rgb(100%, 100%, 100%, var(--v-border-opacity));
|
|
118
|
+
}
|
|
119
|
+
</style>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { flushPromises, mount } from '@vue/test-utils';
|
|
2
|
+
import { faker } from '@faker-js/faker';
|
|
3
|
+
import { DataOverlayDataFaker } from '@test/fakers/data-overlay-data.faker';
|
|
4
|
+
import AnnotationTreeView from '@/components/views/AnnotationTreeView.vue';
|
|
5
|
+
import { GptService } from '@/services/gpt.service';
|
|
6
|
+
import { GptResponseFaker } from '@test/fakers/gpt-response.faker';
|
|
7
|
+
import VisibilityBtn from '@/components/views/shared/VisibilityBtn.vue';
|
|
8
|
+
import { useViewer3cr } from '@/composables/useViewer3cr';
|
|
9
|
+
import ObjectLabel from '@/components/views/shared/ObjectLabel.vue';
|
|
10
|
+
import { VCard, VChip } from 'vuetify/components';
|
|
11
|
+
import AskAI from '@/components/modal/AskAI.vue';
|
|
12
|
+
|
|
13
|
+
const gpt = GptResponseFaker.random();
|
|
14
|
+
|
|
15
|
+
describe('AnnotationTreeView tests', () => {
|
|
16
|
+
vi.spyOn(GptService.prototype, 'GenerateAnnotations').mockResolvedValue({ data: gpt } as any);
|
|
17
|
+
|
|
18
|
+
it('should mount', async () => {
|
|
19
|
+
const items = faker.helpers.multiple(DataOverlayDataFaker.annotation, { count: 3 });
|
|
20
|
+
const props = { items };
|
|
21
|
+
const wrapper = mount(AnnotationTreeView, { props });
|
|
22
|
+
await flushPromises();
|
|
23
|
+
expect(wrapper).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('should toggle visibility', async () => {
|
|
27
|
+
const viewer3cr = useViewer3cr();
|
|
28
|
+
const toggle2d = vi.spyOn(viewer3cr, 'toggle2dAnnotation').mockImplementation(vi.fn());
|
|
29
|
+
const toggle3d = vi.spyOn(viewer3cr, 'toggle3dAnnotation').mockImplementation(vi.fn());
|
|
30
|
+
|
|
31
|
+
const items = faker.helpers.multiple(DataOverlayDataFaker.annotation, { count: 3 });
|
|
32
|
+
const props = { items };
|
|
33
|
+
const wrapper = mount(AnnotationTreeView, { props });
|
|
34
|
+
await flushPromises();
|
|
35
|
+
await wrapper.findComponent(VisibilityBtn).trigger('click');
|
|
36
|
+
|
|
37
|
+
expect(toggle2d).toHaveBeenCalled();
|
|
38
|
+
expect(toggle3d).toHaveBeenCalled();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should focus slices', async () => {
|
|
42
|
+
const viewer3cr = useViewer3cr();
|
|
43
|
+
const sliderHandler = vi.spyOn(viewer3cr, 'sliderHandler').mockImplementation(vi.fn());
|
|
44
|
+
|
|
45
|
+
const items = faker.helpers.multiple(DataOverlayDataFaker.annotation, { count: 3 });
|
|
46
|
+
const props = { items };
|
|
47
|
+
const wrapper = mount(AnnotationTreeView, { props });
|
|
48
|
+
await flushPromises();
|
|
49
|
+
await wrapper.findComponent(ObjectLabel).trigger('click');
|
|
50
|
+
|
|
51
|
+
expect(sliderHandler).toHaveBeenCalledTimes(3);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('should select AI action', async () => {
|
|
55
|
+
const items = faker.helpers.multiple(DataOverlayDataFaker.annotation, { count: 3 });
|
|
56
|
+
const props = { items };
|
|
57
|
+
const wrapper = mount(AnnotationTreeView, { props });
|
|
58
|
+
await flushPromises();
|
|
59
|
+
await wrapper.findComponent(VChip).trigger('click');
|
|
60
|
+
expect(wrapper.findComponent(AskAI).findComponent(VCard).exists()).toBeTruthy();
|
|
61
|
+
});
|
|
62
|
+
});
|