| 111 | } |
| 112 | |
| 113 | void mitk::VolumeMapperVtkSmart3D::UpdateTransferFunctions(mitk::BaseRenderer *renderer) |
| 114 | { |
| 115 | vtkSmartPointer<vtkPiecewiseFunction> opacityTransferFunction; |
| 116 | vtkSmartPointer<vtkPiecewiseFunction> gradientTransferFunction; |
| 117 | vtkSmartPointer<vtkColorTransferFunction> colorTransferFunction; |
| 118 | |
| 119 | bool isBinary = false; |
| 120 | |
| 121 | this->GetDataNode()->GetBoolProperty("binary", isBinary, renderer); |
| 122 | |
| 123 | if (isBinary) |
| 124 | { |
| 125 | colorTransferFunction = vtkSmartPointer<vtkColorTransferFunction>::New(); |
| 126 | |
| 127 | float rgb[3]; |
| 128 | if (!GetDataNode()->GetColor(rgb, renderer)) |
| 129 | rgb[0] = rgb[1] = rgb[2] = 1; |
| 130 | colorTransferFunction->AddRGBPoint(0, rgb[0], rgb[1], rgb[2]); |
| 131 | colorTransferFunction->Modified(); |
| 132 | |
| 133 | opacityTransferFunction = vtkSmartPointer<vtkPiecewiseFunction>::New(); |
| 134 | gradientTransferFunction = vtkSmartPointer<vtkPiecewiseFunction>::New(); |
| 135 | } |
| 136 | else |
| 137 | { |
| 138 | auto *transferFunctionProp = |
| 139 | dynamic_cast<mitk::TransferFunctionProperty *>(this->GetDataNode()->GetProperty("TransferFunction", renderer)); |
| 140 | |
| 141 | if (transferFunctionProp) |
| 142 | { |
| 143 | opacityTransferFunction = transferFunctionProp->GetValue()->GetScalarOpacityFunction(); |
| 144 | gradientTransferFunction = transferFunctionProp->GetValue()->GetGradientOpacityFunction(); |
| 145 | colorTransferFunction = transferFunctionProp->GetValue()->GetColorTransferFunction(); |
| 146 | } |
| 147 | else |
| 148 | { |
| 149 | opacityTransferFunction = vtkSmartPointer<vtkPiecewiseFunction>::New(); |
| 150 | gradientTransferFunction = vtkSmartPointer<vtkPiecewiseFunction>::New(); |
| 151 | colorTransferFunction = vtkSmartPointer<vtkColorTransferFunction>::New(); |
| 152 | } |
| 153 | } |
| 154 | m_VolumeProperty->SetColor(colorTransferFunction); |
| 155 | m_VolumeProperty->SetScalarOpacity(opacityTransferFunction); |
| 156 | m_VolumeProperty->SetGradientOpacity(gradientTransferFunction); |
| 157 | } |
| 158 | |
| 159 | |
| 160 | void mitk::VolumeMapperVtkSmart3D::UpdateRenderMode(mitk::BaseRenderer *renderer) |
nothing calls this directly
no test coverage detected