IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Browse Source

Support for viewing .nii.gz

master
parent
commit
39a1eb82fa
1 changed files with 10 additions and 2 deletions
  1. +10
    -2
      frontend/src/js/component/wb-collection-content.js

+ 10
- 2
frontend/src/js/component/wb-collection-content.js View File

@@ -15,6 +15,14 @@ function encodeURIComponentIncludingDots(s) {
return encodeURIComponent(s).replace('.', '%2E');
}
function endsWith(what, endings) {
if (typeof(endings) === 'string')
return what.endsWith(endings);
if (endings instanceof Array)
return endings.map(a => what.endsWith(a)).reduce((a, b) => (a || b));
throw Error('Expected second argument to be either a string or an array');
}
class WBCollectionContent extends Component {
constructor(...args) {
super(...args);
@@ -143,7 +151,7 @@ class WBCollectionContent extends Component {
alert('Not implemented.')
} }><i class="far fa-eye"></i></button>
{ item[1].toLowerCase().endsWith('.nii') ? (
{ endsWith(item[1].toLowerCase(), ['.nii', '.nii.gz']) ? (
<button class="btn btn-outline-primary mx-1" title="View Image"
onclick={ () => manifestWorker.postMessage([ 'getFile',
'.' + collectionPath + '/' + item[1] ]).then(e => {
@@ -154,7 +162,7 @@ class WBCollectionContent extends Component {
const blocksBlobUrl = URL.createObjectURL(blob);
window.open('/image-viewer/' + encodeURIComponent(blocksBlobUrl), '_blank');
}) }><i class="far fa-eye"></i></button>
}) }><i class="fas fa-image"></i></button>
) : null }
</div>
) : null)


Loading…
Cancel
Save