[vtkusers] vtkImagePlaneWidget->GetResliceOutput () Problems!!

dean.inglis at camris.ca dean.inglis at camris.ca
Fri Aug 6 13:13:57 EDT 2004


Hi Istvan,

it's not that anything is really "broken".  You have to update and change things in the
rendering pipeline:
vtkImagePlaneWidget -> vtkImageMapToColors -> vtkImageActor

If you were to modify /Hybrid/Testing/Cxx/ImagePlaneWidget.cxx:

add the following callback 

class vtkIPWCallback : public vtkCommand
{
public:
  static vtkIPWCallback *New()
    { return new vtkIPWCallback; }
  virtual void Execute(vtkObject *caller, unsigned long, void*)
    {
      vtkImagePlaneWidget *widget =
        reinterpret_cast<vtkImagePlaneWidget*>(caller);
      if(!widget) { return; }

      ColorMap->UpdateWholeExtent();   
      
      ImageActor->SetDisplayExtent(ImageActor->GetInput()->GetWholeExtent());

      Renderer->ResetCamera();
      Renderer->Render();         
    }

  vtkIPWCallback():Renderer(0),ImageActor(0),ColorMap(0){}

  vtkImageMapToColors* ColorMap;
  vtkImageActor* ImageActor;
  vtkRenderer           *Renderer;
};

and set it up as follows:

vtkIPWCallback* cbk =  vtkIPWCallback::New();
  cbk->Renderer = ren2;
  cbk->ImageActor = imageActor;
  cbk->ColorMap = colorMap;

  planeWidgetZ->AddObserver(vtkCommand::InteractionEvent,cbk);
  cbk->Delete();

It isn't pretty, but it's a start and it works.

Dean




More information about the vtkusers mailing list