[vtkusers] How can I handle the vtkImageData's RGB components individually.
Sedat DOGAN2
d_sedat at hotmail.com
Fri Dec 22 21:16:32 EST 2000
Dear friends,
I compute 3d gradient of a volume by using vtkImageGradient filter as in the text book.
This filter generates an output of float values with 3 components. On the other hand,
vtkImageGradientFilter gives an output of the type vtkImageData.
I want to assign the scalar values of the final vtkImageData to three 1-D pointer arrays which these one dimensional 3 pointers will correspond to each of 3 component's scalar values. How can I do this?
Briefly I can ask the same question, like this:
If I have a vtkImageData with RGB values (in this case, the number of the scalar components is 3 and each of them corresponds to Red Green and blue respectively), how can I handle these R, G, B values into 3 different pointers which represent R G B values individually.I tried to implement the ImageData as if its scalar components are vtkArrays with tuples. But I couldn't succeed.
To be more clear, I want to show you the following codes:
vtkImageGradient *imGrad=vtkImageGradient::New();
imGrad->SetInput(TiffReader->GetOutput) ;
imGrad ->SetDimensionality(3);
imGrad->HandleBoundariesOn();
vtkImageData *imageData;
imageData=imGrad->GetOutput(); /*Here, I think imageData must have 3 components.
int *myPointer1,*mypointer2, *myPointer3;/*I want to assign 1st component's scalars to myPointer1, 2nd to myPointer2 and so on.
I know that, the scalar components of vtkImageData can be reached by the function (void *) GetScalarPointer(int,int,int). But I couldn't understand, how R G B components are ordered in this pointer's addresses. Are they ordered in the form of RGB, RGB, RGB or in another way? I tried to use vtkExtractComponents but still couldn't solve my problem.
Please help me.
Thanks in advance.
Sedat Dogan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20001223/8b10f051/attachment.htm>
More information about the vtkusers
mailing list