diff --git a/src/ui/help/about/about.component.ts b/src/ui/help/about/about.component.ts index 1f0203246fc0513e98120f840615e381e681b6f4..08c4e1999e5de2ead41f81f49d28957dc3c0d747 100644 --- a/src/ui/help/about/about.component.ts +++ b/src/ui/help/about/about.component.ts @@ -14,8 +14,4 @@ export class AboutCmp { public userDoc = `https://siibra-explorer.readthedocs.io/en/latest/` public repoUrl = `https://github.com/FZJ-INM1-BDA/siibra-explorer` - - constructor( - ) { - } } diff --git a/src/ui/nehubaContainer/2dLandmarks/flatLm/flatLm.component.ts b/src/ui/nehubaContainer/2dLandmarks/flatLm/flatLm.component.ts deleted file mode 100644 index e425aca205c81b4e644508a769f280e65c6abcc0..0000000000000000000000000000000000000000 --- a/src/ui/nehubaContainer/2dLandmarks/flatLm/flatLm.component.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { ChangeDetectionStrategy, ChangeDetectorRef, Component, HostBinding, OnChanges, SimpleChanges } from "@angular/core"; -import { LandmarkUnitBase } from "../landmark.base"; - -@Component({ - selector: 'landmark-2d-flat-cmp', - templateUrl: './flatLm.template.html', - styleUrls: [ - './flatLm.style.css' - ], - changeDetection: ChangeDetectionStrategy.OnPush -}) - -export class FlatLMCmp extends LandmarkUnitBase implements OnChanges{ - - @HostBinding('style.transform') - transform = `translate(0px, 0px)` - - @HostBinding('style.opacity') - opacity = 1.0 - - @HostBinding('style.text-shadow') - textShadow = null - - private scale: number = 1 - - constructor(private cdr: ChangeDetectorRef){ - super() - this.cdr.detach() - } - - ngOnChanges(){ - - const zModifier = Math.tanh(this.positionZ/10) - if (this.positionZ >= 0) { - const shadowLength = zModifier * 4 - this.textShadow = `0 ${shadowLength}px ${shadowLength}px black` - this.opacity = 1.0 - } else { - this.textShadow = null - /** - * assert(zModifier < 0) - */ - this.opacity = 1.0 + (zModifier * 0.8) - } - - this.transform = `translate(${this.positionX}px, ${this.positionY - (zModifier >= 0 ? zModifier * 4 : 0) }px)` - } -} - -export const NORMAL_COLOR: number[] = [201,54,38] diff --git a/src/ui/nehubaContainer/2dLandmarks/flatLm/flatLm.style.css b/src/ui/nehubaContainer/2dLandmarks/flatLm/flatLm.style.css deleted file mode 100644 index 462b4c7efcef86358db18579f078dc9043c37fab..0000000000000000000000000000000000000000 --- a/src/ui/nehubaContainer/2dLandmarks/flatLm/flatLm.style.css +++ /dev/null @@ -1,10 +0,0 @@ -:host -{ - position: absolute; - color: rgba(201, 54, 38, 1.0) -} - -:host > div -{ - transform: translate(-50%, -50%); -} diff --git a/src/ui/nehubaContainer/2dLandmarks/flatLm/flatLm.template.html b/src/ui/nehubaContainer/2dLandmarks/flatLm/flatLm.template.html deleted file mode 100644 index a28b3899ac23b46084447e6104158475ca30f932..0000000000000000000000000000000000000000 --- a/src/ui/nehubaContainer/2dLandmarks/flatLm/flatLm.template.html +++ /dev/null @@ -1,3 +0,0 @@ -<div class="pe-all"> - <i class="fas fa-circle"></i> -</div> diff --git a/src/ui/nehubaContainer/2dLandmarks/landmark.base.ts b/src/ui/nehubaContainer/2dLandmarks/landmark.base.ts deleted file mode 100644 index 953c75ed49d956b42023822fec53daea65adcec7..0000000000000000000000000000000000000000 --- a/src/ui/nehubaContainer/2dLandmarks/landmark.base.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Directive, Input } from "@angular/core" - -@Directive() -export class LandmarkUnitBase{ - @Input() public positionX: number = 0 - @Input() public positionY: number = 0 - @Input() public positionZ: number = 0 - - @Input() public color: number[] = [255, 255, 255] -} diff --git a/src/ui/nehubaContainer/2dLandmarks/module.ts b/src/ui/nehubaContainer/2dLandmarks/module.ts deleted file mode 100644 index cef4ec49316a4723d47a2ebce00ebe43dad6020b..0000000000000000000000000000000000000000 --- a/src/ui/nehubaContainer/2dLandmarks/module.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { CommonModule } from "@angular/common"; -import { NgModule } from "@angular/core"; -import { FlatLMCmp } from "./flatLm/flatLm.component"; -import { SafeStylePipe } from "./safeStyle.pipe"; - -@NgModule({ - imports: [ - CommonModule, - ], - declarations: [ - FlatLMCmp, - - /** - * pipes - */ - SafeStylePipe, - ], - exports: [ - FlatLMCmp, - ] -}) - -export class Landmark2DModule{} diff --git a/src/ui/nehubaContainer/2dLandmarks/safeStyle.pipe.ts b/src/ui/nehubaContainer/2dLandmarks/safeStyle.pipe.ts deleted file mode 100644 index 7901ca1cc515310cb40f495d9ffe7f520f81a5e9..0000000000000000000000000000000000000000 --- a/src/ui/nehubaContainer/2dLandmarks/safeStyle.pipe.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Pipe, PipeTransform } from "@angular/core"; -import { DomSanitizer, SafeStyle } from "@angular/platform-browser"; - -@Pipe({ - name : 'safeStyle', -}) - -export class SafeStylePipe implements PipeTransform { - constructor(private sanitizer: DomSanitizer) { - - } - - public transform(style: string): SafeStyle { - return this.sanitizer.bypassSecurityTrustStyle(style) - } -} diff --git a/src/ui/ui.module.ts b/src/ui/ui.module.ts index 6e66aeefeb560e99b10a9e27bed492f4387a18b0..0c5bfe953321f1a77af21a4bda60af13ebf3b6bd 100644 --- a/src/ui/ui.module.ts +++ b/src/ui/ui.module.ts @@ -1,30 +1,22 @@ import { NgModule } from "@angular/core"; import { ComponentsModule } from "src/components/components.module"; - import { FormsModule, ReactiveFormsModule } from "@angular/forms"; import { LayoutModule } from "src/layouts/layout.module"; - import { ScrollingModule } from "@angular/cdk/scrolling" import { HttpClientModule } from "@angular/common/http"; import { AngularMaterialModule } from 'src/sharedModules' import { UtilModule } from "src/util"; import { DownloadDirective } from "../util/directives/download.directive"; - import { MobileOverlay } from "./nehubaContainer/mobileOverlay/mobileOverlay.component"; - import { HumanReadableFileSizePipe } from "src/util/pipes/humanReadableFileSize.pipe"; - import { ReorderPanelIndexPipe } from "./nehubaContainer/reorderPanelIndex.pipe"; - import { FixedMouseContextualContainerDirective } from "src/util/directives/FixedMouseContextualContainerDirective.directive"; - import { ShareModule } from "src/share"; import { AuthModule } from "src/auth"; import { ActionDialog } from "./actionDialog/actionDialog.component"; import { APPEND_SCRIPT_TOKEN, appendScriptFactory } from "src/util/constants"; import { DOCUMENT } from "@angular/common"; import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; -import { Landmark2DModule } from "./nehubaContainer/2dLandmarks/module"; import { HANDLE_SCREENSHOT_PROMISE, TypeHandleScrnShotPromise } from "../screenshot"; @NgModule({ @@ -40,7 +32,6 @@ import { HANDLE_SCREENSHOT_PROMISE, TypeHandleScrnShotPromise } from "../screens AngularMaterialModule, ShareModule, AuthModule, - Landmark2DModule, ], declarations : [ MobileOverlay, diff --git a/src/util/windowResize/windowResize.directive.ts b/src/util/windowResize/windowResize.directive.ts index 97c6534b5a270f93979a8c86d57a23da1256c8c3..2a8f83fd99b19c883d6060c2709f371b5a4210cb 100644 --- a/src/util/windowResize/windowResize.directive.ts +++ b/src/util/windowResize/windowResize.directive.ts @@ -27,10 +27,10 @@ export class ResizeObserverDirective implements OnChanges, OnInit, OnDestroy { constructor(private svc: ResizeObserverService){} - ngOnInit(){ + ngOnInit(): void { this.configure() } - ngOnChanges(){ + ngOnChanges(): void { this.configure() } @@ -38,7 +38,7 @@ export class ResizeObserverDirective implements OnChanges, OnInit, OnDestroy { while(this.sub.length > 0) this.sub.pop().unsubscribe() } - configure(){ + configure(): void { while(this.sub.length > 0) this.sub.pop().unsubscribe() let sub: Subscription diff --git a/src/util/windowResize/windowResize.service.ts b/src/util/windowResize/windowResize.service.ts index f50c7df0e929a935b56176311b887d585d6412eb..f48a5832517f9e770356deab0f131e1b167b36a8 100644 --- a/src/util/windowResize/windowResize.service.ts +++ b/src/util/windowResize/windowResize.service.ts @@ -1,6 +1,6 @@ import { Injectable } from "@angular/core"; -import { asyncScheduler, fromEvent } from "rxjs"; -import { debounceTime, shareReplay, tap, throttleTime } from "rxjs/operators"; +import { asyncScheduler, fromEvent, Observable } from "rxjs"; +import { debounceTime, shareReplay, throttleTime } from "rxjs/operators"; interface IThrottleConfig { leading: boolean @@ -16,13 +16,13 @@ export class ResizeObserverService { shareReplay(1) ) - public getThrottledResize(time: number, config?: IThrottleConfig){ + public getThrottledResize(time: number, config?: IThrottleConfig) : Observable<Event>{ return this.windowResize.pipe( throttleTime(time, asyncScheduler, config || { leading: false, trailing: true }), ) } - public getDebouncedResize(time: number) { + public getDebouncedResize(time: number): Observable<Event> { return this.windowResize.pipe( debounceTime(time) ) diff --git a/src/viewerModule/componentStore.ts b/src/viewerModule/componentStore.ts index 5fe24c51085c329be8ed3eaee2048f3114cbda43..3e6d6e79b6e6942b44ebf8ad7ef4b5a44f166f74 100644 --- a/src/viewerModule/componentStore.ts +++ b/src/viewerModule/componentStore.ts @@ -1,6 +1,6 @@ import { Injectable } from "@angular/core"; import { select } from "@ngrx/store"; -import { ReplaySubject, Subject } from "rxjs"; +import { Observable, ReplaySubject, Subject } from "rxjs"; import { shareReplay } from "rxjs/operators"; export class LockError extends Error{} @@ -15,14 +15,14 @@ export class LockError extends Error{} export class ComponentStore<T>{ private _state$: Subject<T> = new ReplaySubject<T>(1) private _lock: boolean = false - get isLocked() { + get isLocked(): boolean { return this._lock } - setState(state: T){ + setState(state: T): void { if (this.isLocked) throw new LockError('State is locked') this._state$.next(state) } - select<V>(selectorFn: (state: T) => V) { + select<V>(selectorFn: (state: T) => V): Observable<V> { return this._state$.pipe( select(selectorFn), shareReplay(1), diff --git a/src/viewerModule/constants.ts b/src/viewerModule/constants.ts index 4c9836908094db80de0a2847f2be8fbc57496d8d..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/src/viewerModule/constants.ts +++ b/src/viewerModule/constants.ts @@ -1,3 +0,0 @@ -import { InjectionToken } from "@angular/core"; -import { Observable } from "rxjs"; - diff --git a/src/viewerModule/nehuba/config.service/util.spec.ts b/src/viewerModule/nehuba/config.service/util.spec.ts index b3e87a6c2ec5aa8ad9cde9d2eac4a9c9300194d2..7f5727e19755f4ffd0d59540c3ccc93806300fa3 100644 --- a/src/viewerModule/nehuba/config.service/util.spec.ts +++ b/src/viewerModule/nehuba/config.service/util.spec.ts @@ -83,11 +83,11 @@ describe('> util.ts', () => { }) it('> if navigation object is otherwise malformed', () => { - const v1 = cvtNavigationObjToNehubaConfig({foo: 'bar'}, bigbrainNehubaConfig) + const v1 = cvtNavigationObjToNehubaConfig({foo: 'bar'} as any, bigbrainNehubaConfig) const v2 = cvtNavigationObjToNehubaConfig(defaultNavigationObject, bigbrainNehubaConfig) expect(v1).toEqual(v2) - const v3 = cvtNavigationObjToNehubaConfig({}, bigbrainNehubaConfig) + const v3 = cvtNavigationObjToNehubaConfig({} as any, bigbrainNehubaConfig) const v4 = cvtNavigationObjToNehubaConfig(defaultNavigationObject, bigbrainNehubaConfig) expect(v3).toEqual(v4) }) diff --git a/src/viewerModule/nehuba/config.service/util.ts b/src/viewerModule/nehuba/config.service/util.ts index 1417402d00ace6bf971fe6a61d7066a82373a2ee..a89599f6010f08aa81dc604a6b51dd0d2bb6bc72 100644 --- a/src/viewerModule/nehuba/config.service/util.ts +++ b/src/viewerModule/nehuba/config.service/util.ts @@ -1,5 +1,6 @@ -import { SapiParcellationModel, SapiSpaceModel, SapiAtlasModel, SapiRegionModel, SAPI } from 'src/atlasComponents/sapi' +import { SapiParcellationModel, SapiSpaceModel, SapiAtlasModel, SapiRegionModel } from 'src/atlasComponents/sapi' import { SapiVolumeModel } from 'src/atlasComponents/sapi/type' +import { atlasSelection } from 'src/state' import { MultiDimMap } from 'src/util/fn' import { ParcVolumeSpec } from "../store/util" import { @@ -185,7 +186,7 @@ export function getTmplAuxNgLayer(atlas: SapiAtlasModel, tmpl: SapiSpaceModel, s } } -export function getParcNgId(atlas: SapiAtlasModel, tmpl: SapiSpaceModel, parc: SapiParcellationModel, _laterality: string | SapiRegionModel) { +export function getParcNgId(atlas: SapiAtlasModel, tmpl: SapiSpaceModel, parc: SapiParcellationModel, _laterality: string | SapiRegionModel): string { let laterality: string if (typeof _laterality === "string") { laterality = _laterality @@ -201,7 +202,7 @@ export function getParcNgId(atlas: SapiAtlasModel, tmpl: SapiSpaceModel, parc: S return ngId } -export function getParcNgLayers(atlas: SapiAtlasModel, tmpl: SapiSpaceModel, parc: SapiParcellationModel, parcVolumes: { volume: SapiVolumeModel, volumeMetadata: ParcVolumeSpec }[]){ +export function getParcNgLayers(atlas: SapiAtlasModel, tmpl: SapiSpaceModel, parc: SapiParcellationModel, parcVolumes: { volume: SapiVolumeModel, volumeMetadata: ParcVolumeSpec }[]): Record<string, NgSegLayerSpec>{ const returnVal: Record<string, NgSegLayerSpec> = {} for (const parcVol of parcVolumes) { const { volume, volumeMetadata } = parcVol @@ -224,7 +225,11 @@ type CongregatedVolume = { parcVolumes: { volume: SapiVolumeModel, volumeMetadata: ParcVolumeSpec}[] } -export const getNgLayersFromVolumesATP = (volumes: CongregatedVolume, ATP: { atlas: SapiAtlasModel, template: SapiSpaceModel, parcellation: SapiParcellationModel }) => { +export const getNgLayersFromVolumesATP = (volumes: CongregatedVolume, ATP: { atlas: SapiAtlasModel, template: SapiSpaceModel, parcellation: SapiParcellationModel }): { + tmplNgLayers: Record<string, NgLayerSpec> + tmplAuxNgLayers: Record<string, NgPrecompMeshSpec> + parcNgLayers: Record<string, NgSegLayerSpec> +} => { const { tmplVolumes, tmplAuxMeshVolumes, parcVolumes } = volumes const { atlas, template, parcellation } = ATP @@ -235,7 +240,7 @@ export const getNgLayersFromVolumesATP = (volumes: CongregatedVolume, ATP: { atl } } -export function getRegionLabelIndex(atlas: SapiAtlasModel, tmpl: SapiSpaceModel, parc: SapiParcellationModel, region: SapiRegionModel) { +export function getRegionLabelIndex(_atlas: SapiAtlasModel, _tmpl: SapiSpaceModel, _parc: SapiParcellationModel, region: SapiRegionModel): number { const lblIdx = Number(region?.hasAnnotation?.internalIdentifier) if (isNaN(lblIdx)) return null return lblIdx @@ -422,14 +427,13 @@ export function getNehubaConfig(space: SapiSpaceModel): NehubaConfig { } -export function cvtNavigationObjToNehubaConfig(navigationObj, nehubaConfigObj: RecursivePartial<NgConfig>): RecursivePartial<NgConfig>{ +export function cvtNavigationObjToNehubaConfig(navigationObj: atlasSelection.AtlasSelectionState['navigation'], nehubaConfigObj: RecursivePartial<NgConfig>): RecursivePartial<NgConfig>{ const { orientation = [0, 0, 0, 1], perspectiveOrientation = [0, 0, 0, 1], perspectiveZoom = 1e6, zoom = 1e6, position = [0, 0, 0], - positionReal = true, } = navigationObj || {} const voxelSize = (() => { @@ -448,9 +452,7 @@ export function cvtNavigationObjToNehubaConfig(navigationObj, nehubaConfigObj: R navigation: { pose: { position: { - voxelCoordinates: positionReal - ? [0, 1, 2].map(idx => position[idx] / voxelSize[idx]) - : position, + voxelCoordinates: [0, 1, 2].map(idx => position[idx] / voxelSize[idx]), voxelSize }, orientation, diff --git a/src/viewerModule/nehuba/layerCtrl.service/layerCtrl.effects.ts b/src/viewerModule/nehuba/layerCtrl.service/layerCtrl.effects.ts index 1aef3e7c81a3e74d495c7ce4cbaf0b38f51a84c7..674f4ace38384d79859c609328aaf930ba23dc5c 100644 --- a/src/viewerModule/nehuba/layerCtrl.service/layerCtrl.effects.ts +++ b/src/viewerModule/nehuba/layerCtrl.service/layerCtrl.effects.ts @@ -53,7 +53,7 @@ export class LayerCtrlEffects { } }) ), - catchError((err, obs) => of( + catchError(() => of( atlasAppearance.actions.removeCustomLayer({ id: NehubaLayerControlService.PMAP_LAYER_NAME }) diff --git a/src/viewerModule/nehuba/layerCtrl.service/layerCtrl.service.ts b/src/viewerModule/nehuba/layerCtrl.service/layerCtrl.service.ts index 4792776add9128e8128ba17eb08cab2dc4976db6..d6f2e40179166680efcb9bba34260f4d158a8454 100644 --- a/src/viewerModule/nehuba/layerCtrl.service/layerCtrl.service.ts +++ b/src/viewerModule/nehuba/layerCtrl.service/layerCtrl.service.ts @@ -97,7 +97,7 @@ export class NehubaLayerControlService implements OnDestroy{ private sub: Subscription[] = [] - ngOnDestroy(){ + ngOnDestroy(): void{ while (this.sub.length > 0) this.sub.pop().unsubscribe() } diff --git a/src/viewerModule/nehuba/layoutOverlay/nehuba.layoutOverlay/nehuba.layoutOverlay.component.ts b/src/viewerModule/nehuba/layoutOverlay/nehuba.layoutOverlay/nehuba.layoutOverlay.component.ts index 913ea82df447c2f22443c759bd11ded1405a0865..a5f13432b611c3fee0b082338df7c3e3b086cf7d 100644 --- a/src/viewerModule/nehuba/layoutOverlay/nehuba.layoutOverlay/nehuba.layoutOverlay.component.ts +++ b/src/viewerModule/nehuba/layoutOverlay/nehuba.layoutOverlay/nehuba.layoutOverlay.component.ts @@ -1,6 +1,6 @@ import { AfterViewInit, ChangeDetectorRef, Component, Inject, OnDestroy } from "@angular/core"; import { select, Store } from "@ngrx/store"; -import { combineLatest, fromEvent, interval, merge, Observable, of, Subject, Subscription, timer } from "rxjs"; +import { combineLatest, fromEvent, interval, merge, Observable, of, Subject, Subscription } from "rxjs"; import { userInterface } from "src/state"; import { NehubaViewerUnit } from "../../nehubaViewer/nehubaViewer.component"; import { NEHUBA_INSTANCE_INJTKN, takeOnePipe, getFourPanel, getHorizontalOneThree, getSinglePanel, getVerticalOneThree } from "../../util"; @@ -48,14 +48,14 @@ export class NehubaLayoutOverlay implements OnDestroy, AfterViewInit{ this.setQuickTourPos() } - handleCycleViewEvent(){ + handleCycleViewEvent(): void { if (this.currentPanelMode !== "SINGLE_PANEL") return this.store$.dispatch( userInterface.actions.cyclePanelMode() ) } - public toggleMaximiseMinimise(index: number) { + public toggleMaximiseMinimise(index: number): void { this.store$.dispatch( userInterface.actions.toggleMaximiseView({ targetIndex: index @@ -63,7 +63,7 @@ export class NehubaLayoutOverlay implements OnDestroy, AfterViewInit{ ) } - public zoomNgView(panelIndex: number, factor: number) { + public zoomNgView(panelIndex: number, factor: number): void { const ngviewer = this.nehubaUnit?.nehubaViewer?.ngviewer if (!ngviewer) throw new Error(`ngviewer not defined!`) @@ -80,24 +80,6 @@ export class NehubaLayoutOverlay implements OnDestroy, AfterViewInit{ } } - public returnTruePos(quadrant: number, data: any) { - const pos = quadrant > 2 - ? [0, 0, 0] - : this.nanometersToOffsetPixelsFn && this.nanometersToOffsetPixelsFn[quadrant] - ? this.nanometersToOffsetPixelsFn[quadrant](data.geometry.position.map(n => n * 1e6)) - : [0, 0, 0] - return pos - } - - public getPositionX(quadrant: number, data: any) { - return this.returnTruePos(quadrant, data)[0] - } - public getPositionY(quadrant: number, data: any) { - return this.returnTruePos(quadrant, data)[1] - } - public getPositionZ(quadrant: number, data: any) { - return this.returnTruePos(quadrant, data)[2] - } public quickTourOverwritingPos = { 'dialog': { left: '0px', @@ -109,7 +91,7 @@ export class NehubaLayoutOverlay implements OnDestroy, AfterViewInit{ } } - setQuickTourPos(){ + setQuickTourPos(): void { const { innerWidth, innerHeight } = window this.quickTourOverwritingPos = { 'dialog': { @@ -122,13 +104,6 @@ export class NehubaLayoutOverlay implements OnDestroy, AfterViewInit{ } } } - public handleMouseEnterCustomLandmark(lm) { - console.log('handle enter custom landmark') - - } - public handleMouseLeaveCustomLandmark(_lm) { - console.log("handle leave custom landmark") - } public panelMode$ = this.store$.pipe( select(userInterface.selectors.panelMode) @@ -306,7 +281,7 @@ export class NehubaLayoutOverlay implements OnDestroy, AfterViewInit{ this.detectChanges() } - public detectChanges(){ + public detectChanges(): void { this.cdr.detectChanges() } diff --git a/src/viewerModule/nehuba/layoutOverlay/nehuba.layoutOverlay/nehuba.layoutOverlay.template.html b/src/viewerModule/nehuba/layoutOverlay/nehuba.layoutOverlay/nehuba.layoutOverlay.template.html index bd018eafdbd00f4234f60ea51be7ec67e7a9a668..e716c29fac236a4c7394b76a68a5027ffaf94646 100644 --- a/src/viewerModule/nehuba/layoutOverlay/nehuba.layoutOverlay/nehuba.layoutOverlay.template.html +++ b/src/viewerModule/nehuba/layoutOverlay/nehuba.layoutOverlay/nehuba.layoutOverlay.template.html @@ -40,21 +40,6 @@ <iav-layout-fourcorners class="w-100 h-100 d-block"> - <!-- TODO add landmarks here --> - - - <!-- customLandmarks --> - <!-- only show landmarks in slice views --> - <!-- <landmark-2d-flat-cmp *ngFor="let lm of (customLandmarks$ | async | filterArray : filterCustomLandmark)" - (mouseenter)="handleMouseEnterCustomLandmark(lm)" - (mouseleave)="handleMouseLeaveCustomLandmark(lm)" - [color]="lm.color || [255, 255, 255]" - [positionX]="getPositionX(panelIndex, lm)" - [positionY]="getPositionY(panelIndex, lm)" - [positionZ]="getPositionZ(panelIndex, lm)"> - - </landmark-2d-flat-cmp> --> - <!-- panel controller --> <div iavLayoutFourCornersBottomRight class="position-relative honing"> diff --git a/src/viewerModule/nehuba/mesh.effects/mesh.effects.ts b/src/viewerModule/nehuba/mesh.effects/mesh.effects.ts index b01929395219264beada2655c2570bcffd10a121..74a109766a28373517447d90cea0fd804883a16d 100644 --- a/src/viewerModule/nehuba/mesh.effects/mesh.effects.ts +++ b/src/viewerModule/nehuba/mesh.effects/mesh.effects.ts @@ -1,6 +1,6 @@ import { Injectable } from "@angular/core"; import { createEffect } from "@ngrx/effects"; -import { select, Store } from "@ngrx/store"; +import { Store } from "@ngrx/store"; import { map, mapTo } from "rxjs/operators"; import { actionSetAuxMeshes, IAuxMesh } from "../store"; import { atlasSelection } from "src/state" diff --git a/src/viewerModule/nehuba/mesh.service/mesh.service.ts b/src/viewerModule/nehuba/mesh.service/mesh.service.ts index c44774976d4e3a5267b4a132895fa6b275faf0db..2585f00224e8729a4434afa568e127a486e66fcb 100644 --- a/src/viewerModule/nehuba/mesh.service/mesh.service.ts +++ b/src/viewerModule/nehuba/mesh.service/mesh.service.ts @@ -24,7 +24,7 @@ export class NehubaMeshService implements OnDestroy { ){ } - ngOnDestroy(){ + ngOnDestroy(): void { while(this.onDestroyCb.length > 0) this.onDestroyCb.pop()() } diff --git a/src/viewerModule/nehuba/module.ts b/src/viewerModule/nehuba/module.ts index b1cf73f9ae217515135fd4321ebeff9c41925937..fe4025538782ecca6ff25ff6664ab050b6e5ffb1 100644 --- a/src/viewerModule/nehuba/module.ts +++ b/src/viewerModule/nehuba/module.ts @@ -12,7 +12,6 @@ import { NehubaGlueCmp } from "./nehubaViewerGlue/nehubaViewerGlue.component"; import { UtilModule } from "src/util"; import { ComponentsModule } from "src/components"; import { AngularMaterialModule } from "src/sharedModules"; -import { Landmark2DModule } from "src/ui/nehubaContainer/2dLandmarks/module"; import { MouseoverModule } from "src/mouseoverModule"; import { StatusCardComponent } from "./statusCard/statusCard.component"; import { ShareModule } from "src/share"; @@ -35,7 +34,6 @@ import { NehubaLayoutOverlayModule } from "./layoutOverlay"; ReactiveFormsModule, UtilModule, AngularMaterialModule, - Landmark2DModule, ComponentsModule, MouseoverModule, ShareModule, diff --git a/src/viewerModule/nehuba/navigation.service/navigation.effects.ts b/src/viewerModule/nehuba/navigation.service/navigation.effects.ts index a74805b74ee391f9c7bcbe4622ed729ee880817c..ae3c4d4e977b6190f2303bc8d2b00ccf72fd3084 100644 --- a/src/viewerModule/nehuba/navigation.service/navigation.effects.ts +++ b/src/viewerModule/nehuba/navigation.service/navigation.effects.ts @@ -114,7 +114,7 @@ export class NehubaNavigationEffects implements OnDestroy{ ) } - ngOnDestroy(){ + ngOnDestroy(): void { while(this.subscription.length > 0) this.subscription.pop().unsubscribe() } } \ No newline at end of file diff --git a/src/viewerModule/nehuba/navigation.service/navigation.service.ts b/src/viewerModule/nehuba/navigation.service/navigation.service.ts index 59ef98c02b7a82fa3850040170ae23608d1ea3e6..e06ddd27fe488f686aec8dcd9c803491df1fad60 100644 --- a/src/viewerModule/nehuba/navigation.service/navigation.service.ts +++ b/src/viewerModule/nehuba/navigation.service/navigation.service.ts @@ -64,14 +64,14 @@ export class NehubaNavigationService implements OnDestroy{ ) } - navigateViewer(navigation: INavObj){ + navigateViewer(navigation: INavObj): void { if (!navigation) return // TODO // readd consider how to do animation this.nehubaViewerInstance.setNavigationState(navigation) } - setupViewerSub(){ + setupViewerSub(): void { this.viewerInstanceSubscriptions.push( // realtime viewer nav state this.nehubaViewerInstance.viewerPositionChange.subscribe( @@ -110,11 +110,11 @@ export class NehubaNavigationService implements OnDestroy{ ) } - clearViewerSub(){ + clearViewerSub(): void { while (this.viewerInstanceSubscriptions.length > 0) this.viewerInstanceSubscriptions.pop().unsubscribe() } - ngOnDestroy(){ + ngOnDestroy(): void { this.clearViewerSub() while (this.subscriptions.length > 0) this.subscriptions.pop().unsubscribe() } diff --git a/src/viewerModule/nehuba/nehubaViewerGlue/nehubaViewerGlue.component.spec.ts b/src/viewerModule/nehuba/nehubaViewerGlue/nehubaViewerGlue.component.spec.ts index a67987386aa984ffa76bf1602af33e11fca10b19..31b182b66f603577304a0f790a8729f23ae89462 100644 --- a/src/viewerModule/nehuba/nehubaViewerGlue/nehubaViewerGlue.component.spec.ts +++ b/src/viewerModule/nehuba/nehubaViewerGlue/nehubaViewerGlue.component.spec.ts @@ -7,7 +7,6 @@ import { NEVER, Subject } from "rxjs" import { ComponentsModule } from "src/components" import { ClickInterceptorService } from "src/glue" import { LayoutModule } from "src/layouts/layout.module" -import { Landmark2DModule } from "src/ui/nehubaContainer/2dLandmarks/module" import { QuickTourModule } from "src/ui/quickTour" import { AngularMaterialModule } from "src/sharedModules/angularMaterial.module" import { ClickInterceptor, CLICK_INTERCEPTOR_INJECTOR, UtilModule } from "src/util" @@ -69,7 +68,6 @@ describe('> nehubaViewerGlue.component.ts', () => { UtilModule, WindowResizeModule, LayoutModule, - Landmark2DModule, SAPIModule, ], declarations: [ diff --git a/src/viewerModule/nehuba/nehubaViewerGlue/nehubaViewerGlue.component.ts b/src/viewerModule/nehuba/nehubaViewerGlue/nehubaViewerGlue.component.ts index 0efb76e7ed31d903d7c4e6aed0b4375ffcfcc198..b5710f3c8451f11a0fb896dcb70f1c7f60412e74 100644 --- a/src/viewerModule/nehuba/nehubaViewerGlue/nehubaViewerGlue.component.ts +++ b/src/viewerModule/nehuba/nehubaViewerGlue/nehubaViewerGlue.component.ts @@ -1,10 +1,9 @@ -import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Inject, OnDestroy, Optional, Output, TemplateRef, ViewChild } from "@angular/core"; +import { AfterViewInit, ChangeDetectionStrategy, Component, EventEmitter, Inject, OnDestroy, Optional, Output, TemplateRef, ViewChild } from "@angular/core"; import { select, Store } from "@ngrx/store"; -import { Subject, Subscription } from "rxjs"; +import { Subscription } from "rxjs"; import { ClickInterceptor, CLICK_INTERCEPTOR_INJECTOR } from "src/util"; import { distinctUntilChanged, startWith } from "rxjs/operators"; import { ARIA_LABELS } from 'common/constants' -import { LoggingService } from "src/logging"; import { EnumViewerEvt, IViewer, TViewerEvent } from "../../viewer.interface"; import { NehubaViewerContainerDirective, TMouseoverEvent } from "../nehubaViewerInterface/nehubaViewerInterface.directive"; import { API_SERVICE_SET_VIEWER_HANDLE_TOKEN, TSetViewerHandle } from "src/atlasViewer/atlasViewer.apiService.service"; @@ -84,10 +83,6 @@ export class NehubaGlueCmp implements IViewer<'nehuba'>, OnDestroy, AfterViewIni select(annotation.selectors.annotations), ) - public filterCustomLandmark(lm: any){ - return !!lm['showInSliceView'] - } - private nehubaContainerSub: Subscription[] = [] private setupNehubaEvRelay() { while (this.nehubaContainerSub.length > 0) this.nehubaContainerSub.pop().unsubscribe() @@ -166,11 +161,11 @@ export class NehubaGlueCmp implements IViewer<'nehuba'>, OnDestroy, AfterViewIni ) } - ngAfterViewInit(){ + ngAfterViewInit(): void { this.setupNehubaEvRelay() } - ngOnDestroy() { + ngOnDestroy(): void { while (this.onDestroyCb.length) this.onDestroyCb.pop()() } @@ -248,7 +243,7 @@ export class NehubaGlueCmp implements IViewer<'nehuba'>, OnDestroy, AfterViewIni } - handleViewerLoadedEvent(flag: boolean) { + handleViewerLoadedEvent(flag: boolean): void { this.viewerEvent.emit({ type: EnumViewerEvt.VIEWERLOADED, data: flag @@ -285,7 +280,7 @@ export class NehubaGlueCmp implements IViewer<'nehuba'>, OnDestroy, AfterViewIni URL.revokeObjectURL(resourceUrl) } } - public async handleFileDrop(files: File[]){ + public async handleFileDrop(files: File[]): Promise<void> { if (files.length !== 1) { this.snackbar.open(INVALID_FILE_INPUT, 'Dismiss', { duration: 5000 @@ -312,7 +307,7 @@ export class NehubaGlueCmp implements IViewer<'nehuba'>, OnDestroy, AfterViewIni } try { - const { result, ...other } = await this.worker.sendMessage({ + const { result } = await this.worker.sendMessage({ method: 'PROCESS_NIFTI', param: { nifti: outbuf diff --git a/src/viewerModule/nehuba/nehubaViewerInterface/nehubaViewerInterface.directive.ts b/src/viewerModule/nehuba/nehubaViewerInterface/nehubaViewerInterface.directive.ts index 7ccfa003c1d5944fbc7e856153fddf1d6e16d330..c3109feb8ef4e8b8a25597b2307435609204741a 100644 --- a/src/viewerModule/nehuba/nehubaViewerInterface/nehubaViewerInterface.directive.ts +++ b/src/viewerModule/nehuba/nehubaViewerInterface/nehubaViewerInterface.directive.ts @@ -269,11 +269,11 @@ export class NehubaViewerContainerDirective implements OnDestroy{ private nehubaViewerSubscriptions: Subscription[] = [] private subscriptions: Subscription[] = [] - redraw(){ + redraw(): void{ this.nehubaViewerInstance.redraw() } - ngOnDestroy(){ + ngOnDestroy(): void{ while(this.subscriptions.length > 0){ this.subscriptions.pop().unsubscribe() } @@ -282,7 +282,7 @@ export class NehubaViewerContainerDirective implements OnDestroy{ } } - public toggleOctantRemoval(flag: boolean){ + public toggleOctantRemoval(flag: boolean): void{ if (!this.nehubaViewerInstance) { this.log.error(`this.nehubaViewerInstance is not yet available`) return @@ -290,10 +290,10 @@ export class NehubaViewerContainerDirective implements OnDestroy{ this.nehubaViewerInstance.toggleOctantRemoval(flag) } - async createNehubaInstance(nehubaConfig: NehubaConfig){ + async createNehubaInstance(nehubaConfig: NehubaConfig): Promise<void>{ this.clear() - await new Promise((rs, rj) => setTimeout(rs, 0)) + await new Promise(rs => setTimeout(rs, 0)) this.iavNehubaViewerContainerViewerLoading.emit(true) this.cr = this.el.createComponent(this.nehubaViewerFactory) @@ -349,7 +349,7 @@ export class NehubaViewerContainerDirective implements OnDestroy{ ) } - clear(){ + clear(): void{ while(this.nehubaViewerSubscriptions.length > 0) { this.nehubaViewerSubscriptions.pop().unsubscribe() } @@ -360,15 +360,15 @@ export class NehubaViewerContainerDirective implements OnDestroy{ this.cr = null } - get nehubaViewerInstance(){ + get nehubaViewerInstance(): NehubaViewerUnit{ return this.cr && this.cr.instance } - isReady() { + isReady(): boolean { return !!(this.cr?.instance?.nehubaViewer?.ngviewer) } - handleMouseoverSegments(arrOfArr: [string, any][]) { + handleMouseoverSegments(arrOfArr: [string, any][]): void { const payload = arrOfArr.map( ([ngId, {segment, segmentId}]) => { return { layer: { diff --git a/src/viewerModule/nehuba/nehubaViewerInterface/nehubaViewerTouch.directive.ts b/src/viewerModule/nehuba/nehubaViewerInterface/nehubaViewerTouch.directive.ts index 518ed11461edde227a2240e8dcad0e112f2ef640..824db2f2e8adc80b51c1747eb3064a08bfe6f65b 100644 --- a/src/viewerModule/nehuba/nehubaViewerInterface/nehubaViewerTouch.directive.ts +++ b/src/viewerModule/nehuba/nehubaViewerInterface/nehubaViewerTouch.directive.ts @@ -276,7 +276,7 @@ export class NehubaViewerTouchDirective implements OnDestroy{ ) } - ngOnDestroy(){ + ngOnDestroy(): void{ while(this.s.length > 0){ this.s.pop().unsubscribe() } diff --git a/src/viewerModule/nehuba/ngLayerCtl/ngLayerCtrl.component.ts b/src/viewerModule/nehuba/ngLayerCtl/ngLayerCtrl.component.ts index bc85f84690053f7b765fe7f317552086d39e448f..fd216151b9bbbf14d3b498eae8ffc98b2501ba05 100644 --- a/src/viewerModule/nehuba/ngLayerCtl/ngLayerCtrl.component.ts +++ b/src/viewerModule/nehuba/ngLayerCtl/ngLayerCtrl.component.ts @@ -82,7 +82,7 @@ export class NgLayerCtrlCmp implements OnChanges, OnDestroy{ if (!isMat4(xform)) { return } - this.transform = xform as Mat4 + this.transform = parsedResult as Mat4 } visible: boolean = true @@ -141,7 +141,7 @@ export class NgLayerCtrlCmp implements OnChanges, OnDestroy{ } } - toggleVisibility(){ + toggleVisibility(): void{ this.visible = !this.visible this.viewer.nehubaViewer.ngviewer.layerManager.getLayerByName(this.name).setVisible(this.visible) } diff --git a/src/viewerModule/nehuba/statusCard/statusCard.component.ts b/src/viewerModule/nehuba/statusCard/statusCard.component.ts index 9d0fa79b6b13d0243a6e72343f0250f210dd68f2..52899b230314d242df02055777cc5344d1b73725 100644 --- a/src/viewerModule/nehuba/statusCard/statusCard.component.ts +++ b/src/viewerModule/nehuba/statusCard/statusCard.component.ts @@ -33,7 +33,7 @@ export class StatusCardComponent implements OnInit, OnChanges{ private _nehubaViewer: NehubaViewerUnit; - get nehubaViewer(){ + get nehubaViewer(): NehubaViewerUnit{ return this._nehubaViewer } set nehubaViewer(v: NehubaViewerUnit) { @@ -103,7 +103,7 @@ export class StatusCardComponent implements OnInit, OnChanges{ ) } - ngOnChanges() { + ngOnChanges(): void { if (this.nehubaViewer?.viewerPosInReal$ && this.nehubaViewer?.viewerPosInVoxel$) { this.navVal$ = combineLatest([ this.statusPanelRealSpace$, @@ -153,7 +153,7 @@ export class StatusCardComponent implements OnInit, OnChanges{ startWith(true) ) - public textNavigateTo(string: string) { + public textNavigateTo(string: string): void { if (string.split(/[\s|,]+/).length >= 3 && string.split(/[\s|,]+/).slice(0, 3).every(entry => !isNaN(Number(entry.replace(/mm/, ''))))) { const pos = (string.split(/[\s|,]+/).slice(0, 3).map((entry) => Number(entry.replace(/mm/, '')) * (this.statusPanelRealSpace ? 1000000 : 1))) this.nehubaViewer.setNavigationState({ @@ -165,7 +165,7 @@ export class StatusCardComponent implements OnInit, OnChanges{ } } - showBottomSheet(tmpl: TemplateRef<any>){ + showBottomSheet(tmpl: TemplateRef<any>): void{ this.bottomSheet.open(tmpl) } @@ -178,7 +178,7 @@ export class StatusCardComponent implements OnInit, OnChanges{ * * the info re: nehubaViewer can stay there, too */ - public resetNavigation({rotation: rotationFlag = false, position: positionFlag = false, zoom : zoomFlag = false}: {rotation?: boolean, position?: boolean, zoom?: boolean}) { + public resetNavigation({rotation: rotationFlag = false, position: positionFlag = false, zoom : zoomFlag = false}: {rotation?: boolean, position?: boolean, zoom?: boolean}): void { const config = getNehubaConfig(this.selectedTemplate) const { orientation, @@ -202,7 +202,7 @@ export class StatusCardComponent implements OnInit, OnChanges{ ) } - openDialog(tmpl: TemplateRef<any>, options) { + openDialog(tmpl: TemplateRef<any>, options: { ariaLabel: string }): void { const { ariaLabel } = options this.dialog.open(tmpl, { ariaLabel diff --git a/src/viewerModule/nehuba/store/util.ts b/src/viewerModule/nehuba/store/util.ts index 8f592371a1b19dec9307e334dc91f1ec3edef686..cc59b9f001498e552d6d7c4a940773113f1d1b1a 100644 --- a/src/viewerModule/nehuba/store/util.ts +++ b/src/viewerModule/nehuba/store/util.ts @@ -1,9 +1,4 @@ -import { select } from "@ngrx/store"; -import { forkJoin, of, pipe } from "rxjs"; -import { switchMap, map, take, filter, shareReplay } from "rxjs/operators"; -import { SAPI, SAPIParcellation, SapiParcellationModel, SAPISpace } from "src/atlasComponents/sapi"; -import { atlasSelection } from "src/state"; -import { getRegionLabelIndex } from "../config.service/util"; +import { SapiParcellationModel } from "src/atlasComponents/sapi"; export type ParcVolumeSpec = { volumeSrc: string diff --git a/src/viewerModule/nehuba/util.ts b/src/viewerModule/nehuba/util.ts index 739c823b4c751d17f5b5aef252ba7fa593b0e2cb..71d7a985a09c1ecfa3dd79fdac4c75f3c380bef9 100644 --- a/src/viewerModule/nehuba/util.ts +++ b/src/viewerModule/nehuba/util.ts @@ -3,8 +3,6 @@ import { Observable, pipe } from 'rxjs' import { filter, scan, take } from 'rxjs/operators' import { getExportNehuba, getViewer } from 'src/util/fn' import { NehubaViewerUnit } from './nehubaViewer/nehubaViewer.component' -import { NgConfigViewerState } from "./config.service" -import { RecursivePartial } from './config.service/type' import { userInterface } from 'src/state' const flexContCmnCls = ['w-100', 'h-100', 'd-flex', 'justify-content-center', 'align-items-stretch'] @@ -76,10 +74,11 @@ mapModeIdxClass.set("V_ONE_THREE", new Map([ [3, { bottom, right }], ])) +type PanelTouchSide = 'left' | 'right' | 'top' | 'bottom' /** * gives a clue of the approximate location of the panel, allowing position of checkboxes/scale bar to be placed in unobtrustive places */ -export const panelTouchSide = (panel: HTMLElement, { top: touchTop, left: touchLeft, right: touchRight, bottom: touchBottom }: any) => { +export const panelTouchSide = (panel: HTMLElement, { top: touchTop, left: touchLeft, right: touchRight, bottom: touchBottom }: Partial<Record<PanelTouchSide, boolean>>): HTMLElement => { if (touchTop) { panel.classList.add(`touch-top`) } if (touchLeft) { panel.classList.add(`touch-left`) } if (touchRight) { panel.classList.add(`touch-right`) } @@ -87,7 +86,7 @@ export const panelTouchSide = (panel: HTMLElement, { top: touchTop, left: touchL return panel } -export const addTouchSideClasses = (panel: HTMLElement, actualOrderIndex: number, panelMode: userInterface.PanelMode) => { +export const addTouchSideClasses = (panel: HTMLElement, actualOrderIndex: number, panelMode: userInterface.PanelMode): HTMLElement => { if (actualOrderIndex < 0) { return panel } @@ -100,7 +99,7 @@ export const addTouchSideClasses = (panel: HTMLElement, actualOrderIndex: number return panelTouchSide(panel, classArg) } -export const getHorizontalOneThree = (panels: [HTMLElement, HTMLElement, HTMLElement, HTMLElement]) => { +export const getHorizontalOneThree = (panels: [HTMLElement, HTMLElement, HTMLElement, HTMLElement]): HTMLElement => { washPanels(panels) panels.forEach((panel, idx) => addTouchSideClasses(panel, idx, "H_ONE_THREE")) @@ -114,7 +113,7 @@ export const getHorizontalOneThree = (panels: [HTMLElement, HTMLElement, HTMLEle return makeRow(majorContainer, minorContainer) } -export const getVerticalOneThree = (panels: [HTMLElement, HTMLElement, HTMLElement, HTMLElement]) => { +export const getVerticalOneThree = (panels: [HTMLElement, HTMLElement, HTMLElement, HTMLElement]): HTMLDivElement => { washPanels(panels) panels.forEach((panel, idx) => addTouchSideClasses(panel, idx, "V_ONE_THREE")) @@ -128,7 +127,7 @@ export const getVerticalOneThree = (panels: [HTMLElement, HTMLElement, HTMLEleme return makeCol(majorContainer, minorContainer) } -export const getFourPanel = (panels: [HTMLElement, HTMLElement, HTMLElement, HTMLElement]) => { +export const getFourPanel = (panels: [HTMLElement, HTMLElement, HTMLElement, HTMLElement]): HTMLDivElement => { washPanels(panels) panels.forEach((panel, idx) => addTouchSideClasses(panel, idx, "FOUR_PANEL")) @@ -142,7 +141,7 @@ export const getFourPanel = (panels: [HTMLElement, HTMLElement, HTMLElement, HTM return makeCol(majorContainer, minorContainer) } -export const getSinglePanel = (panels: [HTMLElement, HTMLElement, HTMLElement, HTMLElement]) => { +export const getSinglePanel = (panels: [HTMLElement, HTMLElement, HTMLElement, HTMLElement]): HTMLDivElement => { washPanels(panels) panels.forEach((panel, idx) => addTouchSideClasses(panel, idx, "SINGLE_PANEL")) @@ -158,28 +157,13 @@ export const getSinglePanel = (panels: [HTMLElement, HTMLElement, HTMLElement, H return makeRow(majorContainer, minorContainer) } -export const isIdentityQuat = ori => Math.abs(ori[0]) < 1e-6 +export const isIdentityQuat = (ori: number[]): boolean => Math.abs(ori[0]) < 1e-6 && Math.abs(ori[1]) < 1e-6 && Math.abs(ori[2]) < 1e-6 && Math.abs(ori[3] - 1) < 1e-6 -export const calculateSliceZoomFactor = (originalZoom) => originalZoom - ? 700 * originalZoom / Math.min(window.innerHeight, window.innerWidth) - : 1e7 - -export const singleLmUnchanged = (lm: {id: string, position: [number, number, number]}, map: Map<string, [number, number, number]>) => - map.has(lm.id) && map.get(lm.id).every((value, idx) => value === lm.position[idx]) - -export const userLmUnchanged = (oldlms, newlms) => { - const oldmap = new Map(oldlms.map(lm => [lm.id, lm.position])) - const newmap = new Map(newlms.map(lm => [lm.id, lm.position])) - - return oldlms.every(lm => singleLmUnchanged(lm, newmap as Map<string, [number, number, number]>)) - && newlms.every(lm => singleLmUnchanged(lm, oldmap as Map<string, [number, number, number]>)) -} - -export const importNehubaFactory = appendSrc => { - let pr: Promise<any> +export const importNehubaFactory = (appendSrc: (src: string) => Promise<void>): () => Promise<void> => { + let pr: Promise<void> return () => { if (getExportNehuba()) return Promise.resolve() @@ -190,42 +174,6 @@ export const importNehubaFactory = appendSrc => { } } - -export const isFirstRow = (cell: HTMLElement) => { - const { parentElement: row } = cell - const { parentElement: container } = row - return container.firstElementChild === row -} - -export const isFirstCell = (cell: HTMLElement) => { - const { parentElement: row } = cell - return row.firstElementChild === cell -} - -export const scanSliceViewRenderFn: (acc: [boolean, boolean, boolean], curr: CustomEvent) => [boolean, boolean, boolean] = (acc, curr) => { - - const target = curr.target as HTMLElement - const targetIsFirstRow = isFirstRow(target) - const targetIsFirstCell = isFirstCell(target) - const idx = targetIsFirstRow - ? targetIsFirstCell - ? 0 - : 1 - : targetIsFirstCell - ? 2 - : null - - const returnAcc = [...acc] - const num1 = typeof curr.detail.missingChunks === 'number' ? curr.detail.missingChunks : 0 - const num2 = typeof curr.detail.missingImageChunks === 'number' ? curr.detail.missingImageChunks : 0 - if (num1 < 0 && num2 < 0) { - returnAcc[idx] = true - } else { - returnAcc[idx] = Math.max(num1, num2) > 0 - } - return returnAcc as [boolean, boolean, boolean] -} - export const takeOnePipe = () => { return pipe( @@ -260,11 +208,11 @@ export const takeOnePipe = () => { export const NEHUBA_INSTANCE_INJTKN = new InjectionToken<Observable<NehubaViewerUnit>>('NEHUBA_INSTANCE_INJTKN') -export function serializeSegment(ngId: string, label: number | string){ +export function serializeSegment(ngId: string, label: number | string): string{ return `${ngId}#${label}` } -export function deserializeSegment(id: string) { +export function deserializeSegment(id: string): {ngId: string, label: number} { const split = id.split('#') if (split.length !== 2) { throw new Error(`deserializeSegment error at ${id}. expecting splitting # to result in length 2, got ${split.length}`) diff --git a/src/viewerModule/nehuba/viewerCtrl/viewerCtrlCmp/viewerCtrlCmp.component.ts b/src/viewerModule/nehuba/viewerCtrl/viewerCtrlCmp/viewerCtrlCmp.component.ts index 8e81a6fb23422010ac443f09a24e689547402ceb..ad8239b219b8baa455f228e5262ed5264edea7f2 100644 --- a/src/viewerModule/nehuba/viewerCtrl/viewerCtrlCmp/viewerCtrlCmp.component.ts +++ b/src/viewerModule/nehuba/viewerCtrl/viewerCtrlCmp/viewerCtrlCmp.component.ts @@ -26,10 +26,10 @@ export class ViewerCtrlCmp implements OnInit{ private sub: Subscription[] = [] private _removeOctantFlag: boolean = true - get removeOctantFlag(){ + get removeOctantFlag(): boolean{ return this._removeOctantFlag } - set removeOctantFlag(val){ + set removeOctantFlag(val: boolean){ if (val === this._removeOctantFlag) return this._removeOctantFlag = val this.setOctantRemoval(this._removeOctantFlag) @@ -129,7 +129,7 @@ export class ViewerCtrlCmp implements OnInit{ } - public setOctantRemoval(octantRemovalFlag: boolean) { + public setOctantRemoval(octantRemovalFlag: boolean): void { this.store$.dispatch( atlasAppearance.actions.setOctantRemoval({ flag: octantRemovalFlag @@ -137,7 +137,7 @@ export class ViewerCtrlCmp implements OnInit{ ) } - public trackByAtId(_idx: number, obj: { ['@id']: string }) { + public trackByAtId(_idx: number, obj: { ['@id']: string }): string { return obj['@id'] } } diff --git a/src/viewerModule/threeSurfer/store/effects.ts b/src/viewerModule/threeSurfer/store/effects.ts index 77fc0f8652a08a36e0028d4ccd1adf39595f5422..4fa4c9f190783d18fac844ec69019352bfb6c855 100644 --- a/src/viewerModule/threeSurfer/store/effects.ts +++ b/src/viewerModule/threeSurfer/store/effects.ts @@ -2,7 +2,7 @@ import { Injectable } from "@angular/core"; import { createEffect } from "@ngrx/effects"; import { select, Store } from "@ngrx/store"; import { EMPTY, forkJoin, merge, Observable, of, pipe, throwError } from "rxjs"; -import { debounceTime, map, switchMap, withLatestFrom, filter, take, shareReplay, tap, distinctUntilChanged } from "rxjs/operators"; +import { debounceTime, map, switchMap, withLatestFrom, filter, shareReplay, distinctUntilChanged } from "rxjs/operators"; import { SAPI, SapiAtlasModel, SapiParcellationModel, SapiSpaceModel } from "src/atlasComponents/sapi"; import { atlasAppearance, atlasSelection } from "src/state"; import { ThreeSurferCustomLabelLayer, ThreeSurferCustomLayer } from "src/state/atlasAppearance/const"; diff --git a/src/viewerModule/threeSurfer/threeSurferGlue/threeSurfer.component.ts b/src/viewerModule/threeSurfer/threeSurferGlue/threeSurfer.component.ts index 4ce0c8e6abc9ac04a2fb19eae0fc96a0095bcf5c..89e2df55ca809641ec1a30692a0d932b29b55ef3 100644 --- a/src/viewerModule/threeSurfer/threeSurferGlue/threeSurfer.component.ts +++ b/src/viewerModule/threeSurfer/threeSurferGlue/threeSurfer.component.ts @@ -1,7 +1,7 @@ -import { Component, Output, EventEmitter, ElementRef, OnChanges, OnDestroy, AfterViewInit, Inject, Optional, ChangeDetectionStrategy } from "@angular/core"; +import { Component, Output, EventEmitter, ElementRef, OnDestroy, AfterViewInit, Inject, Optional, ChangeDetectionStrategy } from "@angular/core"; import { EnumViewerEvt, IViewer, TViewerEvent } from "src/viewerModule/viewer.interface"; import { combineLatest, Observable, Subject } from "rxjs"; -import { debounceTime, distinctUntilChanged, filter, map, shareReplay, tap } from "rxjs/operators"; +import { debounceTime, distinctUntilChanged, filter, map, shareReplay } from "rxjs/operators"; import { ComponentStore } from "src/viewerModule/componentStore"; import { select, Store } from "@ngrx/store"; import { ClickInterceptor, CLICK_INTERCEPTOR_INJECTOR } from "src/util"; @@ -626,7 +626,7 @@ export class ThreeSurferGlueCmp implements IViewer<'threeSurfer'>, AfterViewInit this.cameraEv$.next(detail) } - ngAfterViewInit(){ + ngAfterViewInit(): void{ const customEvHandler = (ev: CustomEvent) => { const { type, data } = ev.detail if (type === 'mouseover') { @@ -724,7 +724,7 @@ export class ThreeSurferGlueCmp implements IViewer<'threeSurfer'>, AfterViewInit if (this.mouseoverText === '') this.mouseoverText = null } - public updateMeshVisibility(){ + public updateMeshVisibility(): void{ for (const key in this.lateralityMeshRecord) { @@ -740,7 +740,7 @@ export class ThreeSurferGlueCmp implements IViewer<'threeSurfer'>, AfterViewInit } } - switchSurfaceLayer(layer: SapiVolumeModel){ + switchSurfaceLayer(layer: SapiVolumeModel): void{ this.store$.dispatch( actions.selectVolumeById({ id: layer["@id"] @@ -750,7 +750,7 @@ export class ThreeSurferGlueCmp implements IViewer<'threeSurfer'>, AfterViewInit private onDestroyCb: (() => void) [] = [] - ngOnDestroy() { + ngOnDestroy(): void { while (this.onDestroyCb.length > 0) this.onDestroyCb.pop()() } } diff --git a/src/viewerModule/viewerCmp/viewerCmp.component.ts b/src/viewerModule/viewerCmp/viewerCmp.component.ts index e9f6ac785123cdeb2c6f34597c585677fa043514..b97593f7b3f5cb65b60d029705c284d58a215d9a 100644 --- a/src/viewerModule/viewerCmp/viewerCmp.component.ts +++ b/src/viewerModule/viewerCmp/viewerCmp.component.ts @@ -1,7 +1,7 @@ -import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, TemplateRef, ViewChild, ViewContainerRef } from "@angular/core"; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, TemplateRef, ViewChild, ViewContainerRef } from "@angular/core"; import { select, Store } from "@ngrx/store"; import { combineLatest, NEVER, Observable, of, Subscription } from "rxjs"; -import { debounceTime, distinctUntilChanged, map, shareReplay, startWith, switchMap, tap } from "rxjs/operators"; +import { debounceTime, distinctUntilChanged, map, shareReplay, startWith, switchMap } from "rxjs/operators"; import { CONST, ARIA_LABELS, QUICKTOUR_DESC } from 'common/constants' import { OVERWRITE_SHOW_DATASET_DIALOG_TOKEN } from "src/util/interfaces"; import { animate, state, style, transition, trigger } from "@angular/animations"; @@ -264,7 +264,7 @@ export class ViewerCmp implements OnDestroy { ) } - ngAfterViewInit(){ + ngAfterViewInit(): void{ const cb: TContextMenuReg<TContextArg<'nehuba' | 'threeSurfer'>> = ({ append, context }) => { /** @@ -315,18 +315,18 @@ export class ViewerCmp implements OnDestroy { ) } - ngOnDestroy() { + ngOnDestroy(): void { while (this.subscriptions.length) this.subscriptions.pop().unsubscribe() while (this.onDestroyCb.length > 0) this.onDestroyCb.pop()() } - public clearRoi(){ + public clearRoi(): void{ this.store$.dispatch( atlasSelection.actions.clearSelectedRegions() ) } - public selectRoi(roi: SapiRegionModel) { + public selectRoi(roi: SapiRegionModel): void { this.store$.dispatch( atlasSelection.actions.selectRegion({ region: roi @@ -334,13 +334,13 @@ export class ViewerCmp implements OnDestroy { ) } - public exitSpecialViewMode(){ + public exitSpecialViewMode(): void{ this.store$.dispatch( atlasSelection.actions.clearViewerMode() ) } - public clearPreviewingDataset(){ + public clearPreviewingDataset(): void{ /** * clear all preview */ @@ -349,7 +349,7 @@ export class ViewerCmp implements OnDestroy { }) } - public handleViewerEvent(event: TViewerEvent<'nehuba' | 'threeSurfer'>){ + public handleViewerEvent(event: TViewerEvent<'nehuba' | 'threeSurfer'>): void{ switch(event.type) { case EnumViewerEvt.VIEWERLOADED: this.viewerLoaded = event.data @@ -372,11 +372,11 @@ export class ViewerCmp implements OnDestroy { } } - public disposeCtxMenu(){ + public disposeCtxMenu(): void{ this.ctxMenuSvc.dismissCtxMenu() } - showDataset(feat: SapiFeatureModel) { + showDataset(feat: SapiFeatureModel): void { if ((feat as SapiSpatialFeatureModel).location) { const feature = feat as SapiSpatialFeatureModel this.store$.dispatch( @@ -397,25 +397,25 @@ export class ViewerCmp implements OnDestroy { ) } - clearSelectedFeature(){ + clearSelectedFeature(): void{ this.store$.dispatch( userInteraction.actions.clearShownFeature() ) } - onDismissNonbaseLayer(){ + onDismissNonbaseLayer(): void{ this.store$.dispatch( atlasSelection.actions.clearNonBaseParcLayer() ) } - onSelectParcellation(parcellation: SapiParcellationModel){ + onSelectParcellation(parcellation: SapiParcellationModel): void{ this.store$.dispatch( atlasSelection.actions.selectParcellation({ parcellation }) ) } - navigateTo(position: number[]) { + navigateTo(position: number[]): void { this.store$.dispatch( atlasSelection.actions.navigateTo({ navigation: { diff --git a/src/viewerModule/viewerInternalState.service.ts b/src/viewerModule/viewerInternalState.service.ts index 3985a2f65e45663166adfa73e0d1a500adeafcf9..745ff8ecf94620babbb2c1c988366d9f89d03e54 100644 --- a/src/viewerModule/viewerInternalState.service.ts +++ b/src/viewerModule/viewerInternalState.service.ts @@ -33,7 +33,7 @@ export class ViewerInternalStateSvc{ private registeredEmitter: TViewerInternalStateEmitter - applyInternalState<T>(arg: TInteralStatePayload<T>){ + applyInternalState<T>(arg: TInteralStatePayload<T>): void{ if (!this.registeredEmitter) { throw new Error(`No emitter registered. Aborting.`) } @@ -49,7 +49,7 @@ export class ViewerInternalStateSvc{ done: () => this.deregisterEmitter(emitter) } } - deregisterEmitter(emitter: TViewerInternalStateEmitter){ + deregisterEmitter(emitter: TViewerInternalStateEmitter): void{ if (emitter === this.registeredEmitter) { this.viewerInternalState$.next(null) this.registeredEmitter = null diff --git a/src/widget/constants.ts b/src/widget/constants.ts index e4070494f940a01fb0dce8874eba63a665c1bdfd..ede7e8805ecd5cf9bc27aa083776cf64b61bc18c 100644 --- a/src/widget/constants.ts +++ b/src/widget/constants.ts @@ -1,4 +1,3 @@ -import { InjectionToken } from "@angular/core"; import { MatDialogConfig, MatDialogRef } from "@angular/material/dialog"; export enum EnumActionToWidget{ diff --git a/src/zipFilesOutput/downloadSingleFile.directive.ts b/src/zipFilesOutput/downloadSingleFile.directive.ts index 1ad93e0fac8a36c607965305291538cacb3108e7..80d8eef4a2f05a32f068da4d15d9061dd5f45bf3 100644 --- a/src/zipFilesOutput/downloadSingleFile.directive.ts +++ b/src/zipFilesOutput/downloadSingleFile.directive.ts @@ -13,7 +13,7 @@ export class SingleFileOutput { singleFile: TZipFileConfig @HostListener('click') - onClick(){ + onClick(): void{ const anchor = this.doc.createElement('a') const blob = new Blob([this.singleFile.filecontent], { type: 'text/plain' }) anchor.href = URL.createObjectURL(blob) diff --git a/src/zipFilesOutput/zipFilesOutput.directive.ts b/src/zipFilesOutput/zipFilesOutput.directive.ts index dc980728cfd8675ecfaaf57eb1c4317f74556ba0..9b154497a29255abd44a175ca87d39449027be96 100644 --- a/src/zipFilesOutput/zipFilesOutput.directive.ts +++ b/src/zipFilesOutput/zipFilesOutput.directive.ts @@ -36,7 +36,7 @@ export class ZipFilesOutput { } @HostListener('click') - async onClick(){ + async onClick(): Promise<void>{ if (Array.isArray(this.zipFiles)) { await this.zipArray(this.zipFiles) return