Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

[wip] adding nwb viewer #849

Closed
wants to merge 9 commits into from
38 changes: 38 additions & 0 deletions src/views/FileBrowserView/PublishFileBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,19 @@
</v-btn>
</v-list-item-action>

<v-list-item-action v-if="item.asset_id && fileExtension(item.name)">
<v-btn
icon
:href="viewURI(item.asset_id, item.name)"
target="_blank"
rel="noopener"
>
<v-icon color="primary">
mdi-file-eye
</v-icon>
</v-btn>
</v-list-item-action>

<v-list-item-action
v-if="item.size"
class="justify-end"
Expand Down Expand Up @@ -278,6 +291,31 @@ export default {
return publishRest.assetDownloadURI(this.identifier, this.version, asset_id);
},

viewURI(asset_id, name) {
const file_ext = this.fileExtension(name);
if (file_ext === 'nii') {
return `https://bioimagesuiteweb.github.io/alphaapp/viewer.html?image=${publishRest.assetDownloadURI(this.identifier, this.version, asset_id)}`;
djarecka marked this conversation as resolved.
Show resolved Hide resolved
}
if (file_ext === 'nwb') {
return `http://nwbexplorer.opensourcebrain.org/nwbfile=${publishRest.assetDownloadURI(this.identifier, this.version, asset_id)}`;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if code was separated from registry of services, so that registry could be reused later by multiple portals.
See https://github.com/datalad/datalad-deprecated/blob/master/datalad_deprecated/resources/website/assets/js/main.js#L21 and how used

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: we need to add maxsize field there and set it to eg 1GB or might be even less for bisweb. Sure to limitations extracted data must not exceed 4GB and anyways, download might be too slow etc. So I wouldn't bother exposing that service for known to fail out be problematic files


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after bioimagesuiteweb/bisweb#129 is addressed, we should also add .tiff into this "registry" (also with similar limits on the file size). ATM bisweb falls into "it is a nifti" if there is no file extension (as our endpoints and blob files have none), but IMHO should work whenever content-disposition is respected (where we do provide the extension)

return undefined;
},

fileExtension(name) {
let ext;
const name_split_ar = name.split('.');
if (name_split_ar[name_split_ar.length - 1] === 'nwb') {
ext = 'nwb';
} else if (name_split_ar[name_split_ar.length - 1] === 'nii' || name_split_ar[name_split_ar.length - 2] === 'nii') {
ext = 'nii';
} else {
ext = false;
djarecka marked this conversation as resolved.
Show resolved Hide resolved
}
return ext;
},

assetMetadataURI(asset_id) {
return publishRest.assetMetadataURI(this.identifier, this.version, asset_id);
},
Expand Down