Q about vtkXYPlotActor

Tian-Qing Ye tianqing.ye at bruker.co.uk
Tue Aug 31 13:19:04 EDT 1999


Hi there

Can anyone help me with the following problem?

I have a StructuredPoints volume Vol[64x64x64] built with
Origin = (0., 0., 371.) and Spacing(1.0, 1.0, 1.0);

Then I tried to extract a line alone z-axis out of it:
   line = vtkStructuredPointsGeometryFilter::New();
   line->SetInput(Vol);
   line->SetExtent(20,20,20,20,0,63);
   
   // check the bounds
   float *bonds = line->GetOutput()->GetBounds();
   printf("Xmin = %f Xmax = %f\n", bonds[0], bonds[1]); // get 20., 20.
-- correct
   printf("Ymin = %f Ymax = %f\n", bonds[2], bonds[3]); // get 20., 20.
-- correct
   printf("Zmin = %f Zmax = %f\n", bonds[4], bonds[5]); // get 371.,
434. -- correct

   //Now plot it:

    xyplot= vtkXYPlotActor::New();
        xyplot->SetNumberOfXLabels(6);
        xyplot->GetPositionCoordinate()->SetValue(0., .0, 0);
        xyplot->GetPosition2Coordinate()->SetValue(1.0, 0.83, 0);
        xyplot->SetXValuesToArcLength();
        xyplot->GetProperty()->SetColor(0,0,1);

    plotRen = vtkRenderer::New();
        plotRen->SetBackground(1, 1, 1);
        plotRen->AddActor2D(xyplot);

    wnd = vtkXRenderWindow::New();
        wnd->AddRenderer(plotRen);
        wnd->SetSize(560,250);
  
    xyplot->AddInput(line->GetOutput());	   

    wnd->Render();

The problem is, instead of showing 371.0 -- 434.0, the x-axis bounds
show 0.0 -- 63.0!! which are the pixel numbers.

How can I make it showing the correct bounds?

Any help highly appreciated!

T. -Q. Ye


-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------





More information about the vtkusers mailing list