[vtkusers] CellData null pointer?

Brett Tully brett.tully at oxyntix.com
Mon May 14 15:37:13 EDT 2012


Thanks David,
I probably should have mentioned, I am running 5.0.8. Thus, vtkImageData
doesn't have an Allocate method, but it does have Initialize -- I have
tried this with no luck.
Brett

On Mon, May 14, 2012 at 7:10 PM, David Doria <daviddoria at gmail.com> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120514/c090620c/attachment.htm>


More information about the vtkusers mailing list