diff --git a/src/atlasComponents/sapi/sapi.service.ts b/src/atlasComponents/sapi/sapi.service.ts index 38945b9702f7ebb3e1a26184d324a4709283e670..84d6f42997417838c37493143d84ef8851fe2ab6 100644 --- a/src/atlasComponents/sapi/sapi.service.ts +++ b/src/atlasComponents/sapi/sapi.service.ts @@ -29,6 +29,11 @@ type PaginatedResponse<T> = { pages?: number } +const parcBanList: string[] = [ + "https://identifiers.org/neurovault.image:23262", + "https://doi.org/10.1016/j.jneumeth.2020.108983/mni152", +] + @Injectable({ providedIn: 'root' }) @@ -319,7 +324,12 @@ export class SAPI{ public getAllParcellations(atlas: SxplrAtlas): Observable<SxplrParcellation[]> { return forkJoin( - translateV3Entities.retrieveAtlas(atlas).parcellations.map( + translateV3Entities.retrieveAtlas(atlas).parcellations.filter( + p => { + const { ['@id']: id } = p + return !parcBanList.includes(id) + } + ).map( parc => this.v3Get("/parcellations/{parcellation_id}", { path: { parcellation_id: parc["@id"] } }).pipe( switchMap(v => translateV3Entities.translateParcellation(v)) ) @@ -328,7 +338,7 @@ export class SAPI{ } #tmplToParcMap = new Map<string, SxplrParcellation[]>() - public getSupportedParcellations(atlas: SxplrAtlas, template: SxplrTemplate): Observable<any|SxplrParcellation[]> { + public getSupportedParcellations(atlas: SxplrAtlas, template: SxplrTemplate): Observable<SxplrParcellation[]> { if (!template) { return throwError(`template cannot be empty!`) } diff --git a/src/state/atlasSelection/effects.ts b/src/state/atlasSelection/effects.ts index 1786b5ccaf61407d066b20c9af512b0f504b3f44..639b970e91496377ea900cf58e99035ce2326f2a 100644 --- a/src/state/atlasSelection/effects.ts +++ b/src/state/atlasSelection/effects.ts @@ -26,6 +26,12 @@ type OnTmplParcHookArg = { } } +const prefParcId = [ + "minds/core/parcellationatlas/v1.0.0/94c1125b-b87e-45e4-901c-00daee7f2579-290" +] + +const prefSpcId = [] + @Injectable() export class Effect { @@ -131,10 +137,11 @@ export class Effect { if (parcs.length === 0) { throw new Error(`Cannot find any supported parcellations for template ${template.name}`) } + const selectParc = parcs.find(p => prefParcId.includes(p.id)) || parcs[0] return { atlas: currAtlas, template, - parcellation: parcs[0] + parcellation: selectParc } }) ) @@ -145,9 +152,10 @@ export class Effect { if (templates.length === 0) { throw new Error(`Cannot find any supported templates for parcellation ${parcellation.name}`) } + const selectTmpl = templates.find(tmp => prefSpcId.includes(tmp.id)) || templates[0] return { atlas: currAtlas, - template: templates[0], + template: selectTmpl, parcellation } })