70 #include "vtkSmartPointer.h"
71 #include "vtkCamera.h"
72 #include "vtkCommand.h"
73 #include "vtkImageActor.h"
74 #include "vtkImageData.h"
75 #include "vtkImageMapToWindowLevelColors.h"
76 #include "vtkInteractorStyleImage.h"
77 #include "vtkObjectFactory.h"
78 #include "vtkRenderWindow.h"
79 #include "vtkRenderWindowInteractor.h"
80 #include "vtkRenderer.h"
81 #include "vtkRendererCollection.h"
82 #include "vtkMatrix4x4.h"
83 #include "vtkScalarBarActor.h"
85 #include "vtkCornerAnnotation.h"
86 #include "vtkTextProperty.h"
87 #include "vtkLookupTable.h"
90 #include "vtkCutter.h"
93 #include "vtkPolyDataMapper.h"
94 #include "vtkDataSetCollection.h"
95 #include "vtkPoints.h"
96 #include "vtkIdList.h"
97 #include "vtkOutlineSource.h"
98 #include "vtkMatrixToLinearTransform.h"
99 #include "vtkPointData.h"
100 #include "vtkUnsignedCharArray.h"
101 #include "vtkIntArray.h"
102 #include "vtkImageAccumulate.h"
103 #include "vtkProperty.h"
109 #include "vtkCellPicker.h"
131 int n = this->GetNumberOfItems();
133 for (
int i = 0; i < n*n; i++ )
143 this->InitTraversal();
147 vtkInteractorStyle *style = a->GetInteractorStyle();
161 style->AddObserver(vtkCommand::StartWindowLevelEvent, this->
Command);
162 style->AddObserver(vtkCommand::ResetWindowLevelEvent, this->
Command);
163 style->AddObserver(vtkCommand::WindowLevelEvent, this->
Command);
173 this->Superclass::AddItem (a);
182 this->Superclass::RemoveItem (a);
189 this->Superclass::RemoveAllItems();
196 this->Superclass::ReplaceItem(i, a);
207 this->Superclass::RemoveItem (i);
213 vtkSmartPointer< vtkProperty > plane_property =
214 vtkSmartPointer< vtkProperty >::New();
215 plane_property->SetRepresentationToWireframe();
217 int n = this->GetNumberOfItems();
219 for (
int i = 0; i < n; i++ )
221 for (
int j = 0; j < n; j++ )
224 this->
GetItem(i)->GetSlicePlane(), plane_property, ( i != j ),
true);
226 this->
PlanesActors.push_back(dynamic_cast<vtkProp3D*>(temp));
230 for (
int i = 0; i < n; i++ )
234 dynamic_cast<vtkProp3D*>(this->
GetItem(i)->GetImageActor()));
241 this->InitTraversal();
252 ren->SetBackground(rgb);
259 this->InitTraversal();
276 this->InitTraversal();
296 this->InitTraversal();
308 this->InitTraversal();
320 this->InitTraversal();
332 this->InitTraversal();
343 this->InitTraversal();
345 double t = ParallelScale / Zoom;
349 item->GetRenderer()->GetActiveCamera()->SetParallelScale(t);
351 if ( item->GetInteractorStyle()->
GetInteractor()->GetLightFollowCamera() )
353 item->GetRenderer()->UpdateLightsGeometryToFollowCamera();
369 std::vector< vtkProp3D * >::iterator PlanesActorsIterator =
374 ( *PlanesActorsIterator )->SetVisibility(iVisibility);
375 ++PlanesActorsIterator;
384 this->InitTraversal();
398 this->InitTraversal();
413 this->InitTraversal();
417 vtkInteractorStyle *style = item->GetInteractorStyle();
440 this->InitTraversal();
444 vtkInteractorStyle *style = item->GetInteractorStyle();
447 if ( !style->HasObserver (vtkCommand::WindowLevelEvent, this->Command) )
449 style->AddObserver (vtkCommand::WindowLevelEvent, this->
Command);
454 style->RemoveObservers (vtkCommand::WindowLevelEvent, this->
Command);
467 this->InitTraversal();
471 vtkInteractorStyle *style = item->GetInteractorStyle();
474 if ( !style->HasObserver(vtkCommand::ResetWindowLevelEvent, this->Command) )
476 style->AddObserver (vtkCommand::ResetWindowLevelEvent, this->
Command);
481 style->RemoveObservers (vtkCommand::ResetWindowLevelEvent, this->
Command);
494 this->InitTraversal();
498 vtkInteractorStyle *style = item->GetInteractorStyle();
521 this->InitTraversal();
525 vtkInteractorStyle *style = item->GetInteractorStyle();
548 this->InitTraversal();
552 vtkInteractorStyle *style = item->GetInteractorStyle();
576 this->InitTraversal();
581 vtkInteractorStyle *style = item->GetInteractorStyle();
602 std::cout <<
"in show axe-nothing here" << std::endl;
628 this->InitTraversal();
644 this->InitTraversal();
656 this->InitTraversal();
668 this->InitTraversal();
688 std::vector< vtkProp3D * >
virtual void SetLinkRequestedPosition(unsigned int v)
Description: link requested position (double click) flag.
virtual void SyncResetWindowLevel(void)
Description: Synchronize reset window level between views.
unsigned int LinkResetWindowLevel
std::vector< vtkProp3D * > PlanesActors
virtual void SetLinkPosition(unsigned int v)
Description: link position flag.
virtual void ResetCamera(void)
Reset the camera in a nice way for the 2D view.
unsigned int LinkColorWindowLevel
virtual void SetShowAxes(unsigned int v)
Description: show axes (view intersections) flag.
virtual void SyncStart(void)
Description: Synchronize interactor start between views.
virtual void SetLinkColorWindowLevel(unsigned int v)
Description: link color window flag.
virtual void SetLinkCamera(unsigned int v)
Description: link camera flag.
void SetDefaultInteractionStyle(void)
Set interaction style to Default mode: Left button: Window level Right button: Zoom Middle button: Pa...
void SetPanInteractionStyle(void)
Set interaction style to Pan mode: All buttons: Pan.
virtual void SyncReset(void)
Description: Synchronize reset between views.
virtual void SyncResetCamera(void)
Description: Synchronize reset camera between views.
virtual void ResetWindowLevel(void)
Reset the window level.
virtual void SyncRender()
Description: Synchronize render between views.
virtual vtkActor * AddDataSet(vtkPolyData *polydata, vtkProperty *property=NULL, const bool &intersection=true, const bool &iDataVisibility=false)
Add a dataset to the view (has to be subclass of vtkPointSet). The dataset will be cut through the im...
void EnableContourPickingMode()
Change Interaction mode of the collection to ContourPickingMode()
void SynchronizeViews(bool iSynchronize)
Synchronize the 2d views.
void SetZoomInteractionStyle(void)
Set interaction style to Zoom mode: All buttons: Zoom.
void SetSplinePlaneActorsVisibility(bool iVisibility)
Set the visibility of the plane actor.
unsigned int LinkSliceMove
void InitializeAllObservers()
Manage a collection of 2D views.
virtual void SetBackground(double rgb[3])
Set the background color. Format is RGB, 0 <= R,G,B <=1 Example: SetBackground(0.9,0.9,0.9) for grey-white.
void SyncSetZoomAndParallelScale(double Zoom, double ParallelScale)
vtkStandardNewMacro(vtkViewImage2DCollection)
std::vector< vtkProp3D * > GetPlanesActors()
Get the plane actors.
void EnableDefaultInteractionMode()
Change Interaction mode of the collection to DefaultMode()
vtkCxxRevisionMacro(vtkViewImage2DCollection,"$Revision: 490 $")
virtual void Reset(void)
Reset position - zoom - window/level to default.
~vtkViewImage2DCollection()
vtkViewImage2D * GetNextItem()
void SyncSetBackground(double *rgb)
void SetCollection(vtkViewImage2DCollection *p)
Set the current collection.
virtual void SetLinkSliceMove(unsigned int v)
Description: link slice flag.
virtual void SetLinkResetWindowLevel(unsigned int v)
Description: link reset color window flag.
virtual void Render(void)
void EnableZoomInteractionMode()
Change Interaction mode of the collection to ZoomMode()
vtkRenderWindow * ExtraRenderWindow
void SetPickInteractionStyle(void)
Set interaction style to Zoom mode: The actor the mouse is highlighted in addition to the Default Mod...
virtual vtkRenderWindowInteractor * GetInteractor()
void SynchronizeViews(bool iSynchronizeViews)
Synchronize the 2d views.
void EnablePanInteractionMode()
Change Interaction mode of the collection to ZoomMode()
unsigned int LinkRequestedPosition
void ReplaceItem(int i, vtkViewImage2D *)
vtkViewImage2D * GetItem(int i)
unsigned int LinkResetViewer
void AddItem(vtkViewImage2D *)
vtkViewImage2DCollectionCommand * Command
static vtkViewImage2DCollectionCommand * New()
Convenient method to access the constructor.
virtual void SetLinkResetViewer(unsigned int v)
Description: link reset viewer flag.
void SyncUpdateWindowLevel(void)
vtkViewImage2DCollection()
Basic class to handle 2D/3D items such as images and polydatas visualization in 2D.
unsigned int LinkPosition