#include "vvSlicerManagerCommand.h"
#include "vvSlicerManager.h"
-#include "vtkTextProperty.h"
-#include "vtkRenderer.h"
-#include "vtkImageActor.h"
-#include "vtkRenderWindowInteractor.h"
-#include "vtkPropPicker.h"
-#include "vtkCamera.h"
-#include "vtkImageMapToWindowLevelColors.h"
-#include "vtkLookupTable.h"
-#include "vtkMath.h"
-#include "vtkAbstractPropPicker.h"
-#include "vtkAssemblyPath.h"
-#include "vtkCornerAnnotation.h"
+#include <vtkTextProperty.h>
+#include <vtkRenderer.h>
+#include <vtkImageActor.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkPropPicker.h>
+#include <vtkCamera.h>
+#include <vtkImageMapToWindowLevelColors.h>
+#include <vtkLookupTable.h>
+#include <vtkMath.h>
+#include <vtkAbstractPropPicker.h>
+#include <vtkAssemblyPath.h>
+#include <vtkCornerAnnotation.h>
#include <vtkRenderWindow.h>
#include "vvSlicer.h"
//------------------------------------------------------------------------------
void vvSlicerManagerCommand::Execute(vtkObject *caller,
- unsigned long event,
- void *vtkNotUsed(callData))
+ unsigned long event,
+ void *vtkNotUsed(callData))
{
//KeyPress event
vvInteractorStyleNavigator *isi =
int VisibleInWindow = this->FindSlicerNumber(isi->GetInteractor()->GetRenderWindow());
vtkRenderer* renderer=NULL;
- if (VisibleInWindow>-1)
+ if (VisibleInWindow>-1)
renderer=this->SM->GetSlicer(VisibleInWindow)->GetRenderer();
newLandmark = false;
if (event == vtkCommand::KeyPressEvent)
{
std::string KeyPress = isi->GetInteractor()->GetKeySym();
+ if (KeyPress == "Tab")
+ {
+ if(isi->GetInteractor()->GetShiftKey())
+ this->SM->PrevImage(VisibleInWindow);
+ else
+ this->SM->NextImage(VisibleInWindow);
+ return;
+ }
if (KeyPress == "f" || KeyPress == "F")
{
FlyToPosition(isi->GetInteractor(),this->SM->GetSlicer(VisibleInWindow));
+ return;
+ }
+ if (KeyPress == "w")
+ {
+ this->SM->SetLocalColorWindowing(VisibleInWindow);
+ return;
}
- if (KeyPress == "z")
- {
- this->SM->SetLocalColorWindowing(VisibleInWindow);
- return;
- }
if (KeyPress == "0")
{
this->SM->SetPreset(0);
this->SM->UpdateWindowLevel();
return;
}
- if (KeyPress == "u")
+ if (KeyPress == "c")
{
this->SM->ToggleContourSuperposition();
this->SM->Render();
return;
}
- if (KeyPress == "i")
+ if (KeyPress == "l")
{
this->SM->ToggleInterpolation();
this->SM->Render();
this->SM->Render();
return;
}
- if (KeyPress == "l")
+ if (KeyPress == "u")
{
this->SM->Reload();
this->SM->Render();
if (KeyPress == "Right")
this->SM->SetNextTSlice(VisibleInWindow);
- if (KeyPress == "F1")
+ if (KeyPress == "F2")
{
this->SM->GetSlicer(VisibleInWindow)->GetAnnotation()->SetText(2,"Sagital\n<slice>");
this->SM->GetSlicer(VisibleInWindow)->SetSliceOrientation(0);
this->SM->UpdateSliceRange(VisibleInWindow);
this->SM->UpdateInfoOnCursorPosition(VisibleInWindow);
}
- if (KeyPress == "F2")
+ if (KeyPress == "F3")
{
this->SM->GetSlicer(VisibleInWindow)->GetAnnotation()->SetText(2,"Coronal\n<slice>");
this->SM->GetSlicer(VisibleInWindow)->SetSliceOrientation(1);
this->SM->UpdateSliceRange(VisibleInWindow);
this->SM->UpdateInfoOnCursorPosition(VisibleInWindow);
}
- if (KeyPress == "F3")
+ if (KeyPress == "F4")
{
this->SM->GetSlicer(VisibleInWindow)->GetAnnotation()->SetText(2,"Axial\n<slice>");
this->SM->GetSlicer(VisibleInWindow)->SetSliceOrientation(2);
return;
}
+ //DD(event);
+ // Mouse release HERE
+ if (event == vtkCommand::EndPickEvent) {
+ // DD(VisibleInWindow);
+ if (VisibleInWindow > -1)
+ this->SM->LeftButtonReleaseEvent(VisibleInWindow);
+ return; // no return !!!! ???
+ }
+
if (event == vtkCommand::StartWindowLevelEvent)
{
mStartSlicer = -1;
if (newLandmark)
{
this->SM->AddLandmark(xWorld,yWorld,zWorld,
- this->SM->GetSlicer(VisibleInWindow)->GetTSlice());
+ this->SM->GetSlicer(VisibleInWindow)->GetTSlice());
this->SM->GetSlicer(VisibleInWindow)->UpdateLandmarks();
this->SM->Render();
}
// Compute normalized delta
double dx = static_cast<double>(isi->GetWindowLevelCurrentPosition()[0] -
- isi->GetWindowLevelStartPosition()[0]) / size[0];
+ isi->GetWindowLevelStartPosition()[0]) / size[0];
double dy = static_cast<double>(isi->GetWindowLevelStartPosition()[1] -
- isi->GetWindowLevelCurrentPosition()[1]) / size[1];
+ isi->GetWindowLevelCurrentPosition()[1]) / size[1];
//Window is exponential in nature, use exponential to avoid falling into negative numbers
dx = std::exp(1.0 * (dx*fabs(dx) + dx)) ; //Quadratic behavior for more reactive interface
dy = 0.15 * (dy*fabs(dy) + dy) * (range[1]-range[0]);//Quadratic behavior for more reactive interface
{
int VisibleInWindow = this->FindSlicerNumber(interactor->GetRenderWindow());
vtkRenderer* renderer;
- if (VisibleInWindow>-1)
+ if (VisibleInWindow>-1)
renderer=this->SM->GetSlicer(VisibleInWindow)->GetRenderer();
else
{
camera->GetFocalPoint(viewFocus);
camera->GetPosition(viewPoint);
camera->SetFocalPoint(motionVector[0] + viewFocus[0],
- motionVector[1] + viewFocus[1],
- motionVector[2] + viewFocus[2]);
+ motionVector[1] + viewFocus[1],
+ motionVector[2] + viewFocus[2]);
camera->SetPosition(motionVector[0] + viewPoint[0],
- motionVector[1] + viewPoint[1],
- motionVector[2] + viewPoint[2]);
+ motionVector[1] + viewPoint[1],
+ motionVector[2] + viewPoint[2]);
if (camera->GetParallelProjection())
{
renderer->ResetCameraClippingRange();
//interactor->Render();
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void vvSlicerManagerCommand::FlyToPosition(vtkRenderWindowInteractor *interactor,vvSlicer* slicer)
{
double flyFrom[3], flyTo[3];
int i, j;
int VisibleInWindow = this->FindSlicerNumber(interactor->GetRenderWindow());
vtkRenderer* renderer=NULL;
- if (VisibleInWindow>-1)
+ if (VisibleInWindow>-1)
renderer=this->SM->GetSlicer(VisibleInWindow)->GetRenderer();
else
return;
interactor->GetPicker()->Pick(interactor->GetEventPosition()[0],
- interactor->GetEventPosition()[1], 0.0,
- renderer);
+ interactor->GetEventPosition()[1], 0.0,
+ renderer);
vtkAssemblyPath *path=NULL;
vtkAbstractPropPicker *picker;
switch (slicer->GetSliceOrientation())
{
- case vtkImageViewer2::SLICE_ORIENTATION_XY:
- flyTo[2] = flyFrom[2];
- break;
+ case vtkImageViewer2::SLICE_ORIENTATION_XY:
+ flyTo[2] = flyFrom[2];
+ break;
- case vtkImageViewer2::SLICE_ORIENTATION_XZ:
- flyTo[1] = flyFrom[1];
- break;
+ case vtkImageViewer2::SLICE_ORIENTATION_XZ:
+ flyTo[1] = flyFrom[1];
+ break;
- case vtkImageViewer2::SLICE_ORIENTATION_YZ:
- flyTo[0] = flyFrom[0];
- break;
+ case vtkImageViewer2::SLICE_ORIENTATION_YZ:
+ flyTo[0] = flyFrom[0];
+ break;
}
}
}
}
+//------------------------------------------------------------------------------