diff --git a/src/ui/parcellationRegion/region.base.spec.ts b/src/ui/parcellationRegion/region.base.spec.ts index 282c3dd923bf39e5842f2dbf7ace0c57b3cda144..0b09bc95d1ec46e3345fcc4f2596b00ba1d09ef1 100644 --- a/src/ui/parcellationRegion/region.base.spec.ts +++ b/src/ui/parcellationRegion/region.base.spec.ts @@ -27,8 +27,7 @@ const mr0wrong = { const mr1lh = { labelIndex: 1, - name: 'mr1', - status: 'left hemisphere', + name: 'mr1 - left hemisphere', fullId: { kg: { kgSchema: 'fzj/mock/pr', @@ -39,8 +38,7 @@ const mr1lh = { const mr1rh = { labelIndex: 1, - name: 'mr1', - status: 'right hemisphere', + name: 'mr1 - right hemisphere', fullId: { kg: { kgSchema: 'fzj/mock/pr', @@ -51,8 +49,7 @@ const mr1rh = { const mr0lh = { labelIndex: 1, - name: 'mr0', - status: 'left hemisphere', + name: 'mr0 - left hemisphere', fullId: { kg: { kgSchema: 'fzj/mock/pr', @@ -63,8 +60,7 @@ const mr0lh = { const mr0rh = { labelIndex: 1, - name: 'mr0 hemisphere', - status: 'right hemisphere', + name: 'mr0 - right hemisphere', fullId: { kg: { kgSchema: 'fzj/mock/pr', @@ -76,7 +72,6 @@ const mr0rh = { const mr1 = { labelIndex: 1, name: 'mr1', - status: 'interpolated', fullId: { kg: { kgSchema: 'fzj/mock/pr', @@ -88,7 +83,6 @@ const mr1 = { const mr0 = { labelIndex: 1, name: 'mr0', - status: 'interpolated', fullId: { kg: { kgSchema: 'fzj/mock/pr', @@ -101,7 +95,7 @@ const mr0 = { const mp1h = { name: 'mp1h', - regions: [ mr1lh, mr0lh, mr0rh, mr1rh, mr0 ] + regions: [ mr1lh, mr0lh, mr0rh, mr1rh ] } const mpWrong = { @@ -159,7 +153,7 @@ describe('> region.base.ts', () => { }) it('> length checks out', () => { - expect(result.length).toEqual(7) + expect(result.length).toEqual(5) }) it('> does not contain itself', () => { @@ -231,7 +225,7 @@ describe('> region.base.ts', () => { }) it('> length checks out', () => { - expect(result.length).toEqual(4) + expect(result.length).toEqual(3) }) it('> does not select wrong hemisphere (right hemisphere)', () => { diff --git a/src/ui/parcellationRegion/region.base.ts b/src/ui/parcellationRegion/region.base.ts index d50fe4fc231d9f852500f4fdd9fa8e55d3a4b87d..caad14fd2e1882dde5feae8fd32b2ab731ee2426 100644 --- a/src/ui/parcellationRegion/region.base.ts +++ b/src/ui/parcellationRegion/region.base.ts @@ -211,7 +211,13 @@ export const regionInOtherTemplateSelector = createSelector( (viewerState, prop) => { const { region: regionOfInterest } = prop const returnArr = [] - const regionOfInterestHemisphere = regionOfInterest.status + // const regionOfInterestHemisphere = regionOfInterest.status + + const regionOfInterestHemisphere = (regionOfInterest.name.includes('- right hemisphere') || (!!regionOfInterest.status && regionOfInterest.status.includes('right hemisphere'))) + ? 'right hemisphere' + : (regionOfInterest.name.includes('- left hemisphere') || (!!regionOfInterest.status && regionOfInterest.status.includes('left hemisphere'))) + ? 'left hemisphere' + : null const regionOfInterestId = getIdFromFullId(regionOfInterest.fullId) const { fetchedTemplates, templateSelected } = viewerState @@ -226,7 +232,11 @@ export const regionInOtherTemplateSelector = createSelector( for (const region of selectableRegions) { const id = getIdFromFullId(region.fullId) if (!!id) { - const regionHemisphere = region.status + const regionHemisphere = (region.name.includes('- right hemisphere') || (!!region.status && region.status.includes('right hemisphere'))) + ? 'right hemisphere' + : (region.name.includes('- left hemisphere') || (!!region.status && region.status.includes('left hemisphere'))) + ? 'left hemisphere' + : null if (id === regionOfInterestId) { /** * if both hemisphere metadatas are defined @@ -235,8 +245,6 @@ export const regionInOtherTemplateSelector = createSelector( !!regionOfInterestHemisphere && !!regionHemisphere ) { - if ((regionHemisphere.includes('left') || regionHemisphere.includes('right')) - && (regionOfInterestHemisphere.includes('left') || regionOfInterestHemisphere.includes('right'))) { if (regionHemisphere === regionOfInterestHemisphere) { returnArr.push({ template, @@ -245,13 +253,12 @@ export const regionInOtherTemplateSelector = createSelector( }) } } else { - returnArr.push({ - template, - parcellation, - region, - hemisphere: regionHemisphere - }) - } + returnArr.push({ + template, + parcellation, + region, + hemisphere: regionHemisphere + }) } } }