[vtkusers] CellData null pointer?
David Doria
daviddoria at gmail.com
Mon May 14 14:10:28 EDT 2012
n Mon, May 14, 2012 at 2:05 PM, Brett Tully <brett.tully at oxyntix.com> wrote:
> I have been staring at this for a while and could be making a really dumb
> error, but can anyone explain why the last line segfaults please...? I am
> guessing that I need to initialise something?
>
> vtkSmartPointer<vtkImageData> imageData
> = vtkSmartPointer<vtkImageData>::New();
> imageData->SetExtent(0, 10, 0, 10, 0, 0);
> imageData->SetOrigin(0.0, 0.0, 0.0);
> imageData->SetSpacing(0.1, 0.1, 0.0);
> imageData->SetScalarTypeToDouble();
> vtkSmartPointer<vtkCellData> cellData = imageData->GetCellData();
> cout << cellData->GetNumberOfArrays() << endl;
>
> Thanks,
> Brett.
Try imageData->Allocate() before the GetCellData() call.
David
More information about the vtkusers
mailing list