[vtkusers] questions on updating imagePlaneWidget

Richard Layman mdl126 at gmail.com
Thu Jul 20 12:23:04 EDT 2006


The problem is probably somewhere in the data importing. You shouldn't need
the iren->Start() bit after the first time.

On 7/20/06, DuanQi <duanqi79 at hotmail.com> wrote:
>
>
> Dear Richard,
>
> That was actually what I did at first. But when I try to reset input,
> there will be memory access violation errors.
>
> On the first pass, I use following code to initialize the widget:
> //volume rendering
> // Create a cell picker to pick position from the cross sections
> vtkCellPicker *picker = vtkCellPicker::New();
> picker->SetTolerance(0.005);
> // Create texture mapped planes to represent the Axial,Coronal,and
> // Sagittal cross sections
> vtkImagePlaneWidget *planeWidgetX = vtkImagePlaneWidget::New();
> planeWidgetX->DisplayTextOn();
> planeWidgetX->SetInput(vtkImporter->GetOutput());
> planeWidgetX->SetPlaneOrientationToXAxes();
> planeWidgetX->SetSliceIndex(40);
> planeWidgetX->SetPicker(picker);
> planeWidgetX->SetKeyPressActivationValue('x');
> planeWidgetX->GetPlaneProperty()->SetColor(1,0,0);
> planeWidgetX->SetInteractor(iren);
> planeWidgetX->GetLookupTable()->SetRange(0,255);
> planeWidgetX->On();
> vtkImagePlaneWidget *planeWidgetY = vtkImagePlaneWidget::New();
> planeWidgetY->DisplayTextOn();
> planeWidgetY->SetInput(vtkImporter->GetOutput());
> planeWidgetY->SetPlaneOrientationToYAxes();
> planeWidgetY->SetSliceIndex(15);
> planeWidgetY->SetPicker(picker);
> planeWidgetY->SetKeyPressActivationValue('y');
> planeWidgetY->GetPlaneProperty()->SetColor(0,1,0);
> planeWidgetY->SetInteractor(iren);
> planeWidgetY->GetLookupTable()->SetRange(0,255);
> planeWidgetY->On();
> vtkImagePlaneWidget *planeWidgetZ = vtkImagePlaneWidget::New();
> planeWidgetZ->DisplayTextOn();
> planeWidgetZ->SetInput(vtkImporter->GetOutput());
> planeWidgetZ->SetPlaneOrientationToZAxes();
> planeWidgetZ->SetSliceIndex(46);
> planeWidgetZ->SetPicker(picker);
> planeWidgetZ->SetKeyPressActivationValue('z');
> planeWidgetZ->GetPlaneProperty()->SetColor(0,0,1);
> planeWidgetZ->SetInteractor(iren);
> planeWidgetZ->GetLookupTable()->SetRange(0,255);
> planeWidgetZ->On();
> renderer->ResetCamera();
> // interact with data
> renWin->Render();
> iren->Start();
>
> And then, when the image was updated, I use following code to update input
> planeWidgetX->SetInput(vtkImporter->GetOutput());
> planeWidgetY->SetInput(vtkImporter->GetOutput());
> planeWidgetZ->SetInput(vtkImporter->GetOutput());
> planeWidgetX->On();
> planeWidgetY->On();
> planeWidgetZ->On();
> renWin->Render();
> iren->Start();
>
> There will be memory access error on the line
> planeWidgetX->SetInput(vtkImporter->GetOutput());
>  I really can not figure out why is that. Please help me. Thank you.
>
> sincerely yours
> Qi
>
>  ------------------------------
> Date: Thu, 20 Jul 2006 11:32:38 -0400
> From: mdl126 at gmail.com
> To: duanqi79 at hotmail.com
> Subject: Re: [vtkusers] questions on updating imagePlaneWidget
> CC: vtkusers at vtk.org
>
>
>
> Just change the input data source to that for the next time slice and
> re-render. No need to delete or rebuild anything.
>
> On 7/20/06, *DuanQi* <duanqi79 at hotmail.com> wrote:
>
>
> Dear Sir or Madam,
>
> I am using imagePlaneWidget for 3D visualization. Since my data is 3D+t, I
> just wonder if there is a way to update imagePlaneWidget so that it can
> display updated volume at each iteration t? Currently I have to delete the
> renderer at each iteration and rebuild widget again, which will result
> "blinking" during the visualization caused by "On()" method. I just wonder
> if there is a way to reuse existing widget and get the volume data updated?
> Thank you.
>
> sincerely
> DUAN Qi
> duanqi79 at hotmail.com
>
>
>
> ------------------------------
> 率先体验更快速、更简便的新一代电子邮件服务 ― Windows Live Mail<http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
>
> ------------------------------
> 通过全球最受欢迎的即时消息网络与亲友交流 ― Windows Live Messenger<http://get.live.com/messenger/overview>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060720/b962880a/attachment.htm>


More information about the vtkusers mailing list