Hello,
I have a doubt I am using vtkGPUVolumeRayCastMapper with a label type mask. And I works if I only define label 1. But I add the label 2 it considers the label 1 as label 2 so the material it takes for both labels are label 2. It is as if it overwrites label 1 with label 2 and both have the same material. So If I have a mask of label 1 it returns the image with material 2. That is, the last set. Someone had the same problem?. Can it be a bug?. Thank you
vtkNew<vtkColorTransferFunction> color_tf;
vtkNew<vtkPiecewiseFunction> opacity_tf;
opacity_tf->AddPoint(-100, 0.00);
opacity_tf->AddPoint(0, 0.00);
//SKIN
color_tf->AddRGBPoint(-100, .94, .74, .50);
color_tf->AddRGBPoint(0, .93, .66, .53);
// ARTERY
color_tf->AddRGBPoint(460, .82, .32, .22);
color_tf->AddRGBPoint(464, .44, .72, .82);
color_tf->AddRGBPoint(495, .85, .0, .01);
opacity_tf->AddPoint(volume_opacity_pos_, 0.0);
//BONE
color_tf->AddRGBPoint(568, .90, .85, .75);
color_tf->AddRGBPoint(750, .90, .85, .75);
opacity_tf->AddPoint(volume_opacity_pos_ + 56, 0.05);
opacity_tf->AddPoint(volume_opacity_pos_ + 129, 0.05);
opacity_tf->AddPoint(volume_opacity_pos_ + 324, 0.05);
opacity_tf->AddPoint(volume_opacity_pos_ + 335, 0.05);
//TEETH
color_tf->AddRGBPoint(850, .96, .96, .96);
opacity_tf->AddPoint(volume_opacity_pos_ + 379, 0.0);
//Fully Transparent
vtkNew<vtkColorTransferFunction> color_tf2;
color_tf2->DeepCopy(color_tf);
vtkNew<vtkPiecewiseFunction> opacity_tf2;
opacity_tf2->AddPoint(-100, 0.00);
opacity_tf2->AddPoint(0, 0.00);
opacity_tf2->AddPoint(volume_opacity_pos_, 0.0);
opacity_tf2->AddPoint(volume_opacity_pos_ + 56, 0.00);
opacity_tf2->AddPoint(volume_opacity_pos_ + 129, 0.00);
opacity_tf2->AddPoint(volume_opacity_pos_ + 324, 0.00);
opacity_tf2->AddPoint(volume_opacity_pos_ + 335, 0.00);
opacity_tf2->AddPoint(volume_opacity_pos_ + 379, 0.0);
//I have tried just in case
//vtkVolumeProperty::SafeDownCast
//(get_volume()->GetProperty())->
//SetIndependentComponents(true);
//Semi Transparent
vtkVolumeProperty::SafeDownCast(get_volume()->GetProperty())->SetLabelColor(1, color_tf);
vtkVolumeProperty::SafeDownCast(get_volume()->GetProperty())->SetLabelScalarOpacity(1, opacity_tf);
//Transparent
vtkVolumeProperty::SafeDownCast(get_volume()->GetProperty())->SetLabelColor(2, color_tf2);
vtkVolumeProperty::SafeDownCast(get_volume()->GetProperty())->SetLabelScalarOpacity(2, opacity_tf2);
vtkGPUVolumeRayCastMapper::SafeDownCast
(dcm_volume_->volume_->GetMapper())
->SetMaskTypeToLabelMap();
vtkGPUVolumeRayCastMapper::SafeDownCast
(dcm_volume_->volume_->GetMapper())
->SetMaskInput(ImageCast->GetOutput());
vtkGPUVolumeRayCastMapper::
SafeDownCast(dcm_volume_->volume_
->GetMapper())->SetMaskBlendFactor(1.0);
vtkGPUVolumeRayCastMapper::SafeDownCast
(dcm_volume_->volume_->
GetMapper())->Update();
dcm_volume_->volume_->
GetMapper()->Modified();