Skip to content
Snippets Groups Projects
Unverified Commit 7de6aee4 authored by xgui3783's avatar xgui3783 Committed by GitHub
Browse files

Chore update atlas api (#555)

* chore: update atlas query

* chore: implement parcellation on top level atlas
chore: add preview url
parent a9cf4c2d
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -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
......
......@@ -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
}
......
......@@ -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
{
"@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"
}
]
}
]
}
......@@ -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
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment