From a8b1e05a691cf7c270c2b77d63aeeace1c2a74fc Mon Sep 17 00:00:00 2001 From: Xiao Gui <xgui3783@gmail.com> Date: Mon, 27 Sep 2021 12:17:30 +0200 Subject: [PATCH] bugfix: legacy url - allen/waxholm --- docs/releases/v2.4.7.md | 1 + .../connectivity/hasConnectivity.directive.ts | 4 ++ .../parcellationRegion/region.base.ts | 4 +- .../regionMenu/regionMenu.template.html | 2 +- src/util/fn.ts | 41 +++++++++++++++++++ .../viewerCmp/viewerCmp.template.html | 30 +++++++------- 6 files changed, 65 insertions(+), 17 deletions(-) diff --git a/docs/releases/v2.4.7.md b/docs/releases/v2.4.7.md index cadfa28d5..d99118a14 100644 --- a/docs/releases/v2.4.7.md +++ b/docs/releases/v2.4.7.md @@ -3,3 +3,4 @@ ## Bugfixes - Fix unnamed point landmark naming +- Fix multiregion legacy links (#1022) diff --git a/src/atlasComponents/connectivity/hasConnectivity.directive.ts b/src/atlasComponents/connectivity/hasConnectivity.directive.ts index b3cf77233..8879de8c0 100644 --- a/src/atlasComponents/connectivity/hasConnectivity.directive.ts +++ b/src/atlasComponents/connectivity/hasConnectivity.directive.ts @@ -26,6 +26,10 @@ export class HasConnectivity implements OnInit, OnDestroy { } checkConnectivity(region) { + if (!region.context) { + this.hasConnectivity = false + return + } const {atlas, parcellation, template} = region.context if (region.name) { const connectivityUrl = `${this.siibraApiUrl}/atlases/${encodeURIComponent(atlas['@id'])}/parcellations/${encodeURIComponent(parcellation['@id'])}/regions/${encodeURIComponent(region.name)}/features/ConnectivityProfile` diff --git a/src/atlasComponents/parcellationRegion/region.base.ts b/src/atlasComponents/parcellationRegion/region.base.ts index 29f4073df..1b546ae25 100644 --- a/src/atlasComponents/parcellationRegion/region.base.ts +++ b/src/atlasComponents/parcellationRegion/region.base.ts @@ -33,6 +33,7 @@ export class RegionBase { set region(val) { this._region = val this.region$.next(this._region) + this.hasContext$.next(!!this._region.context) this.position = null // bug the centroid returned is currently nonsense @@ -61,6 +62,7 @@ export class RegionBase { return this._region } + public hasContext$: BehaviorSubject<boolean> = new BehaviorSubject(false) public region$: BehaviorSubject<any> = new BehaviorSubject(null) @Input() @@ -89,7 +91,7 @@ export class RegionBase { this.regionInOtherTemplates$ = this.region$.pipe( distinctUntilChanged(), - filter(v => !!v), + filter(v => !!v && !!v.context), switchMap(region => this.store$.pipe( select( regionInOtherTemplateSelector, diff --git a/src/atlasComponents/parcellationRegion/regionMenu/regionMenu.template.html b/src/atlasComponents/parcellationRegion/regionMenu/regionMenu.template.html index 52e6a76f5..7142c88af 100644 --- a/src/atlasComponents/parcellationRegion/regionMenu/regionMenu.template.html +++ b/src/atlasComponents/parcellationRegion/regionMenu/regionMenu.template.html @@ -127,7 +127,7 @@ content: kgRegionalFeatureList, desc: '', iconTooltip: 'Regional Features', - iavNgIf: true + iavNgIf: hasContext$ | async }"> </ng-container> diff --git a/src/util/fn.ts b/src/util/fn.ts index 23ec5adee..479958c47 100644 --- a/src/util/fn.ts +++ b/src/util/fn.ts @@ -246,6 +246,47 @@ const BACKCOMAP_KEY_DICT = { // fsaverage "minds/core/referencespace/v1.0.0/tmp-fsaverage": fsAverageKeyVal, + }, + // allen mouse + 'juelich/iav/atlas/v1.0.0/2': { + // ccf v3 + "minds/core/referencespace/v1.0.0/265d32a0-3d84-40a5-926f-bf89f68212b9": { + // ccf v3 2017 + "minds/core/parcellationatlas/v1.0.0/05655b58-3b6f-49db-b285-64b5a0276f83": { + "whole brain": "v3_2017", + "left hemisphere": "v3_2017", + "right hemisphere": "v3_2017" + }, + // ccf v3 2015, + "minds/core/parcellationatlas/v1.0.0/39a1384b-8413-4d27-af8d-22432225401f": { + "whole brain": "atlas", + "left hemisphere": "atlas", + "right hemisphere": "atlas" + } + } + }, + // waxholm + "minds/core/parcellationatlas/v1.0.0/522b368e-49a3-49fa-88d3-0870a307974a": { + "minds/core/referencespace/v1.0.0/d5717c4a-0fa1-46e6-918c-b8003069ade8": { + // v1.01 + "minds/core/parcellationatlas/v1.0.0/11017b35-7056-4593-baad-3934d211daba": { + "whole brain": "v1_01", + "left hemisphere": "v1_01", + "right hemisphere": "v1_01" + }, + // v2 + "minds/core/parcellationatlas/v1.0.0/2449a7f0-6dd0-4b5a-8f1e-aec0db03679d": { + "whole brain": "v2", + "left hemisphere": "v2", + "right hemisphere": "v2" + }, + // v3 + "minds/core/parcellationatlas/v1.0.0/ebb923ba-b4d5-4b82-8088-fa9215c2e1fe": { + "whole brain": "v3", + "left hemisphere": "v3", + "right hemisphere": "v3" + } + } } } diff --git a/src/viewerModule/viewerCmp/viewerCmp.template.html b/src/viewerModule/viewerCmp/viewerCmp.template.html index 4b5a2e90e..20997801b 100644 --- a/src/viewerModule/viewerCmp/viewerCmp.template.html +++ b/src/viewerModule/viewerCmp/viewerCmp.template.html @@ -593,21 +593,21 @@ <!-- Multi regions include --> <ng-template #multiRegionInclTmpl> - <mat-chip-list> - <mat-chip *ngFor="let r of regions" - iav-region - [region]="r" - [ngClass]="{ - 'darktheme':regionDirective.rgbDarkmode === true, - 'lighttheme': regionDirective.rgbDarkmode === false - }" - [style.backgroundColor]="regionDirective.rgbString" - #regionDirective="iavRegion"> - <span class="iv-custom-comp text text-truncate d-inline pl-4"> - {{ r.name }} - </span> - </mat-chip> - </mat-chip-list> + + <mat-chip *ngFor="let r of regions" + iav-region + [region]="r" + class="m-1" + [ngClass]="{ + 'darktheme':regionDirective.rgbDarkmode === true, + 'lighttheme': regionDirective.rgbDarkmode === false + }" + [style.backgroundColor]="regionDirective.rgbString" + #regionDirective="iavRegion"> + <span class="iv-custom-comp text text-truncate d-inline"> + {{ r.name }} + </span> + </mat-chip> </ng-template> <ng-container *ngTemplateOutlet="ngMatAccordionTmpl; context: { -- GitLab