[vtkusers] dereferences a pointer to vtkImageData
daviddoria at gmail.com
Mon Aug 15 17:20:56 EDT 2011
On Mon, Aug 15, 2011 at 5:12 PM, David Brayford <dbrayford at gmail.com> wrote:
> I am trying to dereference a pointer to a vtkImageData object but get
> the following error message on the line where I am trying to pass a
> dereferenced pointer to the SetImageData function.
> // function declaration
> void SetImageDate(vtkImageData im);
> myImage->SetImageData( *image ); // where image is a pointer;
> vtkImageData * image;
> "error C2248: 'vtkImageData::vtkImageData' : cannot access private
> member declared in class 'vtkImageData'"
VTK does not allow you to ever use a non-pointer. That is, this is illegal:
void SetImageDate(vtkImageData im);
and must be changed to
void SetImageDate(vtkImageData* im);
(This corresponds to vtkImageData image; being illegal and needing to
be replaced by vtkImageData* image = vtkImageData::New() ).
More information about the vtkusers