[vtkusers] Scalar Array Pointer

Michnay Balázs michnay at freemail.hu
Wed Jan 19 08:05:46 EST 2005

Dear VTK Users,
Presumably my problem is related more to pointer operations than to 
I'd like to perform some pixel operations on a vtkImageData. I use the 
following code:

vtkImageData *labeledImage = vtkImageData::New();

//getting scalar values
vtkDataArray *scalarArrayOriginal = pDoc->threshImage->GetPointData

//Get the number of pixels: 
int NumberOfPixels = scalarArrayOriginal->GetNumberOfTuples();
//x-y dimensions:
int ImageDimensions[3];

//I'd like to make another instance the array containing the scalar 
values, but making a pointer that points to the original one is not good, 
because its modifications would affect the original scalar array.

//The following line gets the scalar dara of the newly instantiated 
vtkDataArray *scalarArrayLabeled = labeledImage->GetPointData()-

//This line generated a run-time error.

How can I make a whole new copy of my original scalar array that can 
be later associated to the new image ?

Thanks for your help in advance,

All the best,


More information about the vtkusers mailing list