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

Colorbar placement overlaps sagittal slices in new test image #50

Closed hanayik closed 3 years ago

hanayik commented 3 years ago

The colorbar seems to be drawn on top of the last few rows of the sagittal slices in MP view.

example image to demonstrate:

Put this in App.vue for volume URL "https://openneuro.org/crn/datasets/ds002328/snapshots/1.0.0/files/sub-01:anat:sub-01_T1w.nii.gz"

screenshot

Screenshot 2021-03-02 at 10 53 00
neurolabusc commented 3 years ago

Fix by changing line 547

drawColorbar(gl, [ltwh[0]+wX+margin, ltwh[1] + hY + margin, wY - margin - margin, hY * colorbarHeight]);

to read

drawColorbar(gl, [ltwh[0]+wX+margin, ltwh[1] + hZ + margin, wY - margin - margin, hY * colorbarHeight]);

The latest pull request demonstrates writing a multi-character string with descenders by writing the string Syzygy. You may want to delete that line, but if you maintain it, it should also be adjusted:

//demonstrate multi-character string with font descenders
drawTextBelow(gl, [ltwh[0]+wX + (0.5 * wY), ltwh[1] + hZ + margin + hY * colorbarHeight ], "Syzygy");
//draw colorbar (optional)
var margin = colorBarMargin * hY;
drawColorbar(gl, [ltwh[0]+wX+margin, ltwh[1] + hZ + margin, wY - margin - margin, hY * colorbarHeight]);