[vtkusers] HELP! vtkImagePlaneWidget causing an access violation in vtkimaging.dll

Dean Inglis dean.inglis at camris.ca
Fri Mar 5 09:46:24 EST 2004


Hi Alex,

What sequence of events leads to the access violation?
What type of interaction were you performing with
the widget when the access violation occurs (spinning, scaling,
rotating, edge dragging, cursoring, window levelling, pushing)?
Can you reproduce this behaviour with another data set, such
as the headsq data set in VTKData?  If you can, post the example
as a stand alone .cxx test app that someone without VS could
compile with CMake, or, as a tcl script.


I am curious why you place the widget before setting the input:

    this->planeWidget = vtkImagePlaneWidget::New();
    this->planeWidget->PlaceWidget(0,100,0,100,0,100);
    this->planeWidget->SetInteractor(this->renWin->GetInteractor());

    this->planeWidget->SetInput((vtkDataSet*)this->volLum->GetOutput());
    this->planeWidget->On();

when your data extents from the BMP reader are

    this->BMPreader = vtkBMPReader::New();
    this->BMPreader->SetDataSpacing(1.0,1.0,1.0);
    this->BMPreader->SetDataExtent(0,180,0,144,0,30);



If I were to initialize the widget, I might do the following:

    this->planeWidget = vtkImagePlaneWidget::New();
    this->planeWidget->SetInteractor(this->renWin->GetInteractor());
    this->planeWidget->SetInput((vtkDataSet*)this->volLum->GetOutput());

// let the widget place based on the data
         this->planeWidget->PlaceWidget();

// or be more specific

         this->planeWidget->SetPlaneOrientationToZAxes();

this->planeWidget->SetSliceIndex((this->volLum->GetOutput()->GetExtent()[5]
\
                                         -
this->volLum->GetOutput()->GetExtent()[4])/2);
         this->planeWidget->UpdatePlacement();

// turn it on

    this->planeWidget->On();

The two classes internal to the widget that are part of vtkImaging.dll
are

class vtkImageMapToColors;
class vtkImageReslice;

At the least, you can get the vtkImageMapToColors of the widget and track
its behaviour:

  vtkImageMapToColors* map = this->planeWidget->GetImageMapToColors()
  map->DebugOn();

and at the beginning of your app, catch any messages:

  vtkOutputWindow* ow = vtkOutputWindow::GetInstance();
  vtkFileOutputWindow* fow = vtkFileOutputWindow::New();
  fow->SetFileName("my_debug.log");
  if(ow)
    {
    ow->SetInstance(fow);
    }
  fow->Delete();

Keep me posted...

Dean






More information about the vtkusers mailing list