-
Notifications
You must be signed in to change notification settings - Fork 19
Add support to open NIfTI assets in Neurosift #2700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,14 @@ const EXTERNAL_SERVICES: ExternalService[] = [ | |
| endpoint: "https://ome.github.io/ome-ngff-validator/?source=$asset_url$", | ||
| }, | ||
|
|
||
| { | ||
| name: "Neurosift", | ||
| regex: /\.nii(\.gz)?$/, | ||
| maxsize: Infinity, | ||
| endpoint: | ||
| "https://neurosift.app/dandiset/$dandiset_id$?tab=$asset_path$", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain why the path is needed for Neurosift? Typically, the API yields file contents through the (I bring this up because I'm always wary when we expand this "API", especially since we're always seeming to do so in an ad hoc way.)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIRC it is because neurosift indexes entire dandisets via lindi and refer to them by original path... @magland is that correct or we could refer also by an asset id?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wasn't able to construct a Neurosift URL with the DANDI
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yarikoptic neurosift/lindi only indexes public nwb files, and does not use the path. In this case, it's BIDS... right? So the path is used to refer to the .nii.gz file, correct?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, in this case, it needs the path, not the asset url. |
||
| }, | ||
|
|
||
| { | ||
| name: "Neurosift", | ||
| regex: /\.nwb$/, | ||
|
|
@@ -90,6 +98,7 @@ interface ServiceUrlData { | |
| assetDandiUrl: string, | ||
| assetDandiMetadataUrl: string, | ||
| assetS3Url: string, | ||
| assetPath: string, | ||
| } | ||
|
|
||
| function serviceURL(endpoint: ExternalServiceEndpoint, data: ServiceUrlData): string | null { | ||
|
|
@@ -112,7 +121,8 @@ function serviceURL(endpoint: ExternalServiceEndpoint, data: ServiceUrlData): st | |
| .replaceAll('$asset_url$', data.assetUrl) | ||
| .replaceAll('$asset_dandi_url$', data.assetDandiUrl) | ||
| .replaceAll('$asset_dandi_metadata_url$', data.assetDandiMetadataUrl) | ||
| .replaceAll('$asset_s3_url$', data.assetS3Url); | ||
| .replaceAll('$asset_s3_url$', data.assetS3Url) | ||
| .replaceAll('$asset_path$', data.assetPath); | ||
| } | ||
|
|
||
| export function getExternalServices(path: AssetPath, info: {dandisetId: string, dandisetVersion: string}) { | ||
|
|
@@ -136,6 +146,7 @@ export function getExternalServices(path: AssetPath, info: {dandisetId: string, | |
| const assetDandiUrl = `${assetDandiMetadataUrl}download/`; | ||
| const assetS3Url = trimEnd((path.asset as AssetFile).url, '/'); | ||
| const assetId = path.asset?.asset_id; | ||
| const assetPath = path.path; | ||
|
|
||
| if (!assetId) { | ||
| // This should never happen | ||
|
|
@@ -158,6 +169,7 @@ export function getExternalServices(path: AssetPath, info: {dandisetId: string, | |
| assetDandiUrl, | ||
| assetDandiMetadataUrl, | ||
| assetS3Url, | ||
| assetPath, | ||
| }); | ||
| return url ? [{ name: service.name, url }] : []; | ||
| }); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.