itk-vtk-viewer icon indicating copy to clipboard operation
itk-vtk-viewer copied to clipboard

Problem volume rendering some images with large values

Open scottwittenburg opened this issue 5 years ago • 1 comments

When I "compose" just the 190216_t2_extracted.nrrd image with itself, using the itk.imread('190216_t2_extracted.nrrd', itk.F) method to read the image, it seems the use of itk.F causes the input values (which are Float64Array) to be "downcast" to Float32Array. When I use the viewer to volume render the resulting data, the view is initially black, but if I turn off "Use Shadow", I can see something, but it's still wrong.

Here's an animated gif illustrating the problem.

volren-issue

scottwittenburg avatar Apr 30 '20 02:04 scottwittenburg

I think this is related to #272 in that it is caused by volume rendering large scalar values. The reason the Float64Array version of the data doesn't suffer from the issue is that it fails this check, resulting in "conversion to float", here. That code path transforms the large values to a smaller range before uploading them to texture, at the same time sending extra uniforms to the shader so the values can be transformed back after being retrieved from the texture.

By commenting out lines 1058 -1065, linked above, the transformation path is forced, which resolves the issue, but probably causes other problems (e.g. inefficiency in a lot of use cases). So we should look for a better solution.

scottwittenburg avatar Apr 30 '20 04:04 scottwittenburg