ColorLevel/Window in vtkImageCPRMapper

Hi everyone,

I was using vtkImageCPRMapper for CPR reconstruction (vtk.js 29.8.0). However, when I tried to set the values of ProjectionSlabNumberOfSamples and ProjectionSlabThickness for projection, the color window of the results unexpectedly changed. Here are the images:
<1>


<2>

For both images, I set window level to 40 (by vtkImageProperty.setColorLevel) and window width to 350 (by vtkImageProperty.setColorWindow). The differences are:
For image<1>, the number of samples was set to 1 (by vtkImageCPRMapper.setProjectionSlabNumberOfSamples) and thickness was set to 0 (by vtkImageCPRMapper.setProjectionSlabThickness),
while for image<2>, the number of samples was set to 500 and thickness was set to 0.2.

Could I ask why is this happening? My guess is vtkImageCPRMapper assigned 0 to the values of some sample pixels, but in CT images the minimum of the pixel value is negative (e.g. air in lung). It results in the misted image.

I am not sure about my guess and how to achieve the desired result. Any help is appreciated!

Based on my guess above, I searched Internet and found that there is a class in SimpleITK named ResampleImageFilter (SimpleITK: itk::simple::ResampleImageFilter Class Reference). The class has a member function SetDefaultPixelValue() for setting the pixel value when a transformed pixel is outside of the image. And the default default pixel value is 0. If the CPRMapper in VTK has similar mechanism, it could explain the problem.

So is there a way to set the default pixel value when we do resampling in VTK (like changing the value by vtkImageCPRMapper.setProjectionSlabThickness)?