[vtkusers] Strange crash using vtkColorTransferFunction and Window/Level

Wagner Sales wsales at gmail.com
Sat Jan 17 17:31:02 EST 2009


Hi all,

I'm using VTK trunk on Ubuntu 8.10 (with default compiler, libs and
tools, other users may be using the same ) and try to set
window/level/lookup table after set a vtkColorTransferFunction and a
vtkPiecewiseFunction to my volume property, as follow:
// in class constructor
  this->opacityFun = vtkPiecewiseFunction::New();
  this->colorFun = vtkColorTransferFunction::New();
  this->opacityFun->AddPoint (0, 0.0);
  this->opacityFun->AddPoint (255, 1.0);
  this->colorFun->AddRGBPoint (0, 0.0, 0.0, 0.0);
  this->colorFun->AddRGBPoint (255, 1.0, 1.0, 1.0);

// in the methods that's I set the functions:
	View3D = PageView->Get3DView();
	property = View3D->GetVolumeProperty();
	property->SetColor(colorFun);
	property->SetScalarOpacity(opacityFun);
	PageView->Render();
	CreateFunctions();
// A comment for the vtkInria3D users only: View3D are a vtkImageView3D

After this, when I try to set the Window/Level I receives a very pretty crash:

#0  0xb1dba440 in free () from /lib/tls/i686/cmov/libc.so.6
#1  0xb1f6f031 in operator delete () from /usr/lib/libstdc++.so.6
#2  0xb3fd36cc in vtkColorTransferFunction::RemoveAllPoints
(this=0x93c3850) at
/home/wsales/Documents/kitware/VTK/Filtering/vtkColorTransferFunction.cxx:503

The crashes occurs in the following method/line from vtkColorTransferFunction:
void vtkColorTransferFunction::RemoveAllPoints()
{
  for(unsigned int i=0;i<this->Internal->Nodes.size();i++)
    {
    delete this->Internal->Nodes[i]; <----- crashes here!!!! (???)
    }
  this->Internal->Nodes.clear();

  this->SortAndUpdateRange();
}

Since I searched the web about crash reports with
vtkColorTransferFunction and none appears, I certainly doing something
very wrong, but I really don't know what.

Someone can help me? Are something about transfer functions that's I
need to avoid?

Thanks a lot by any help,


Wagner



More information about the vtkusers mailing list