From f726c1493104c051aa4458fa43f763dc1512b361 Mon Sep 17 00:00:00 2001 From: Daviti Gogshelidze <daviti1@mail.com> Date: Tue, 27 Sep 2022 03:33:56 +0200 Subject: [PATCH] Fix hemisphere naming --- .../connectivityBrowser.component.ts | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/atlasComponents/sapiViews/features/connectivity/connectivityBrowser/connectivityBrowser.component.ts b/src/atlasComponents/sapiViews/features/connectivity/connectivityBrowser/connectivityBrowser.component.ts index f4d517a1a..f528c5a27 100644 --- a/src/atlasComponents/sapiViews/features/connectivity/connectivityBrowser/connectivityBrowser.component.ts +++ b/src/atlasComponents/sapiViews/features/connectivity/connectivityBrowser/connectivityBrowser.component.ts @@ -262,9 +262,24 @@ export class ConnectivityBrowserComponent implements AfterViewInit, OnDestroy { }) } + // ToDo need to be fixed on configuration side + fixHemisphereNaming(area) { + if (area.includes(' - left hemisphere')) { + return area.replace('- left hemisphere', 'left') + } else if (area.includes(' - right hemisphere')) { + return area.replace('- right hemisphere', 'right') + } else { + return area + } + } + setMatrixData(data) { const matrixData = data as SapiParcellationFeatureMatrixModel - this.regionIndexInMatrix = (matrixData.columns as Array<string>).findIndex(md => md === this.regionName) + + this.regionIndexInMatrix = (matrixData.columns as Array<string>).findIndex(md => { + return this.fixHemisphereNaming(md) === this.regionName + }) + if (this.regionIndexInMatrix < 0) { this.fetching = false this.noConnectivityForRegion = true @@ -281,8 +296,14 @@ export class ConnectivityBrowserComponent implements AfterViewInit, OnDestroy { this.logChecked = maxStrength > 1 this.logDisabled = maxStrength <= 1 - const areas = regionProfile.reduce((p, c, i) => ({...p, [matrixData.columns[i]]: c}), {}) + const areas = regionProfile.reduce((p, c, i) => { + return { + ...p, + [this.fixHemisphereNaming(matrixData.columns[i])]: c + } + }, {}) this.pureConnections = areas + this.connectionsString = JSON.stringify(areas) this.connectedAreas.next(this.formatConnections(areas)) this.setCustomLayer() -- GitLab