HumanBrainProject / neuroglancer-scripts

Conversion of neuroimaging data for display in Neuroglancer
MIT License
27 stars 18 forks source link

conversion of nii file to segmentations, NG does not properly display converted segment if original encoding is float instead of uint #4

Closed xgui3783 closed 6 years ago

xgui3783 commented 6 years ago

when following the guide on converting nii file to NG precomputed segmentations, I ran into the case where the nii file is encoded in float. While NG can display the converted chunks (on hover shows the right label), the segments do not have colour map applied.

The nii had to be converted to one of the uint encodings (in my case, uint8).

Would it be wise to log a warning if user had --type=segmentation flag on, and the nii file is encoded in float?

related: would be cool if the nii encoding conversion can be done by the script (or a separate library, if there is a need as such)

ylep commented 6 years ago

related: would be cool if the nii encoding conversion can be done by the script (or a separate library, if there is a need as such)

@xgui3783 You can already do this by setting the data_type attribute in info_fullres.json (or even directly in info). The volume-to-precomputed converter will convert the data type on the fly, trying to be smart (i.e. it will perform rounding and clamping of the values to the output range).