hanayik / niivue

a WebGL2 based NIFTI volume viewer.
https://hanayik.github.io/niivue
BSD 3-Clause "New" or "Revised" License
11 stars 7 forks source link

loading volume from external URL results in distorted data in viewer #82

Closed hanayik closed 3 years ago

hanayik commented 3 years ago

to load from an external URL the volume at the URL needs to be universally readable. Some servers have security blocks to disallow browsers to repeatedly download files (plus that's unusual behavior for a browser). OpenNeuro seems to have a very permissible server though.

screenshot of issue

Screenshot 2021-03-15 at 11 49 17

neurolabusc commented 3 years ago

Taylor, I think we want some logic to deal with images where cal_min and cal_max are not set in the NIfTI header. There are three solutions:

  1. Use the minimum and maximum values in the dataset: this solution can be poor if outlier voxels are present.
  2. Determine percentiles, set cal_min = 2% and cal_max = 98%. This is the approach AFNI and MRIcron use.
  3. Use FSL's robust range algorithm, which works better than the percentile approach for thresholded images. This is the approach that FSLeyes and MRIcroGL use.

Remember to use approach 1 if the intent_code is labels (e.g. index based atlas). We also want to consider atlas colormaps.