[vtkusers] Re: LookupTable + ImagePlaneWidget

dean.inglis at camris.ca dean.inglis at camris.ca
Wed May 3 13:34:27 EDT 2006


you access the buffer of the output of the colormap the same as you would 
with the reslicer's vtkImageData output. 
Actually, what I should have said last time was to set the 
colormap before you set the input to the widget, and only if you have
special requirements for doing so:

vtkImageMapToColors* myColorMap = vtkImageMapToColors::New();
planeY->SetColorMap(myColorMap);
planeY->SetInput(some_input_image);


Otherwise, you can just access the color map and its output like this:

QImage((uchar*)(planeY->GetColorMap()->GetOutput()->GetScalarPointer()), ....);

myImg->save("EssaiVTK.jpg","JPEG"); //Save the image in the DD;


Dean



Hello,
thank you for your help, but I still begining in the VTk's big world so 
excuse me if I'm asking abvious questions, but really I need help.
I did like following :
...

planeY->SetWindowLevel(WW,WC); //PlaneY is a vtkImagePlaneWidget
vTKWidget1->GetRenderWindow()->Render(); // rendering the new image  : 
vTKWidget1 is a QVTKWidget
vtkImageMapToColors* myColorMap = vtkImageMapToColors::New();
planeY->SetColorMap(myColorMap);
//access to the widget's reslice's buffer
QImage *myImg=new 
QImage((uchar*)(planeX->GetResliceOutput()->GetScalarPointer()), ....);
myImg->save("EssaiVTK.jpg","JPEG"); //Save the image in the DD;
..
nothing happens , the image is the same!

Is there something wron or I didn't access to the right Buffer because I 
didnt' know how to access to the buffer from the underlying 
vtkImageMapToColors.

thank you for your help, I really need it
regards,
Med.

> Hi,
>
> you need to access the buffer from the underlying vtkImageMapToColors:
> vtkImageMapToColors  *ColorMap;
>
> since the resliced output gets set in:
>
> void vtkImagePlaneWidget::SetInput(vtkDataSet* input)
> {
> ...
> this->ColorMap->SetInput(this->Reslice->GetOutput());
> ...
> }
>
> you can set the color map externally due to the following macro
> defined in vtkImagePlaneWidget.cxx:
>
> vtkCxxSetObjectMacro(vtkImagePlaneWidget, ColorMap, vtkImageMapToColors);
>
> just do
>
> vtkImageMapToColors* myColorMap = vtkImageMapToColors::New();
> widget->SetColorMap(myColorMap);
>
> and access the buffer as you like.




More information about the vtkusers mailing list