Skip to content

Commit

Permalink
BUG: Hide volume rendering color transfer function if using direct co…
Browse files Browse the repository at this point in the history
…lor mapping

When rendering RGB or RGBA volumes are rendered (using IndependentComponents volume rendering property set to false) then the color is read directly from the voxel's RGB value. In this case color transfer function is ignored.

To avoid user confusion by being able to adjust the color transfer function that has no effect, the color transfer function section is not displayed if IndependentComponents=false.
  • Loading branch information
lassoan committed Jul 25, 2021
1 parent a335811 commit ee50c56
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Libs/Visualization/VTK/Widgets/ctkVTKVolumePropertyWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ void ctkVTKVolumePropertyWidget::updateFromVolumeProperty()
vtkColorTransferFunction* colorTransferFunction = 0;
vtkPiecewiseFunction* opacityFunction = 0;
vtkPiecewiseFunction* gradientFunction = 0;
bool scalarColorMapping = true;
if (d->VolumeProperty)
{
colorTransferFunction =
Expand All @@ -229,6 +230,7 @@ void ctkVTKVolumePropertyWidget::updateFromVolumeProperty()
gradientFunction =
d->VolumeProperty->GetGradientOpacity()->GetSize() ?
d->VolumeProperty->GetGradientOpacity() : 0;
scalarColorMapping = d->VolumeProperty->GetIndependentComponents();
}

d->ScalarOpacityThresholdWidget->setPiecewiseFunction(
Expand All @@ -254,6 +256,10 @@ void ctkVTKVolumePropertyWidget::updateFromVolumeProperty()
d->ScalarColorWidget->view()->setColorTransferFunctionToPlots(colorTransferFunction);
d->GradientWidget->view()->setPiecewiseFunctionToPlots(gradientFunction);

// If color is specified by dependent components (RGBA volume) then do not show scalar color transfer
// function, because that function has no effect.
d->ScalarColorGroupBox->setVisible(scalarColorMapping);

if (d->VolumeProperty)
{
d->InterpolationComboBox->setCurrentIndex(
Expand Down

0 comments on commit ee50c56

Please sign in to comment.