[vtkusers] dereferences a pointer to vtkImageData

David Doria 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:
> Hi,
>
> 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'"
>
> Thanks
> David

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() ).

David



More information about the vtkusers mailing list