<font size="2"><font face="verdana,sans-serif">Hi all,</font></font><div><font size="2"><font face="verdana,sans-serif"><br></font></font></div><div><font size="2"><font face="verdana,sans-serif">I have the following menu handler:</font></font></div>
<div><font size="2"><div style="font-family: verdana, sans-serif; "><br></div><div><font class="Apple-style-span" face="'courier new', monospace">void MainWindow::on_TF_chosen(QAction *action)</font></div><div><font class="Apple-style-span" face="'courier new', monospace">{</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> if (volume) //volume is loaded and set up</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> {</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> volume->SetProperty( tf[action->data().toInt()] );</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> vis->GetRenderWindow()->Render();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> }</font></div><div><font class="Apple-style-span" face="'courier new', monospace">}</font></div><div style="font-family: verdana, sans-serif; ">
<br></div><div><font class="Apple-style-span" face="'courier new', monospace">tf</font><span class="Apple-style-span" style="font-family: verdana, sans-serif; "> is an array of </span><font class="Apple-style-span" face="'courier new', monospace">vtkVolumeProperty*</font><font class="Apple-style-span" face="verdana, sans-serif">s, containing combinations of color and opacity transfer functions. However, when transfer function is changed with this procedure, the result is not what I expect: transfer functions are either not changed, or they are changed to something I didn't specify.</font></div>
<div><font class="Apple-style-span" face="verdana, sans-serif"><br></font></div><div><font class="Apple-style-span" face="verdana, sans-serif">Is there some call missing here, something like "UpdateTransferFunctions"?</font></div>
<div><font class="Apple-style-span" face="verdana, sans-serif"><br></font></div><div><font class="Apple-style-span" face="verdana, sans-serif">This is the code from form constructor:</font></div><div><font class="Apple-style-span" face="verdana, sans-serif"><br>
</font></div><div><div><div><font class="Apple-style-span" face="'courier new', monospace">//manually create transfer functions</font></div><div><font class="Apple-style-span" face="'courier new', monospace">tf[0] = vtkVolumeProperty::New();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">vtkPiecewiseFunction *opacityFun0 = vtkPiecewiseFunction::New();</font></div><div><font class="Apple-style-span" face="'courier new', monospace">tf[0]->SetScalarOpacity( opacityFun0 );</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">opacityFun0->AddPoint(0, 0);</font></div><div><font class="Apple-style-span" face="'courier new', monospace">opacityFun0->AddPoint(255, 0 );</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">tf[0]->ShadeOn();</font></div><div><font class="Apple-style-span" face="'courier new', monospace">tf[0]->SetScalarOpacityUnitDistance(0.8919);</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">tf[1] = vtkVolumeProperty::New();</font></div><div>
<font class="Apple-style-span" face="'courier new', monospace">vtkColorTransferFunction *colorFun1 = vtkColorTransferFunction::New();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">vtkPiecewiseFunction *opacityFun1 = vtkPiecewiseFunction::New();</font></div><div><font class="Apple-style-span" face="'courier new', monospace">tf[1]->SetColor( colorFun1 );</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">tf[1]->SetScalarOpacity( opacityFun1 );</font></div><div><font class="Apple-style-span" face="'courier new', monospace">tf[1]->SetInterpolationTypeToLinear();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">colorFun1->AddRGBPoint( 0, .55, .75, .85 );</font></div><div><font class="Apple-style-span" face="'courier new', monospace">colorFun1->AddRGBPoint( 80, .88, .60, .29 );</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">opacityFun1->AddPoint(0, 0);</font></div><div><font class="Apple-style-span" face="'courier new', monospace">opacityFun1->AddPoint(80, .5 );</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">tf[1]->ShadeOn();</font></div><div><font class="Apple-style-span" face="'courier new', monospace">tf[1]->SetScalarOpacityUnitDistance(0.8919);</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace">tf[2] = vtkVolumeProperty::New();</font></div><div>
<font class="Apple-style-span" face="'courier new', monospace">vtkColorTransferFunction *colorFun2 = vtkColorTransferFunction::New();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">vtkPiecewiseFunction *opacityFun2 = vtkPiecewiseFunction::New();</font></div><div><font class="Apple-style-span" face="'courier new', monospace">tf[2]->SetColor( colorFun2 );</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">tf[2]->SetScalarOpacity( opacityFun2 );</font></div><div><font class="Apple-style-span" face="'courier new', monospace">tf[2]->SetInterpolationTypeToLinear();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">colorFun2->AddRGBPoint( 0, .55, .9, .5 );</font></div><div><font class="Apple-style-span" face="'courier new', monospace">colorFun2->AddRGBPoint( 160, .88, .1, .1 );</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">opacityFun2->AddPoint(0, 0);</font></div><div><font class="Apple-style-span" face="'courier new', monospace">opacityFun2->AddPoint(160, .6 );</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">tf[2]->ShadeOn();</font></div><div><font class="Apple-style-span" face="'courier new', monospace">tf[2]->SetScalarOpacityUnitDistance(0.8919);</font></div>
</div><div style="font-family: verdana, sans-serif; "><br></div><div style="font-family: verdana, sans-serif; ">Thanks,</div><div style="font-family: verdana, sans-serif; ">Dženan</div></div></font></div>