MCPcopy Create free account
hub / github.com/MITK/MITK / UpdateTransferFunctions

Method UpdateTransferFunctions

Modules/MapperExt/src/mitkVolumeMapperVtkSmart3D.cpp:113–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113void 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
160void mitk::VolumeMapperVtkSmart3D::UpdateRenderMode(mitk::BaseRenderer *renderer)

Callers

nothing calls this directly

Calls 9

AddRGBPointMethod · 0.80
NewFunction · 0.50
GetBoolPropertyMethod · 0.45
GetDataNodeMethod · 0.45
GetColorMethod · 0.45
ModifiedMethod · 0.45
GetPropertyMethod · 0.45
GetValueMethod · 0.45
SetColorMethod · 0.45

Tested by

no test coverage detected