Skip to content
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

Allow volume loaders to parse sources directly #298

Merged
merged 1 commit into from
May 3, 2016

Conversation

Tom32i
Copy link
Contributor

@Tom32i Tom32i commented May 3, 2016

Feature

Allows a third way to load volumes: by directly providing the source data.

var buffer = ArrayBuffer();
var callback = function (volume) { };

BrainBrowser.VolumeViewer.volume_loaders.nifti1({
    'nii_source': buffer,
    'type': 'nifti1'
}, callback);

Why

I need to load volumes files from a secured server that requires authentification (so custom headers on HTTP requests). The BrainBrowser.loader:loadFromURL does not allow me to modify request headers easily.
So I'd rather handle the downloading on volumes files myself, and rely on the volumes loaders for their core feature: parsing and manipulating the data.

Implementation

The implementation is quite simple, generic and non-intrusive:

  • It allows a third option named source (or nii_source for nifti files and header_source and raw_data_source for minc files, to follow their respective naming pattern).
  • It's backward compatible.
  • Tests are passing (I did not add specific tests on my feature yet though).
  • I tried to be consistent with the coding style.

Questions

I'm not sure whether or not I should commit the following built files:

  • build/brainbrowser-2.4.1/brainbrowser.volume-viewer.min.js
  • release/brainbrowser-2.4.1.tar.gz

Final thoughts

I would have used parseNifti1Header and createNifti1Volume but they're scoped and inaccessible.

@PaulMougel
Copy link
Contributor

👍

@rdvincent rdvincent merged commit 300cac4 into aces:master May 3, 2016
@natacha-beck
Copy link
Contributor

@Tom32i : Thanks a lot. Like that it is perfect the *.min.js and the *.tar.gz will be generate and add to the next release.

@Tom32i
Copy link
Contributor Author

Tom32i commented May 4, 2016

Awesome, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants