[vtkusers] Error in vtkPlotHistogram2D while updating vtkChartHistogram2D

qt.itk.vtk.help qt.itk.vtk.help at gmail.com
Wed Jul 24 07:29:37 EDT 2013


Hi,

I am using vtkChartHistogram2D as:

vtkChartHistogram2D  * chart=  vtkChartHistogram2D ::New();
vtkScalarsToColors * fun = vtkScalarsToColors::New();
fun->Build();
chart->SetTransferFunction(fun);
chart->SetInput(image);
chart->Update();

while update it crashes, when I debugged I got error in vtkPlotHistogram2D
file in GenerateHistogram() function:

void vtkPlotHistogram2D::GenerateHistogram()
{

 if (!this->Output)
    {
    this->Output = vtkSmartPointer<vtkImageData>::New();
    }
  this->Output->SetExtent(this->Input->GetExtent());
  this->Output->SetNumberOfScalarComponents(4);
  this->Output->SetScalarTypeToUnsignedChar();
  this->Output->AllocateScalars();
... some code ...

  unsigned char *output =
    reinterpret_cast<unsigned char*>(this->Output->GetScalarPointer(0,0,0));

  if (this->TransferFunction)
    {
    this->TransferFunction->MapScalarsThroughTable2(input, output,
VTK_DOUBLE,
                                                    dimension, 1, 4);
    }

While calling MapScalarsThroughTable2() output pointer is having bad values.

Am I doing some mistake while using vtkChartHistogram2D?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130724/816a3745/attachment.htm>


More information about the vtkusers mailing list