Problem with ImageReslice

Hi everyone,
I’m working on the resliceCursorWidget demo,and did setColorLevel(1000), setColorWindow(4000) to change color on the property of the vtkImageSlice instance for better look, but when I make a rotation or some transform, the background seems not to be correct. This is what it looks like,
What I’m expecting is the edge parts(pointed by blue arrows) should be the same with the empty part(pointed by the green arrow).
What I’ve done on ImageReslice instance are:

setBackgroundColor(0, 0, 0, 0);

Is there any idea for this?

I wonder if this commit has fixed the setBackgroundColor() setter.
Would you mind trying with latest master branch?

Please note that the background color variable is still not well handled. It should have as many components as your input volume (e.g. 3 if input volume is RGB, 1 if input volume is single scalar).

Hi Julien,
I tried the latest 25.11.0 but it seems not work, my input volume is single scalar from a series of CT scan, when I did setBackgroundColor(0) or setBackgroundColor(0, 0, 0) I got Invalid number of values for array setter (backgroundColor) , it only worked when I did setBackgroundColor(0, 0, 0, 0) but the problem still remained

This is a CT image, so the black area probably has a value of -1000. Try this:


In a CT image that uses Hounsfield units, the following values can be useful:

-1000    air
    0    water
+1000    hard bone

Since vtk.js doesn’t have setBackgroundLevel(), do this instead:

setBackgroundColor(-1000.0, -1000.0, -1000.0, 0.0);
1 Like

Thank you, this works

The final solution is:

  1. Upgrade to latest version(currently v25.11.0 with the Image reslice oriented image support)
  2. setBackgroundColor(-1000.0, -1000.0, -1000.0, 0.0)
    Previous versions will not support a color value of negative number in the params