[vtkusers] Refreshing window level of vtkImagePlaneWidget
Girish Lande
girish.lande at agiliad.com
Thu Mar 2 03:55:21 EST 2017
Hi All,
I am creating 3 vtkImagePlaneWidgets Each showing some image.
I want to update their window/level at the same time.
that is when I update window level of one widget others should reflect the
same.
For that I am using callbacks. (following is my code)
Each imageplanewidget is in different view.
Though window / level is updated its not refreshing changes.
I see changes only when I try to update window/level of other image plane
widgets.
Could you please help me with this ? I want to refresh all widgets to see
that
window level is getting updated simultaneouly
--
thanks & regards,
Girish
void MainWindow::RegisterCallbackWith2DPlaneWidget()
{
vtkSmartPointer<MyCallback> cbk =
vtkSmartPointer<MyCallback>::New();
cbk->m_window = this;
for (int i = 0; i < 3; i++)
{
cbk->m_PlaneWidget[i] = m_2DPlaneWidget[i];
m_2DPlaneWidget[i]->AddObserver(vtkCommand::WindowLevelEvent,cbk);
}
}
class MyCallback : public vtkCommand
{
public:
static MyCallback *New()
{ return new MyCallback; }
void Execute( vtkObject *caller, unsigned long ev,
void *callData )
{
if (ev == vtkCommand::WindowLevelEvent)
{
vtkImagePlaneWidget* ipw =
dynamic_cast< vtkImagePlaneWidget* >( caller );
if (ipw)
{
double* wl = static_cast<double*>( callData );
if ( ipw == this->m_PlaneWidget[0] )
{
this->m_PlaneWidget[1]->SetWindowLevel(wl[0],wl[1],1);
this->m_PlaneWidget[2]->SetWindowLevel(wl[0],wl[1],1);
}
else if( ipw == this->m_PlaneWidget[1] )
{
this->m_PlaneWidget[0]->SetWindowLevel(wl[0],wl[1],1);
this->m_PlaneWidget[2]->SetWindowLevel(wl[0],wl[1],1);
}
else if (ipw == this->m_PlaneWidget[2])
{
this->m_PlaneWidget[0]->SetWindowLevel(wl[0],wl[1],1);
this->m_PlaneWidget[1]->SetWindowLevel(wl[0],wl[1],1);
}
}
this->m_PlaneWidget[0]->GetInteractor()->GetRenderWindow()->Render();
this->m_PlaneWidget[1]->GetInteractor()->GetRenderWindow()->Render();
this->m_PlaneWidget[2]->GetInteractor()->GetRenderWindow()->Render();
this->m_PlaneWidget[0]->UpdatePlacement();
this->m_PlaneWidget[1]->UpdatePlacement();
this->m_PlaneWidget[2]->UpdatePlacement();
}
}
vtkImagePlaneWidget* m_PlaneWidget[3];
}
--
-------------------------------------------------------------------------------------------------------------------------
*Disclaimer:* This email message including any attachments is confidential,
and may be privileged and proprietary to Agiliad. If you are not the
intended recipient, please notify us immediately by replying to this
message and destroy all copies of this message including any attachments.
You are NOT authorized to read, print, retain, copy, disseminate,
distribute, or use this message or any part thereof. Thank you.
------------------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170302/a97b5341/attachment.html>
More information about the vtkusers
mailing list