diff --git a/deploy/datasets/query.js b/deploy/datasets/query.js index 3f2a748a253cab426c83746031acd609927bbe9d..a7233810b8fb0992de8ea56c7dcbc82fb9e9d653 100644 --- a/deploy/datasets/query.js +++ b/deploy/datasets/query.js @@ -5,7 +5,6 @@ const path = require('path') const archiver = require('archiver') const { commonSenseDsFilter } = require('./supplements/commonSense') const { getPreviewFile, hasPreview } = require('./supplements/previewFile') -const { manualFilter: manualFilterDWM, manualMap: manualMapDWM } = require('./supplements/util/mapDwm') const kgQueryUtil = require('./../auth/util') @@ -15,7 +14,7 @@ let otherQueryResult = null const KG_ROOT = process.env.KG_ROOT || `https://kg.humanbrainproject.org` const KG_PATH = process.env.KG_PATH || `/query/minds/core/dataset/v1.0.0/interactiveViewerKgQuery-v0_1` const KG_PARAM = { - size: process.env.KG_SEARCH_SIZE || '450', + size: process.env.KG_SEARCH_SIZE || '1000', vocab: process.env.KG_SEARCH_VOCAB || 'https://schema.hbp.eu/myQuery/' } @@ -58,20 +57,29 @@ const cacheData = ({results, ...rest}) => { return cachedData } -const getPublicDs = () => Promise.race([ - new Promise((rs, rj) => { - setTimeout(() => { - if (cachedData) { - rs(cachedData) - } else { - /** - * cached data not available, have to wait - */ - } - }, timeout) - }), - fetchDatasetFromKg().then(cacheData) -]) +let fetchingPublicDataInProgress = false +let getPublicDsPr + +const getPublicDs = async () => { + + /** + * every request to public ds will trigger a refresh pull from master KG (throttled pending on resolved request) + */ + if (!fetchingPublicDataInProgress) { + fetchingPublicDataInProgress = true + getPublicDsPr = fetchDatasetFromKg() + .then(_ => { + fetchingPublicDataInProgress = false + getPublicDsPr = null + return _ + }) + .then(cacheData) + } + + if (cachedData) return Promise.resolve(cachedData) + if (getPublicDsPr) return getPublicDsPr + throw `cached Data not yet resolved, neither is get public ds defined` +} const getDs = ({ user }) => user @@ -103,47 +111,68 @@ const readConfigFile = (filename) => new Promise((resolve, reject) => { }) }) -let juBrain = null -let shortBundle = null -let longBundle = null -let waxholm = null -let allen = null +const populateSet = (flattenedRegions, set = new Set()) => { + if (!(set instanceof Set)) throw `set needs to be an instance of Set` + if (!(flattenedRegions instanceof Array)) throw `flattenedRegions needs to be an instance of Array` + for (const region of flattenedRegions) { + const { name, relatedAreas } = region + if (name) set.add(name) + if (relatedAreas && relatedAreas instanceof Array && relatedAreas.length > 0) { + for (const relatedArea of relatedAreas) { + if(typeof relatedArea === 'string') set.add(relatedArea) + else console.warn(`related area not an instance of String. skipping`, relatedArea) + } + } + } + return set +} + +let juBrainSet = new Set(), + shortBundleSet = new Set(), + longBundleSet = new Set(), + waxholmSet = new Set(), + allenSet = new Set() readConfigFile('colin.json') .then(data => JSON.parse(data)) .then(json => { - juBrain = flattenArray(json.parcellations[0].regions) + const juBrain = flattenArray(json.parcellations[0].regions) + juBrainSet = populateSet(juBrain) + }) .catch(console.error) readConfigFile('MNI152.json') .then(data => JSON.parse(data)) .then(json => { - longBundle = flattenArray(json.parcellations[0].regions) - shortBundle = flattenArray(json.parcellations[1].regions) + const longBundle = flattenArray(json.parcellations.find(({ name }) => name === 'Fibre Bundle Atlas - Long Bundle').regions) + const shortBundle = flattenArray(json.parcellations.find(({ name }) => name === 'Fibre Bundle Atlas - Short Bundle').regions) + + longBundleSet = populateSet(longBundle) + shortBundleSet = populateSet(shortBundle) }) .catch(console.error) readConfigFile('waxholmRatV2_0.json') .then(data => JSON.parse(data)) .then(json => { - waxholm = flattenArray(json.parcellations[0].regions) + const waxholm = flattenArray(json.parcellations[0].regions) + + waxholmSet = populateSet(waxholm) }) .catch(console.error) -/** - * deprecated - */ -const filterByPRs = (prs, atlasPr) => atlasPr - ? prs.some(pr => { - const regex = new RegExp(pr.name.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'), 'i') - return atlasPr.some(aPr => regex.test(aPr.name) - || aPr.synonyms && aPr.synonyms.length && aPr.synonyms.some(syn => syn === pr.name) ) - }) - : false - -const manualFilter = require('./supplements/parcellation') +readConfigFile('allenMouse.json') + .then(data => JSON.parse(data)) + .then(json => { + const flattenedAllen = flattenArray(json.parcellations[0].regions) + allenSet = populateSet(flattenedAllen) + }) +const filterByPRSet = (prs, atlasPrSet = new Set()) => { + if (!(atlasPrSet instanceof Set)) throw `atlasPrSet needs to be a set!` + return prs.some(({ name }) => atlasPrSet.has(name)) +} const filter = (datasets = [], {templateName, parcellationName}) => datasets .filter(ds => commonSenseDsFilter({ds, templateName, parcellationName })) @@ -154,34 +183,36 @@ const filter = (datasets = [], {templateName, parcellationName}) => datasets return ds.referenceSpaces.some(rs => rs.name === templateName) } if (parcellationName) { - if (parcellationName === 'Fibre Bundle Atlas - Long Bundle'){ - return manualFilterDWM(ds) + if (ds.parcellationRegion.length === 0) return false + + let useSet + switch (parcellationName) { + case 'JuBrain Cytoarchitectonic Atlas': + useSet = juBrainSet + break; + case 'Fibre Bundle Atlas - Short Bundle': + useSet = shortBundleSet + break; + case 'Fibre Bundle Atlas - Long Bundle': + useSet = longBundleSet + break; + case 'Waxholm Space rat brain atlas v.2.0': + useSet = waxholmSet + break; + case 'Allen adult mouse brain reference atlas V3 Brain Atlas': + useSet = allenSet + break; + default: + useSet = new Set() } - return ds.parcellationRegion.length > 0 - ? filterByPRs( - ds.parcellationRegion, - parcellationName === 'JuBrain Cytoarchitectonic Atlas' && juBrain - ? juBrain - : parcellationName === 'Fibre Bundle Atlas - Short Bundle' && shortBundle - ? shortBundle - : parcellationName === 'Waxholm Space rat brain atlas v.2.0' - ? waxholm - : null - ) - : false + return filterByPRSet(ds.parcellationRegion, useSet) } return false }) .map(ds => { - if (parcellationName && parcellationName === 'Fibre Bundle Atlas - Long Bundle') { - return manualMapDWM(ds) - } return { ...ds, - ...parcellationName && ds.parcellationRegion.length === 0 - ? { parcellationRegion: [{ name: manualFilter({ parcellationName, dataset: ds }) }] } - : {}, preview: hasPreview({ datasetName: ds.name }) } }) @@ -192,8 +223,7 @@ const filter = (datasets = [], {templateName, parcellationName}) => datasets exports.init = async () => { const { getPublicAccessToken: getPublic } = await kgQueryUtil() getPublicAccessToken = getPublic - const {results = []} = await fetchDatasetFromKg() - cachedData = results + return await getPublicDs() } exports.getDatasets = ({ templateName, parcellationName, user }) => getDs({ user }) diff --git a/deploy/datasets/supplements/parcellation.js b/deploy/datasets/supplements/parcellation.js deleted file mode 100644 index 20527e571c065ddcf70d9a6a7ba9162e95af79b2..0000000000000000000000000000000000000000 --- a/deploy/datasets/supplements/parcellation.js +++ /dev/null @@ -1,27 +0,0 @@ -const fs = require('fs') -const path = require('path') -let waxholm = new Map(), - allen = new Map() - -fs.readFile(path.join(__dirname, 'data', 'allen.json'), 'utf-8', (err, data) => { - if (err) - throw err - const json = JSON.parse(data) - allen = new Map(json.map(item => [item['Dataset name'], item["Semantic link(s)"]])) -}) - - -fs.readFile(path.join(__dirname, 'data', 'waxholm.json'), 'utf-8', (err, data) => { - if (err) - throw err - const json = JSON.parse(data) - waxholm = new Map(json.map(item => [item['Dataset name'], item["Semantic link(s)"]])) -}) - -module.exports = ({ parcellationName, dataset }) => { - return parcellationName === 'Allen adult mouse brain reference atlas V3 Brain Atlas' - ? allen.get(dataset.name) - : parcellationName === 'Whole Brain (v2.0)' - ? waxholm.get(dataset.name) - : false -} \ No newline at end of file diff --git a/deploy/datasets/supplements/util/mapDwm.js b/deploy/datasets/supplements/util/mapDwm.js deleted file mode 100644 index b9cda2f1143970a66397c5572c7fbf991ddb96bd..0000000000000000000000000000000000000000 --- a/deploy/datasets/supplements/util/mapDwm.js +++ /dev/null @@ -1,69 +0,0 @@ -exports.manualFilter = (dataset) => dataset - && dataset.project - && dataset.project instanceof Array - && dataset.project.some(p => p === 'Atlas of deep white matter fibre bundles, version 2018') - -const dict = [ [ 'Probabilistic map of the anterior segment of the left arcuate fasciculus (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/Arcuate_Anterior - Left' ], -[ 'Probabilistic map of the direct segment of the left arcuate fasciculus (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/Arcuate - Left' ], -[ 'Probabilistic map of the posterior segment of the left arcuate fasciculus (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/Arcuate_Posterior - Left' ], -[ 'Probabilistic map of the left long cingulate fibres (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/Cingulum_Long - Left' ], -[ 'Probabilistic map of the left short cingulate fibres (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/Cingulum_Short - Left' ], -[ 'Probabilistic map of the left temporal cingulate fibres (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/Cingulum_Temporal - Left' ], -[ 'Probabilistic map of the left corticospinal tract (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/CorticoSpinalTract - Left' ], -[ 'Probabilistic map of the left fornix (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/Fornix - Left' ], -[ 'Probabilistic map of the left inferior fronto-occipital fasciculus (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/InferiorFrontoOccipital - Left' ], -[ 'Probabilistic map of the left inferior longitudinal fasciculus (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/InferiorLongitudinal - Left' ], -[ 'Probabilistic map of the left uncinate fasciculus (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/Uncinate - Left' ], -[ 'Probabilistic map of the anterior segment of the right arcuate fasciculus (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/Arcuate_Anterior - Right' ], -[ 'Probabilistic map of the posterior segment of the right arcuate fasciculus (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/Arcuate_Posterior - Right' ], -[ 'Probabilistic map of the posterior segment of the right arcuate fasciculus (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/Arcuate - Right' ], -[ 'Probabilistic map of the right long cingulate fibres (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/Cingulum_Long - Right' ], -[ 'Probabilistic map of the right short cingulate fibres (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/Cingulum_Short - Right' ], -[ 'Probabilistic map of the right temporal cingulate fibres (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/Cingulum_Temporal - Right' ], -[ 'Probabilistic map of the right corticospinal tract (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/CorticoSpinalTract - Right' ], -[ 'Probabilistic map of the right fornix (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/Fornix - Right' ], -[ 'Probabilistic map of the right inferior fronto-occipital fasciculus (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/InferiorFrontoOccipital - Right' ], -[ 'Probabilistic map of the right inferior longitudinal fasciculus (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/InferiorLongitudinal - Right' ], -[ 'Probabilistic map of the right uncinate fasciculus (atlas of deep white matter fibre bundles, version 2018)', -'Fibre Bundle Atlas - Long Bundle/Uncinate - Right' ] ] - -const dsNameToIdMap = new Map(dict) -const getIdFromDataset = (dataset) => { - const id = dsNameToIdMap.get(dataset.name) - if (id) return id - return null -} - -exports.manualMap = (dataset) => { - return { - preview: !process.env.DISABLE_DWM_PMAP, - ...dataset, - parcellationRegion: dataset.parcellationRegion.map(r => { - return { - ...r, - id: getIdFromDataset(dataset) - } - }) - } -} \ No newline at end of file diff --git a/src/res/ext/MNI152.json b/src/res/ext/MNI152.json index 461f43dd644841f99e4e912d8f89c343854517c8..50de3d7b1eebc47657b8311afb5da0ceff441c5d 100644 --- a/src/res/ext/MNI152.json +++ b/src/res/ext/MNI152.json @@ -839,6 +839,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area 7A" + ], "rgb": [ 38, 204, @@ -1179,6 +1182,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas": [ + "Area 3b" + ], "rgb": [ 239, 246, @@ -1326,6 +1332,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area PFm" + ], "rgb": [ 53, 76, @@ -1372,6 +1381,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area PFop" + ], "rgb": [ 146, 153, @@ -1418,6 +1430,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area PF" + ], "rgb": [ 226, 211, @@ -1464,6 +1479,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area PGp" + ], "rgb": [ 92, 116, @@ -1510,6 +1528,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area PGa" + ], "rgb": [ 42, 236, @@ -1556,6 +1577,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area PFt" + ], "rgb": [ 120, 135, @@ -1602,6 +1626,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area PFcm" + ], "rgb": [ 98, 128, @@ -2392,6 +2419,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area hOc1" + ], "rgb": [ 190, 132, @@ -2888,6 +2918,10 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area 44v", + "Area 44d" + ], "rgb": [ 54, 74, @@ -2901,10 +2935,6 @@ 74, 75 ], - "synonyms":[ - "Area 44v", - "Area 44d" - ], "labelIndex": 2, "ngId": "jubrain v17 left", "children": [], @@ -2921,10 +2951,6 @@ 74, 75 ], - "synonyms":[ - "Area 44v", - "Area 44d" - ], "ngId": "jubrain v17 right", "labelIndex": 2, "children": [], @@ -2942,6 +2968,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas": [ + "Area 45" + ], "rgb": [ 167, 103, @@ -3309,6 +3338,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area 4p" + ], "rgb": [ 116, 92, @@ -4576,6 +4608,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area Te1" + ], "rgb": [ 252, 84, @@ -4631,6 +4666,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area FG1" + ], "rgb": [ 131, 183, @@ -4769,6 +4807,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area FG2" + ], "rgb": [ 67, 94, @@ -5707,62 +5748,98 @@ { "name": "Arcuate - Left", "children": [], - "labelIndex": "1" + "labelIndex": "1", + "relatedAreas": [ + "Direct segment of the left arcuate fasciculus" + ] }, { "name": "Arcuate - Right", "children": [], - "labelIndex": "31" + "labelIndex": "31", + "relatedAreas": [ + "Direct segment of the right arcuate fasciculus" + ] }, { "name": "Arcuate_Anterior - Left", "children": [], - "labelIndex": "2" + "labelIndex": "2", + "relatedAreas": [ + "Anterior segment of the left arcuate fasciculus" + ] }, { "name": "Arcuate_Anterior - Right", "children": [], - "labelIndex": "32" + "labelIndex": "32", + "relatedAreas": [ + "Anterior segment of the right arcuate fasciculus" + ] }, { "name": "Arcuate_Posterior - Left", "children": [], - "labelIndex": "3" + "labelIndex": "3", + "relatedAreas": [ + "Posterior segment of the left arcuate fasciculus" + ] }, { "name": "Arcuate_Posterior - Right", "children": [], - "labelIndex": "33" + "labelIndex": "33", + "relatedAreas": [ + "Posterior segment of the right arcuate fasciculus" + ] }, { "name": "Cingulum_Long - Left", "children": [], - "labelIndex": "4" + "labelIndex": "4", + "relatedAreas": [ + "Left long cingulate fibres" + ] }, { "name": "Cingulum_Long - Right", "children": [], - "labelIndex": "34" + "labelIndex": "34", + "relatedAreas": [ + "Right long cingulate fibres" + ] }, { "name": "Cingulum_Short - Left", "children": [], - "labelIndex": "5" + "labelIndex": "5", + "relatedAreas": [ + "Left short cingulate fibres" + ] }, { "name": "Cingulum_Short - Right", "children": [], - "labelIndex": "35" + "labelIndex": "35", + "relatedAreas": [ + "Right short cingulate fibres" + ] }, { "name": "Cingulum_Temporal - Left", "children": [], - "labelIndex": "6" + "labelIndex": "6", + "relatedAreas": [ + "Left temporal cingulate fibres" + ] }, { "name": "Cingulum_Temporal - Right", "children": [], - "labelIndex": "36" + "labelIndex": "36", + "relatedAreas": [ + "Right temporal cingulate fibres" + ] }, { "name": "CorpusCallosum_Body", @@ -5787,12 +5864,18 @@ { "name": "CorticoSpinalTract - Left", "children": [], - "labelIndex": "11" + "labelIndex": "11", + "relatedAreas": [ + "Left corticospinal tract" + ] }, { "name": "CorticoSpinalTract - Right", "children": [], - "labelIndex": "41" + "labelIndex": "41", + "relatedAreas": [ + "Right corticospinal tract" + ] }, { "name": "ExternalCapsule - Left", @@ -5807,32 +5890,50 @@ { "name": "Fornix - Left", "children": [], - "labelIndex": "13" + "labelIndex": "13", + "relatedAreas": [ + "Left fornix" + ] }, { "name": "Fornix - Right", "children": [], - "labelIndex": "43" + "labelIndex": "43", + "relatedAreas": [ + "Right fornix" + ] }, { "name": "InferiorFrontoOccipital - Left", "children": [], - "labelIndex": "14" + "labelIndex": "14", + "relatedAreas": [ + "Left inferior fronto-occipital fasciculus" + ] }, { "name": "InferiorFrontoOccipital - Right", "children": [], - "labelIndex": "44" + "labelIndex": "44", + "relatedAreas": [ + "Right inferior fronto-occipital fasciculus" + ] }, { "name": "InferiorLongitudinal - Left", "children": [], - "labelIndex": "15" + "labelIndex": "15", + "relatedAreas": [ + "Left inferior longitudinal fasciculus" + ] }, { "name": "InferiorLongitudinal - Right", "children": [], - "labelIndex": "45" + "labelIndex": "45", + "relatedAreas": [ + "Right inferior longitudinal fasciculus" + ] }, { "name": "InferiorLongitudinal_Lateral - Left", @@ -5887,12 +5988,18 @@ { "name": "Uncinate - Left", "children": [], - "labelIndex": "21" + "labelIndex": "21", + "relatedAreas": [ + "Left uncinate fasciculus" + ] }, { "name": "Uncinate - Right", "children": [], - "labelIndex": "51" + "labelIndex": "51", + "relatedAreas": [ + "Right uncinate fasciculus" + ] } ] }, diff --git a/src/res/ext/colin.json b/src/res/ext/colin.json index bf818598168afde7ca3d2811a5912bee023f5685..6c1c35b3ccb425a2d98864ccab76a12926886cef 100644 --- a/src/res/ext/colin.json +++ b/src/res/ext/colin.json @@ -839,6 +839,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area 7A" + ], "rgb": [ 38, 204, @@ -1179,6 +1182,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas": [ + "Area 3b" + ], "rgb": [ 239, 246, @@ -1326,6 +1332,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area PFm" + ], "rgb": [ 53, 76, @@ -1372,6 +1381,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area PFop" + ], "rgb": [ 146, 153, @@ -1418,6 +1430,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area PF" + ], "rgb": [ 226, 211, @@ -1464,6 +1479,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area PGp" + ], "rgb": [ 92, 116, @@ -1510,6 +1528,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area PGa" + ], "rgb": [ 42, 236, @@ -1556,6 +1577,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area PFt" + ], "rgb": [ 120, 135, @@ -1602,6 +1626,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area PFcm" + ], "rgb": [ 98, 128, @@ -2392,6 +2419,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area hOc1" + ], "rgb": [ 190, 132, @@ -2888,6 +2918,10 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area 44v", + "Area 44d" + ], "rgb": [ 54, 74, @@ -2901,10 +2935,6 @@ 74, 75 ], - "synonyms":[ - "Area 44v", - "Area 44d" - ], "labelIndex": 2, "ngId": "jubrain colin v17 left", @@ -2922,10 +2952,6 @@ 74, 75 ], - "synonyms":[ - "Area 44v", - "Area 44d" - ], "ngId": "jubrain colin v17 right", "labelIndex": 2, "children": [], @@ -2943,6 +2969,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas": [ + "Area 45" + ], "rgb": [ 167, 103, @@ -3310,6 +3339,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area 4p" + ], "rgb": [ 116, 92, @@ -4577,6 +4609,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area Te1" + ], "rgb": [ 252, 84, @@ -4632,6 +4667,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area FG1" + ], "rgb": [ 131, 183, @@ -4770,6 +4808,9 @@ "status": "publicP", "labelIndex": null, "synonyms": [], + "relatedAreas":[ + "Area FG2" + ], "rgb": [ 67, 94, diff --git a/src/res/images/MNI152.png b/src/res/images/MNI152ICBM2009cNonlinearAsymmetric.png similarity index 100% rename from src/res/images/MNI152.png rename to src/res/images/MNI152ICBM2009cNonlinearAsymmetric.png diff --git a/src/ui/databrowserModule/util/filterDataEntriesByRegion.pipe.ts b/src/ui/databrowserModule/util/filterDataEntriesByRegion.pipe.ts index 3dc07faa6a16fdfdc49521d0c1c04f5151c04052..4efe62a4c80a893f1020279d9ce080467ed9f1dd 100644 --- a/src/ui/databrowserModule/util/filterDataEntriesByRegion.pipe.ts +++ b/src/ui/databrowserModule/util/filterDataEntriesByRegion.pipe.ts @@ -24,23 +24,13 @@ export class FilterDataEntriesByRegion implements PipeTransform{ */ const newParcellationRegion = de.parcellationRegion.map(({name, id, ...rest}) => { - /** - * TODO: temporary hack, some dataset region name is not exactly the same as region - */ - /* https://stackoverflow.com/a/9310752/6059235 */ - const regex = new RegExp(name.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'), 'i') - const found = flattenedAllRegions.find(r => { /** * TODO replace pseudo id with real uuid */ return (r.id && id && r.id === id) - || regex.test(r.name) - || r.synonyms && r.synonyms.length && r.synonyms.some(syn => syn === name) - /** - * more correct, but probably should use UUID in the future - */ - return r.name === name + || r.name === name + || r.relatedAreas && r.relatedAreas.length && r.relatedAreas.some(syn => syn === name) }) return found ? { name, id, ...rest, ...found }