[vtk-developers] reproducible vtkImagePlaneWidget(?) bug
dean.inglis at on.aibn.com
dean.inglis at on.aibn.com
Fri May 9 22:08:28 EDT 2003
Charl,
here is what I get, without hanging on Windows 2000 Pro,
built with Cmake 1.6.6, Borland bcc32 compiler, MinSizeRel build:
a .cxx incarnation (I also ran a tcl version without pb's but
I could not catch the error popup so I made the cxx vers with
vtkFileOutputWindow).
Dean
contents of debug.log:
ERROR: In c:\Builder\Sources\VTK\Filtering\vtkImageToImageFilter.cxx, line 94
vtkImageThreshold (0196EB60): ExecuteInformation: Input is not set.
ERROR: In c:\Builder\Sources\VTK\Common\vtkSource.cxx, line 374
vtkImageThreshold (0196EB60): At least 1 inputs are required but only 0 are specified
ERROR: In c:\Builder\Sources\VTK\Graphics\vtkPlaneSource.cxx, line 373
vtkPlaneSource (01973000): Bad plane coordinate system
ERROR: In c:\Builder\Sources\VTK\Graphics\vtkPlaneSource.cxx, line 373
vtkPlaneSource (01973000): Bad plane coordinate system
ERROR: In c:\Builder\Sources\VTK\Graphics\vtkPlaneSource.cxx, line 373
vtkPlaneSource (01973000): Bad plane coordinate system
cxx source:
#include "vtkOutputWindow.h"
#include "vtkFileOutputWindow.h"
#include "vtkVolume16Reader.h"
#include "vtkImageThreshold.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkImagePlaneWidget.h"
#include "vtkDataSet.h"
void main()
{
vtkOutputWindow* ow = vtkOutputWindow::GetInstance();
vtkFileOutputWindow* fow = vtkFileOutputWindow::New();
fow->SetFileName("debug.log");
if(ow)
{
ow->SetInstance(fow);
}
fow->Delete();
vtkVolume16Reader* v16 = vtkVolume16Reader::New();
v16->SetDataDimensions( 64, 64);
v16->SetDataByteOrderToLittleEndian();
v16->SetFilePrefix( "c:\\Builder\\Sources\\VTKData\\Data\\headsq\\quarter");
v16->SetImageRange( 1, 93);
v16->SetDataSpacing( 3.2, 3.2, 1.5);
// v16->Update();
vtkImageThreshold* thresh = vtkImageThreshold::New();
thresh->ThresholdBetween(2000, 65535);
thresh->SetInValue(1.0);
thresh->SetOutValue(0.0);
// thresh->SetInput(v16->GetOutput());
thresh->Update();
vtkRenderer* renderer = vtkRenderer::New();
renderer->SetBackground(0.5, 0.5, 0.5 );
vtkRenderWindow* renderWindow = vtkRenderWindow::New();
renderWindow->AddRenderer( renderer);
// renderWindow->SetSize(300, 300);
vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renderWindow);
//# initialise an IPW
vtkImagePlaneWidget* ipwX = vtkImagePlaneWidget::New();
ipwX->DisplayTextOn();
//# the IPW does need metadata
ipwX->SetInput((vtkDataSet*)thresh->GetOutput());
ipwX->SetPlaneOrientationToXAxes();
//# activate it
ipwX->SetInteractor(iren);
ipwX->On();
iren->Initialize();
renderWindow->Render();
iren->Start();
iren->Delete();
renderWindow->Delete();
ipwX->Delete();
renderer->Delete();
thresh->Delete();
v16->Delete();
}
tcl source:
package require vtk
package require vtkinteraction
vtkVolume16Reader v16
v16 SetDataDimensions 64 64
v16 SetDataByteOrderToLittleEndian
v16 SetFilePrefix "$VTK_DATA_ROOT/Data/headsq/quarter"
v16 SetImageRange 1 93
v16 SetDataSpacing 3.2 3.2 1.5
# v16 Update
vtkImageThreshold thresh
thresh ThresholdBetween 2000 65535
thresh SetInValue 1.0
thresh SetOutValue 0.0
# thresh SetInput [ v16 GetOutput]
thresh Update
vtkRenderer renderer
renderer SetBackground 0.5 0.5 0.5
vtkRenderWindow renderWindow
renderWindow AddRenderer renderer
# renderWindow SetSize 300 300
vtkRenderWindowInteractor iren
iren SetRenderWindow renderWindow
# initialise an IPW
vtkImagePlaneWidget ipwX
ipwX DisplayTextOn
# the IPW does need metadata
ipwX SetInput [ thresh GetOutput ]
ipwX SetPlaneOrientationToXAxes
# activate it
ipwX SetInteractor iren
ipwX On
iren AddObserver UserEvent {wm deiconify .vtkInteract}
iren Initialize
# prevent the tk window from showing up then start the event loop
wm withdraw .
>
> From: "Charl P. Botha" <c.p.botha at its.tudelft.nl>
> Date: 2003/05/09 Fri PM 09:49:03 GMT-04:00
> To: vtk-developers at public.kitware.com
> CC: dean.inglis at on.aibn.com
> Subject: Re: [vtk-developers] reproducible vtkImagePlaneWidget(?) bug
>
> On Sat, May 10, 2003 at 02:24:53AM +0200, Charl P. Botha wrote:
> > On Sat, May 10, 2003 at 02:20:26AM +0200, Charl P. Botha wrote:
> > > I have attached a short VTK Python script which bugs badly under Windows
> > > (but not under Linux). In short, if one connects something with an empty
> >
> > This time, I'm actually going to attach it.
>
> Okay, I've found the bug. Dean, in the vtkImagePlaneWidget::UpdateNormal,
> you have the following check:
>
> int extentX = 1;
> while (extentX < planeSizeX/spacingX)
> {
> extentX = extentX << 1;
> }
>
> int extentY = 1;
> while (extentY < planeSizeY/spacingY)
> {
> extentY = extentY << 1;
> }
>
> So, if the input data is "empty" (as illustrated by the Python example
> attached to my previous mail), spacingX and spacingY are incredibly small
> numbers and planeSizeX and planeSizeY are incredibly large (just confirmed
> with my trusty debugger) so that planeSizeX/spacingX results in even more
> incredibly large values which means that we sit in that loop for a very long
> time. It looks like extentX might even be wrapping, which means it will
> stay in that loop forever.
>
> Under Windows, the code bugged depending on whether I was compiling with or
> without optimisations. I believe this has to do with implicit variable init
> by the compiler, which would also explain the discrepancy between Windows
> and Linux with regards to this bug.
>
> I believe some sanity checks are called for in vtkImagePlaneWidget.cxx.
> Your thoughts?
>
> Thanks,
> Charl
>
> --
> charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at public.kitware.com
> http://public.kitware.com/mailman/listinfo/vtk-developers
>
More information about the vtk-developers
mailing list