How to define a semitransparent mask instead of transparent

Hello,

I have a doubt. I have a volume and I add seeds to apply region growing and those areas selected become transparent by adding the mask in vtkGPUVolumeRayCastMapper. It works well. But I wonder if there is an option to make it semi-transparent. I already have the vtkPiecewiseFunction which change dinamically according to the mouse. I cannot define it again as I would break the volume visualization. Is there any way to specify opacity in those areas to the mapper. I do not want to remove the areas if not certain transparency?. Thanks !!

vtkGPUVolumeRayCastMapper::SafeDownCast(dcm_volume_->volume_->GetMapper())->SetMaskTypeToBinary();
vtkGPUVolumeRayCastMapper::SafeDownCast(dcm_volume_->volume_->GetMapper())->SetMaskInput(mask);

Hi, I have seen that before it was possible to define the label scalar of the mask input. But those functions are obsolete. So they are not found. There is another way to be able to define different materials for regions to make it semitransparent only in some areas? Thanks

volumeProperty->SetLabelColor(1, ctf_1);
volumeProperty->SetLabelScalarOpacity(1, pf);
volumeProperty->SetLabelGradientOpacity(1, gf_1);
volumeProperty->SetLabelColor(2, ctf_2);
volumeProperty->SetLabelScalarOpacity(2, pf_2);

Hello @zandarina, those functions are not obsolete and should be used to get half transparent volume rendering, alongside with vtkGPUVolumeRayCastMapper::SetMaskTypeToLabelMap();

Which version of VTK are you using ?

Hi, thank you for answering. I have the vtk version 8.1.1. But those functions are not in vtkvolumeproperty. So I do not know how to make regions semi_transparent without affecting the original volume if I cannot use these functions. I imagine there is another alternative in older versions but I do not find it.

Thanks

You’re right I checked my vtkVolumeProperty.cxx of the vtk 8.0 and those functions are not implemented yet. This is the reason, that I read in old posts that vtk did not allow semitransparent regions in a small region of the volume. That is, you could not define an additional material within a sub-region of the volume. But it was in older versions. So If I do not find a way, that I think it is not possible in older versions, I will have to update vtk. Thanks !!

I am trying to install vtk 9.0 but I found that all the system has changed. It does not find any of my includes of vtk among other errors with compatibility with other libraries such as vtkbool master which a const must be included in some areas. Someone knows if the version 8.2 already has the functions SetLabelColor and SetLabelScalarOpacity added?. I do not know if there is a manual for vtk 9.0 instal.lation for vs. But to do only semitransparent some areas I think many changes must be done for something it should be simple.

Thanks