diff --git a/deploy/atlas/index.js b/deploy/atlas/index.js index ef4c1317da1ac775fc35a7faf18d261bc63ffd91..8d0e1a564740562d9da7ece8da83f1ccf4fc953e 100644 --- a/deploy/atlas/index.js +++ b/deploy/atlas/index.js @@ -27,20 +27,44 @@ router.get('/ready', (req, res) => { } }) +router.get('/preview', (req, res) => { + res.status(501).end() +}) + router.get('/:atlasId', async (req, res) => { const { atlasId } = req.params - const { templateSpaces, ...rest } = await getAtlasById(atlasId) + const { templateSpaces, parcellations, ...rest } = await getAtlasById(atlasId) + + const searchParam = new url.URLSearchParams() + searchParam.set('id', atlasId) + const lastPathPreview = `preview?${searchParam.toString()}` return res.status(200).json({ ...rest, + previewUrl: res.locals.routePathname + ? url.resolve(`${res.locals.routePathname}/`, lastPathPreview) + : lastPathPreview, + parcellations: parcellations.map(p => { + const spSearchParam = new url.URLSearchParams() + spSearchParam.set('id', p['@id']) + const parcellationPreview = `preview?${spSearchParam.toString()}` + return { + previewUrl: res.locals.routePathname + ? url.resolve(`${res.locals.routePathname}/`, parcellationPreview) + : parcellationPreview, + ...p + } + }), templateSpaces: templateSpaces.map(tmpl => { + const lastTemplatePath = `${encodeURIComponent(atlasId)}/template/${encodeURIComponent(tmpl['@id'])}` return { ...tmpl, url: res.locals.routePathname - ? url.resolve(`${res.locals.routePathname}/${encodeURIComponent(atlasId)}/`, encodeURIComponent(tmpl['@id'])) - : `${encodeURIComponent(atlasId)}/${encodeURIComponent(tmpl['@id'])}` + ? url.resolve(`${res.locals.routePathname}/`, lastTemplatePath) + : lastTemplatePath } }) + }) }) @@ -52,7 +76,7 @@ const templateIdToStringMap = new Map([ ['minds/core/referencespace/v1.0.0/7f39f7be-445b-47c0-9791-e971c0b6d992', 'colin'] ]) -router.get('/:atlasId/:templateId', async (req, res) => { +router.get('/:atlasId/template/:templateId', async (req, res) => { const { atlasId, templateId } = req.params const mappedString = templateIdToStringMap.get(templateId) @@ -69,5 +93,9 @@ router.get('/:atlasId/:templateId', async (req, res) => { .on('error', getHandleErrorFn(req, res)) }) +router.get('/:atlasId/parcellation/:parcellationId', async (req, res) => { + res.status(501).end() +}) + module.exports = router \ No newline at end of file diff --git a/deploy/atlas/index.spec.js b/deploy/atlas/index.spec.js index f30ca7bce5c65542a65d1d7b5db0b64202222931..9762c9a2076477435fdefe22488cdce0eb06e984 100644 --- a/deploy/atlas/index.spec.js +++ b/deploy/atlas/index.spec.js @@ -40,7 +40,7 @@ describe('atlas/index.js', () => { const { body } = await got(`${baseUrl}/`, { responseType: 'json' }) expect(body.length).to.equal(3) assert( - body.every(({ url }) => !/undefined/.test(url)), + body.every(({ url }) => !/undefined/.test(url) ), 'url pathname should not contain undefined' ) atlases = body diff --git a/deploy/atlas/query.js b/deploy/atlas/query.js index 6ecddcff312c2aa1ba30290d4c6dc11b40db0520..2523c1e814ceb1ff8e241646afc94bcdb890c2aa 100644 --- a/deploy/atlas/query.js +++ b/deploy/atlas/query.js @@ -22,9 +22,14 @@ const getData = async () => { for (const file of files) { - const data = await readFileAsync(path.join(filepath, 'atlas', file), 'utf-8') - const json = JSON.parse(data) - map.set(json['@id'], json) + try { + + const data = await readFileAsync(path.join(filepath, 'atlas', file), 'utf-8') + const json = JSON.parse(data) + map.set(json['@id'], json) + } catch (e) { + + } } ready = true } diff --git a/src/res/ext/atlas/atlas_allenMouse.json b/src/res/ext/atlas/atlas_allenMouse.json index a882d0924e17ae07a389959b009e01d02dfd6071..f277d9f3bcf6be307511e11ee5f0b1e0b17326db 100644 --- a/src/res/ext/atlas/atlas_allenMouse.json +++ b/src/res/ext/atlas/atlas_allenMouse.json @@ -3,6 +3,28 @@ "name": "Allen Mouse Common Coordinate Framework v3", "templateSpaces": [{ "@id": "minds/core/referencespace/v1.0.0/265d32a0-3d84-40a5-926f-bf89f68212b9", - "name": "Allen Mouse Common Coordinate Framework v3" + "name": "Allen Mouse Common Coordinate Framework v3", + "availableIn": [{ + "name": "Allen Mouse Common Coordinate Framework v3 2017", + "@id": "minds/core/parcellationatlas/v1.0.0/05655b58-3b6f-49db-b285-64b5a0276f83" + },{ + "name": "Allen Mouse Common Coordinate Framework v3 2015", + "@id": "minds/core/parcellationatlas/v1.0.0/39a1384b-8413-4d27-af8d-22432225401f" + }] + }], + "parcellations":[{ + "name": "Allen Mouse Common Coordinate Framework v3 2017", + "@id": "minds/core/parcellationatlas/v1.0.0/05655b58-3b6f-49db-b285-64b5a0276f83", + "availableIn": [{ + "@id": "minds/core/referencespace/v1.0.0/265d32a0-3d84-40a5-926f-bf89f68212b9", + "name": "Allen Mouse Common Coordinate Framework v3" + }] + },{ + "name": "Allen Mouse Common Coordinate Framework v3 2015", + "@id": "minds/core/parcellationatlas/v1.0.0/39a1384b-8413-4d27-af8d-22432225401f", + "availableIn": [{ + "@id": "minds/core/referencespace/v1.0.0/265d32a0-3d84-40a5-926f-bf89f68212b9", + "name": "Allen Mouse Common Coordinate Framework v3" + }] }] } \ No newline at end of file diff --git a/src/res/ext/atlas/atlas_multiLevelHuman.json b/src/res/ext/atlas/atlas_multiLevelHuman.json index 1fcaeb8c26fcaadd90f0495f270755ee78b8f59f..332cc2e63a0eb12d15c4ff8abebad912215bab77 100644 --- a/src/res/ext/atlas/atlas_multiLevelHuman.json +++ b/src/res/ext/atlas/atlas_multiLevelHuman.json @@ -1,14 +1,182 @@ { "@id": "juelich/iav/atlas/v1.0.0/1", "name": "Multilevel Human Atlas", - "templateSpaces": [{ - "@id": "minds/core/referencespace/v1.0.0/a1655b99-82f1-420f-a3c2-fe80fd4c8588", - "name": "Big Brain (Histology)" - }, { - "@id": "minds/core/referencespace/v1.0.0/7f39f7be-445b-47c0-9791-e971c0b6d992", - "name": "MNI Colin 27" - }, { - "@id": "minds/core/referencespace/v1.0.0/dafcffc5-4826-4bf1-8ff6-46b8a31ff8e2", - "name": "MNI 152 ICBM 2009c Nonlinear Asymmetric" - }] -} \ No newline at end of file + "templateSpaces": [ + { + "@id": "minds/core/referencespace/v1.0.0/a1655b99-82f1-420f-a3c2-fe80fd4c8588", + "name": "Big Brain (Histology)", + "avilableIn": [ + { + "@id": "minds/core/parcellationatlas/v1.0.0/94c1125b-b87e-45e4-901c-00daee7f2579", + "name": "Jülich Cytoarchitechtonic Brain Atlas (human)" + }, + { + "name": "BigBrain Cortical Layers Segmentation", + "@id": "juelich/iav/atlas/v1.0.0/3" + }, + { + "name": "Grey/White matter", + "@id": "juelich/iav/atlas/v1.0.0/4" + } + ] + }, + { + "@id": "minds/core/referencespace/v1.0.0/dafcffc5-4826-4bf1-8ff6-46b8a31ff8e2", + "name": "MNI 152 ICBM 2009c Nonlinear Asymmetric", + "avilableIn": [ + { + "@id": "minds/core/parcellationatlas/v1.0.0/94c1125b-b87e-45e4-901c-00daee7f2579", + "name": "Jülich Cytoarchitechtonic Brain Atlas (human)" + }, + { + "name": "Fibre Bundle Atlas - Long Bundle", + "@id": "juelich/iav/atlas/v1.0.0/5" + }, + { + "ngId": "fibre bundle short", + "@id": "juelich/iav/atlas/v1.0.0/6" + }, + { + "name": "DiFuMo Atlas (64 dimensions)", + "@id": "minds/core/parcellationatlas/v1.0.0/d80fbab2-ce7f-4901-a3a2-3c8ef8a3b721" + }, + { + "name": "DiFuMo Atlas (128 dimensions)", + "@id": "minds/core/parcellationatlas/v1.0.0/73f41e04-b7ee-4301-a828-4b298ad05ab8" + }, + { + "name": "DiFuMo Atlas (256 dimensions)", + "@id": "minds/core/parcellationatlas/v1.0.0/141d510f-0342-4f94-ace7-c97d5f160235" + }, + { + "name": "DiFuMo Atlas (512 dimensions)", + "@id": "minds/core/parcellationatlas/v1.0.0/63b5794f-79a4-4464-8dc1-b32e170f3d16" + }, + { + "name": "DiFuMo Atlas (1024 dimensions)", + "@id": "minds/core/parcellationatlas/v1.0.0/12fca5c5-b02c-46ce-ab9f-f12babf4c7e1" + } + ] + }, + { + "@id": "minds/core/referencespace/v1.0.0/7f39f7be-445b-47c0-9791-e971c0b6d992", + "name": "MNI Colin 27", + "avilableIn": [ + { + "@id": "minds/core/parcellationatlas/v1.0.0/94c1125b-b87e-45e4-901c-00daee7f2579", + "name": "Jülich Cytoarchitechtonic Brain Atlas (human)" + } + ] + } + ], + "parcellations": [ + { + "@id": "minds/core/parcellationatlas/v1.0.0/94c1125b-b87e-45e4-901c-00daee7f2579", + "name": "Jülich Cytoarchitechtonic Brain Atlas (human)", + "avilableIn": [ + { + "@id": "minds/core/referencespace/v1.0.0/a1655b99-82f1-420f-a3c2-fe80fd4c8588", + "name": "Big Brain (Histology)" + }, + { + "@id": "minds/core/referencespace/v1.0.0/dafcffc5-4826-4bf1-8ff6-46b8a31ff8e2", + "name": "MNI 152 ICBM 2009c Nonlinear Asymmetric" + }, + { + "@id": "minds/core/referencespace/v1.0.0/7f39f7be-445b-47c0-9791-e971c0b6d992", + "name": "MNI Colin 27" + } + ] + }, + { + "name": "BigBrain Cortical Layers Segmentation", + "@id": "juelich/iav/atlas/v1.0.0/3", + "avilableIn": [ + { + "@id": "minds/core/referencespace/v1.0.0/a1655b99-82f1-420f-a3c2-fe80fd4c8588", + "name": "Big Brain (Histology)" + } + ] + }, + { + "name": "Grey/White matter", + "@id": "juelich/iav/atlas/v1.0.0/4", + "avilableIn": [ + { + "@id": "minds/core/referencespace/v1.0.0/a1655b99-82f1-420f-a3c2-fe80fd4c8588", + "name": "Big Brain (Histology)" + } + ] + }, + { + "name": "Fibre Bundle Atlas - Long Bundle", + "@id": "juelich/iav/atlas/v1.0.0/5", + "avilableIn": [ + { + "@id": "minds/core/referencespace/v1.0.0/dafcffc5-4826-4bf1-8ff6-46b8a31ff8e2", + "name": "MNI 152 ICBM 2009c Nonlinear Asymmetric" + } + ] + }, + { + "ngId": "fibre bundle short", + "@id": "juelich/iav/atlas/v1.0.0/6", + "avilableIn": [ + { + "@id": "minds/core/referencespace/v1.0.0/dafcffc5-4826-4bf1-8ff6-46b8a31ff8e2", + "name": "MNI 152 ICBM 2009c Nonlinear Asymmetric" + } + ] + }, + { + "name": "DiFuMo Atlas (64 dimensions)", + "@id": "minds/core/parcellationatlas/v1.0.0/d80fbab2-ce7f-4901-a3a2-3c8ef8a3b721", + "avilableIn": [ + { + "@id": "minds/core/referencespace/v1.0.0/dafcffc5-4826-4bf1-8ff6-46b8a31ff8e2", + "name": "MNI 152 ICBM 2009c Nonlinear Asymmetric" + } + ] + }, + { + "name": "DiFuMo Atlas (128 dimensions)", + "@id": "minds/core/parcellationatlas/v1.0.0/73f41e04-b7ee-4301-a828-4b298ad05ab8", + "avilableIn": [ + { + "@id": "minds/core/referencespace/v1.0.0/dafcffc5-4826-4bf1-8ff6-46b8a31ff8e2", + "name": "MNI 152 ICBM 2009c Nonlinear Asymmetric" + } + ] + }, + { + "name": "DiFuMo Atlas (256 dimensions)", + "@id": "minds/core/parcellationatlas/v1.0.0/141d510f-0342-4f94-ace7-c97d5f160235", + "avilableIn": [ + { + "@id": "minds/core/referencespace/v1.0.0/dafcffc5-4826-4bf1-8ff6-46b8a31ff8e2", + "name": "MNI 152 ICBM 2009c Nonlinear Asymmetric" + } + ] + }, + { + "name": "DiFuMo Atlas (512 dimensions)", + "@id": "minds/core/parcellationatlas/v1.0.0/63b5794f-79a4-4464-8dc1-b32e170f3d16", + "avilableIn": [ + { + "@id": "minds/core/referencespace/v1.0.0/dafcffc5-4826-4bf1-8ff6-46b8a31ff8e2", + "name": "MNI 152 ICBM 2009c Nonlinear Asymmetric" + } + ] + }, + { + "name": "DiFuMo Atlas (1024 dimensions)", + "@id": "minds/core/parcellationatlas/v1.0.0/12fca5c5-b02c-46ce-ab9f-f12babf4c7e1", + "avilableIn": [ + { + "@id": "minds/core/referencespace/v1.0.0/dafcffc5-4826-4bf1-8ff6-46b8a31ff8e2", + "name": "MNI 152 ICBM 2009c Nonlinear Asymmetric" + } + ] + } + ] +} diff --git a/src/res/ext/atlas/atlas_waxholmRat.json b/src/res/ext/atlas/atlas_waxholmRat.json index f43a85377bd0f0caef8eb5ccf59a00552920226b..f4b9ecfef48ae3cbff429fb316f6cb767b421f0b 100644 --- a/src/res/ext/atlas/atlas_waxholmRat.json +++ b/src/res/ext/atlas/atlas_waxholmRat.json @@ -3,6 +3,38 @@ "name": "Waxholm Space atlas of the Sprague Dawley rat brain", "templateSpaces": [{ "@id": "minds/core/referencespace/v1.0.0/d5717c4a-0fa1-46e6-918c-b8003069ade8", - "name": "Waxholm Space rat brain MRI/DTI" + "name": "Waxholm Space rat brain MRI/DTI", + "availableIn": [{ + "name": "Waxholm Space rat brain atlas v3", + "@id": "minds/core/parcellationatlas/v1.0.0/ebb923ba-b4d5-4b82-8088-fa9215c2e1fe" + },{ + "name": "Waxholm Space rat brain atlas v2", + "@id": "minds/core/parcellationatlas/v1.0.0/2449a7f0-6dd0-4b5a-8f1e-aec0db03679d" + },{ + "name": "Waxholm Space rat brain atlas v1", + "@id": "minds/core/parcellationatlas/v1.0.0/11017b35-7056-4593-baad-3934d211daba" + }] + }], + "parcellations": [{ + "name": "Waxholm Space rat brain atlas v3", + "@id": "minds/core/parcellationatlas/v1.0.0/ebb923ba-b4d5-4b82-8088-fa9215c2e1fe", + "availableIn": [{ + "@id": "minds/core/referencespace/v1.0.0/d5717c4a-0fa1-46e6-918c-b8003069ade8", + "name": "Waxholm Space rat brain MRI/DTI" + }] + },{ + "name": "Waxholm Space rat brain atlas v2", + "@id": "minds/core/parcellationatlas/v1.0.0/2449a7f0-6dd0-4b5a-8f1e-aec0db03679d", + "availableIn": [{ + "@id": "minds/core/referencespace/v1.0.0/d5717c4a-0fa1-46e6-918c-b8003069ade8", + "name": "Waxholm Space rat brain MRI/DTI" + }] + },{ + "name": "Waxholm Space rat brain atlas v1", + "@id": "minds/core/parcellationatlas/v1.0.0/11017b35-7056-4593-baad-3934d211daba", + "availableIn": [{ + "@id": "minds/core/referencespace/v1.0.0/d5717c4a-0fa1-46e6-918c-b8003069ade8", + "name": "Waxholm Space rat brain MRI/DTI" + }] }] -} \ No newline at end of file +}