After playing around with the intensity reporting a bit, I realized that the intensity value display was sometimes wrong in various ways.
First, I discovered that the colored background computed for the intensity values did not reflect the threshold slider position, because we were calling colorFromValue() with undefined values for the minimum and maximum intensities. A simple change causes it to reflect the selected thresholds.
Second, the intensity value was often unreadable because of low contrast between the text and the background color. I found a small code snippet that fixes this by switching between black or white foreground text as appropriate.
Next, I added two accessor functions to the volume, getVoxelMin() and getVoxelMax(), that return the absolute minimum and maximum values of the voxel data. I used them to update the UI so that we don't hard-code the idea that voxel ranges are always 0-255. I would like to relax this assumption soon.
Finally, the intensity values themselves were often wrong, especially for the overlay. I traced this to the way the coordinates are used in getIntensityValue(). I modified the generic getIntensityValue() call to use voxel coordinates to find the current intensity, then I fixed the overlay's getIntensityValue() to correctly translate from the overlay's coordinate system to each of the constituent volume's coordinates. The values should now make sense, although roundoff error in the coordinates can still cause unexpected results.
I think these comments are now longer than the actual code!
After playing around with the intensity reporting a bit, I realized that the intensity value display was sometimes wrong in various ways.
First, I discovered that the colored background computed for the intensity values did not reflect the threshold slider position, because we were calling colorFromValue() with undefined values for the minimum and maximum intensities. A simple change causes it to reflect the selected thresholds.
Second, the intensity value was often unreadable because of low contrast between the text and the background color. I found a small code snippet that fixes this by switching between black or white foreground text as appropriate.
Next, I added two accessor functions to the volume, getVoxelMin() and getVoxelMax(), that return the absolute minimum and maximum values of the voxel data. I used them to update the UI so that we don't hard-code the idea that voxel ranges are always 0-255. I would like to relax this assumption soon.
Finally, the intensity values themselves were often wrong, especially for the overlay. I traced this to the way the coordinates are used in getIntensityValue(). I modified the generic getIntensityValue() call to use voxel coordinates to find the current intensity, then I fixed the overlay's getIntensityValue() to correctly translate from the overlay's coordinate system to each of the constituent volume's coordinates. The values should now make sense, although roundoff error in the coordinates can still cause unexpected results.
I think these comments are now longer than the actual code!