diff --git a/src/atlasComponents/sapiViews/core/rich/module.ts b/src/atlasComponents/sapiViews/core/rich/module.ts index ff6369902efd5f0d9d6703241ce4cc45414f1596..90ce115ed0e3711bad377fbfc8790620dbbadf42 100644 --- a/src/atlasComponents/sapiViews/core/rich/module.ts +++ b/src/atlasComponents/sapiViews/core/rich/module.ts @@ -3,6 +3,7 @@ import { NgModule } from "@angular/core"; import { ReactiveFormsModule } from "@angular/forms"; import { SxplrFlatHierarchyModule } from "src/components/flatHierarchy"; import { AngularMaterialModule } from "src/sharedModules"; +import { SapiViewsUtilModule } from "../../util"; import { SapiViewsCoreRegionModule } from "../region"; import { HighlightPipe } from "./regionsHierarchy/highlight.pipe"; import { SapiViewsCoreRichRegionsHierarchy } from "./regionsHierarchy/regionsHierarchy.component"; @@ -15,6 +16,7 @@ import { SapiViewsCoreRichRegionListSearch } from "./regionsListSearch/regionLis ReactiveFormsModule, SapiViewsCoreRegionModule, SxplrFlatHierarchyModule, + SapiViewsUtilModule, ], declarations: [ SapiViewsCoreRichRegionListSearch, diff --git a/src/atlasComponents/sapiViews/features/receptors/autoradiography/autoradiography.style.css b/src/atlasComponents/sapiViews/features/receptors/autoradiography/autoradiography.style.css index 833dd425a375f37daf5e6e5c9bade25acf79ac1f..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/src/atlasComponents/sapiViews/features/receptors/autoradiography/autoradiography.style.css +++ b/src/atlasComponents/sapiViews/features/receptors/autoradiography/autoradiography.style.css @@ -1,5 +0,0 @@ -:host >>> canvas -{ - max-width: 100%; - max-height: 100%; -} \ No newline at end of file diff --git a/src/extra_styles.css b/src/extra_styles.css index 4dc17c826004add9df28f132625f4fd7b9f39d51..d7e99033c285ee0b2f3894cadd4dae90631098c3 100644 --- a/src/extra_styles.css +++ b/src/extra_styles.css @@ -871,3 +871,9 @@ quick-tour-unit svg stroke-linecap: round; stroke-linejoin: round; } + +sxplr-sapiviews-features-receptor-autoradiograph canvas +{ + max-width: 100%; + max-height: 100%; +} diff --git a/src/state/annotations/index.ts b/src/state/annotations/index.ts index e044bea3dee02127fed851a564f49d95d3be6f26..4071cad11b68b6473c88bb7d7374a4d1de77767d 100644 --- a/src/state/annotations/index.ts +++ b/src/state/annotations/index.ts @@ -1,4 +1,4 @@ export { actions } from "./actions" -export { Annotation, AnnotationState, reducer } from "./store" +export { Annotation, AnnotationState, reducer, defaultState } from "./store" export { nameSpace } from "./const" export * as selectors from "./selectors" \ No newline at end of file diff --git a/src/state/annotations/store.ts b/src/state/annotations/store.ts index 6278ac4e6520ca06fc0ce4daf55c019685e22ed6..2cb8146bfabd329d4a80b60bb3dff6c9a41663f8 100644 --- a/src/state/annotations/store.ts +++ b/src/state/annotations/store.ts @@ -8,7 +8,7 @@ export type AnnotationState = { annotations: Annotation[] } -const defaultState: AnnotationState = { +export const defaultState: AnnotationState = { annotations: [] } diff --git a/src/state/atlasAppearance/index.ts b/src/state/atlasAppearance/index.ts index 6d95a7d9cbaf54679e0040637bda231b79003f1c..53a3eef5781ec04e4b25d47807401571290a2016 100644 --- a/src/state/atlasAppearance/index.ts +++ b/src/state/atlasAppearance/index.ts @@ -1,4 +1,4 @@ export * as actions from "./action" export * as selectors from "./selector" export { nameSpace, ColorMapCustomLayer, CustomLayer, NgLayerCustomLayer } from "./const" -export { reducer, AtlasAppearanceStore } from "./store" \ No newline at end of file +export { reducer, AtlasAppearanceStore, defaultState } from "./store" \ No newline at end of file diff --git a/src/state/atlasAppearance/store.ts b/src/state/atlasAppearance/store.ts index 648104a70910a795d74c2de55c4bd12b5abe9b6e..6c060da26b4696af0865d0f5c545fdc0d42cffd4 100644 --- a/src/state/atlasAppearance/store.ts +++ b/src/state/atlasAppearance/store.ts @@ -9,7 +9,7 @@ export type AtlasAppearanceStore = { customLayers: CustomLayer[] } -const defaultState: AtlasAppearanceStore = { +export const defaultState: AtlasAppearanceStore = { octantRemoval: true, showDelineation: true, customLayers: [] diff --git a/src/state/atlasSelection/store.ts b/src/state/atlasSelection/store.ts index d051a5475cbd806ae2a7a8535ce7e0878926f33f..11ac3f534822446d832b86567a669b9c86f5d34d 100644 --- a/src/state/atlasSelection/store.ts +++ b/src/state/atlasSelection/store.ts @@ -3,6 +3,12 @@ import { SapiAtlasModel, SapiParcellationModel, SapiRegionModel, SapiSpaceModel import * as actions from "./actions" import { ViewerMode, BreadCrumb } from "./const" +function getRegionLabelIndex(atlas: SapiAtlasModel, tmpl: SapiSpaceModel, parc: SapiParcellationModel, region: SapiRegionModel) { + const lblIdx = Number(region?.hasAnnotation?.internalIdentifier) + if (isNaN(lblIdx)) return null + return lblIdx +} + export type AtlasSelectionState = { selectedAtlas: SapiAtlasModel selectedTemplate: SapiSpaceModel @@ -87,9 +93,10 @@ const reducer = createReducer( * * ignore */ + const { selectedAtlas, selectedParcellation, selectedTemplate } = state if ( !region.hasAnnotation?.visualizedIn - && region.hasAnnotation?.internalIdentifier === 'unknown' + && !getRegionLabelIndex(selectedAtlas, selectedTemplate, selectedParcellation, region) ) { return { ...state } } diff --git a/src/state/plugins/index.ts b/src/state/plugins/index.ts index 11548c69ffd13af7819fb9c2a67c9fc189d725db..d7324fb2780ab0dbe36ab4968208ecf5a40b45a6 100644 --- a/src/state/plugins/index.ts +++ b/src/state/plugins/index.ts @@ -1,5 +1,5 @@ export * as selectors from "./selectors" export * as actions from "./actions" -export { reducer, PluginStore } from "./store" +export { reducer, PluginStore, defaultState } from "./store" export { Effects } from "./effects" export { nameSpace, INIT_MANIFEST_SRC } from "./const" \ No newline at end of file diff --git a/src/state/plugins/store.ts b/src/state/plugins/store.ts index 0648d1fa68c2dd6e631ef975984c8f005966f810..83bb211ec912966efade6b361faced1dd43ede0c 100644 --- a/src/state/plugins/store.ts +++ b/src/state/plugins/store.ts @@ -6,7 +6,7 @@ export type PluginStore = { initManifests: Record<string, string> } -const defaultState: PluginStore = { +export const defaultState: PluginStore = { initManifests: {} } diff --git a/src/state/userInteraction/actions.ts b/src/state/userInteraction/actions.ts index 2030f734431beb8f36e86dd21e673c522173636a..d7b237184a58a7135c23350235c9776063a7af95 100644 --- a/src/state/userInteraction/actions.ts +++ b/src/state/userInteraction/actions.ts @@ -1,22 +1,8 @@ import { createAction, props } from "@ngrx/store" import { nameSpace } from "./const" -import * as atlasSelection from "../atlasSelection" -import { SapiRegionModel, SapiSpatialFeatureModel, SapiVolumeModel } from "src/atlasComponents/sapi" -import * as userInterface from "../userInterface" +import { SapiRegionModel } from "src/atlasComponents/sapi" import { SapiFeatureModel } from "src/atlasComponents/sapi/type" -export const { - clearSelectedRegions, - clearStandAloneVolumes, - clearNonBaseParcLayer, -} = atlasSelection.actions - -export const { - openSidePanel, - closeSidePanel, - expandSidePanelDetailView, -} = userInterface.actions - export const mouseOverAnnotations = createAction( `${nameSpace} mouseOverAnnotations`, props<{ diff --git a/src/state/userInteraction/effects.ts b/src/state/userInteraction/effects.ts index ee8baa706e67df5746b163fa59f11cb01855bc33..5d4986ad5965117705e6d1aa869407fabdbd8a65 100644 --- a/src/state/userInteraction/effects.ts +++ b/src/state/userInteraction/effects.ts @@ -1,14 +1,14 @@ import { Injectable } from "@angular/core"; import { Actions, createEffect, ofType } from "@ngrx/effects"; -import * as actions from "./actions" import * as atlasSelectionActions from "../atlasSelection/actions" +import * as userInterface from "../userInterface" import { mapTo } from "rxjs/operators"; @Injectable() export class Effect { onStandAloneVolumesExistCloseMatDrawer = createEffect(() => this.action.pipe( ofType(atlasSelectionActions.clearStandAloneVolumes), - mapTo(actions.closeSidePanel()) + mapTo(userInterface.actions.closeSidePanel()) )) constructor(private action: Actions){ diff --git a/src/state/userInteraction/index.ts b/src/state/userInteraction/index.ts index 4903f7b16fe5d859f2a437fee17e2602de9081b9..44d760341b10d264fcdda4ee28ad157b760a705b 100644 --- a/src/state/userInteraction/index.ts +++ b/src/state/userInteraction/index.ts @@ -2,4 +2,4 @@ export { Effect } from "./effects" export { nameSpace } from "./const" export * as actions from "./actions" export * as selectors from "./selectors" -export { reducer, UserInteraction } from "./store" \ No newline at end of file +export { reducer, UserInteraction, defaultState } from "./store" \ No newline at end of file diff --git a/src/state/userInteraction/store.ts b/src/state/userInteraction/store.ts index 0ce97c2ff9c60708d2867fb93af6a9d660520c21..9d7368e8e114b5d76a32ec0f825893b45b08739e 100644 --- a/src/state/userInteraction/store.ts +++ b/src/state/userInteraction/store.ts @@ -7,7 +7,7 @@ export type UserInteraction = { selectedFeature: SapiFeatureModel } -const defaultState: UserInteraction = { +export const defaultState: UserInteraction = { selectedFeature: null, mouseoverRegions: [] } diff --git a/src/state/userInterface/index.ts b/src/state/userInterface/index.ts index 2329de3b38bacb0d8a648ee9fe13a911c8b92bb4..382825ba33d4ae79a439f9e8cce8fc909c020bf5 100644 --- a/src/state/userInterface/index.ts +++ b/src/state/userInterface/index.ts @@ -1,5 +1,5 @@ export * as actions from "./actions" export * as selectors from "./selectors" export { nameSpace, PanelMode } from "./const" -export { reducer, UiStore } from "./store" +export { reducer, UiStore, defaultState } from "./store" export { Effects } from "./effects" diff --git a/src/state/userInterface/store.ts b/src/state/userInterface/store.ts index 3fcea7d7ea721ac95d7ca1c15201d0b217a3881f..cc854e820d61e94cbee9b5b95f988dbe9db0ec58 100644 --- a/src/state/userInterface/store.ts +++ b/src/state/userInterface/store.ts @@ -9,7 +9,7 @@ export type UiStore = { showDelineation: boolean } -const defaultStore: UiStore = { +export const defaultState: UiStore = { panelMode: 'FOUR_PANEL', panelOrder: '0123', octantRemoval: false, @@ -17,7 +17,7 @@ const defaultStore: UiStore = { } export const reducer = createReducer( - defaultStore, + defaultState, on( actions.setPanelMode, (state, { panelMode }) => { diff --git a/src/state/userPreference/index.ts b/src/state/userPreference/index.ts index e8e485b4dce9109c0ad98801d0ac7fe320184690..1c7a493f7e1b35fc13e4ab3d552774ddad640b4f 100644 --- a/src/state/userPreference/index.ts +++ b/src/state/userPreference/index.ts @@ -1,4 +1,4 @@ -export { UserPreference, defaultUserPreferenceStore, reducer } from "./store" +export { UserPreference, reducer, defaultState } from "./store" export { nameSpace } from "./const" export * as actions from "./actions" export * as selectors from "./selectors" diff --git a/src/state/userPreference/store.ts b/src/state/userPreference/store.ts index b80d510d82bb095b02ade524e391636dff531425..dbf0be95561efd8992d77a54e6c33db4f6f2c7a8 100644 --- a/src/state/userPreference/store.ts +++ b/src/state/userPreference/store.ts @@ -15,7 +15,7 @@ export type UserPreference = { agreeKgTos: boolean } -export const defaultUserPreferenceStore: UserPreference = { +export const defaultState: UserPreference = { useMobileUi: JSON.parse(localStorage.getItem(LOCAL_STORAGE_CONST.MOBILE_UI)), gpuLimit: Number(localStorage.getItem(LOCAL_STORAGE_CONST.GPU_LIMIT)) || defaultGpuLimit, useAnimation: !localStorage.getItem(LOCAL_STORAGE_CONST.ANIMATION), @@ -26,7 +26,7 @@ export const defaultUserPreferenceStore: UserPreference = { } export const reducer = createReducer( - defaultUserPreferenceStore, + defaultState, on( actions.setAnimationFlag, (state, { flag }) => { diff --git a/src/viewerModule/viewerCmp/viewerCmp.component.ts b/src/viewerModule/viewerCmp/viewerCmp.component.ts index 02e48a907ca71600df58d375310b8bad80607bc2..de8f1abaff91a96e83f3ef400cde3a75927f068f 100644 --- a/src/viewerModule/viewerCmp/viewerCmp.component.ts +++ b/src/viewerModule/viewerCmp/viewerCmp.component.ts @@ -11,8 +11,7 @@ import { ContextMenuService, TContextMenuReg } from "src/contextMenuModule"; import { ComponentStore } from "../componentStore"; import { DialogService } from "src/services/dialogService.service"; import { SAPI, SapiRegionModel } from "src/atlasComponents/sapi"; -import { actions, fromRootStore } from "src/state/atlasSelection"; -import { atlasSelection, userInteraction } from "src/state"; +import { atlasSelection, userInteraction, } from "src/state"; import { SapiSpatialFeatureModel, SapiFeatureModel, SapiParcellationModel } from "src/atlasComponents/sapi/type"; type TCStoreViewerCmp = { @@ -117,7 +116,7 @@ export class ViewerCmp implements OnDestroy { ) public allAvailableParcellations$ = this.store$.pipe( - fromRootStore.allAvailParcs(this.sapi) + atlasSelection.fromRootStore.allAvailParcs(this.sapi) ) public selectedRegions$ = this.store$.pipe( @@ -318,13 +317,13 @@ export class ViewerCmp implements OnDestroy { public clearRoi(){ this.store$.dispatch( - actions.clearSelectedRegions() + atlasSelection.actions.clearSelectedRegions() ) } public selectRoi(roi: SapiRegionModel) { this.store$.dispatch( - actions.selectRegion({ + atlasSelection.actions.selectRegion({ region: roi }) ) @@ -332,7 +331,7 @@ export class ViewerCmp implements OnDestroy { public exitSpecialViewMode(){ this.store$.dispatch( - actions.clearViewerMode() + atlasSelection.actions.clearViewerMode() ) } @@ -376,7 +375,7 @@ export class ViewerCmp implements OnDestroy { if ((feat as SapiSpatialFeatureModel).location) { const feature = feat as SapiSpatialFeatureModel this.store$.dispatch( - actions.navigateTo({ + atlasSelection.actions.navigateTo({ navigation: { orientation: [0, 0, 0, 1], position: feature.location.center.coordinates.map(v => (v.unit as number) * 1e6)