[vtkusers] want to put cursur on one slice, but the cursor can be seen at mutiple slice

Baoyun Li baoyun_li123 at yahoo.com
Thu May 7 16:08:37 EDT 2009


Dear All: 
This is the first time I sending messeage to the list. I want to put some seeds points on special position of 3D image( lest say slice 100), but finally I can see the cursor at mutiple slice from 1-100.

I use QtVtkWidge and vtkImageView2 to display the image. When I move the slider in QT, I can go through the image slice by slice.

Below is my code to put seed points. vtkCurosr2D is used for painting the curosr. vtkPolyData is used to store all the seed points, I then add the Actor of SeedsGlyph to vtkImageViewer2 render.


     SeedsCursor = vtkCursor2D::New(); 
     //SeedsCursor = vtkImageCursor3D::New(); 
    
     SeedsCursor->AllOff(); 
     SeedsCursor->AxesOn(); 
     SeedsCursor->PointOn(); 
     pts=vtkPoints::New();
    // for(unsigned int i=0;i<200;i++)
         pts->InsertPoint( 0, 128*1.37, 128*1.37, 100 );
    
     VisibleSeedsPolyData=vtkPolyData::New();
     VisibleSeedsPolyData->SetPoints(pts);///// input later
     
     SeedsGlyph = vtkGlyph3D::New(); 
     SeedsGlyph->SetVectorModeToVectorRotationOff(); 
     SeedsGlyph->ScalingOn(); 
     SeedsGlyph->SetScaleModeToDataScalingOff(); 
     SeedsGlyph->SetScaleFactor( 10); 
     SeedsGlyph->SetInput( VisibleSeedsPolyData ); 
     SeedsGlyph->SetSource( SeedsCursor->GetOutput() ); 
     SeedsMapper = vtkPolyDataMapper::New(); 
     SeedsMapper->SetInput( SeedsGlyph->GetOutput() ); 
     SeedsActor = vtkActor::New(); 
     SeedsActor->SetMapper( SeedsMapper ); 
     //image_view2->GetImageActor()->SetOpacity(1.0);
     image_view2->GetRenderer()->AddActor(SeedsActor);

Can somebody teach me what is wrong with my code.

Thanks

Baoyun



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090507/2327f718/attachment.htm>


More information about the vtkusers mailing list