linkPanel->addImage(imageManager->GetFileName(), id.toStdString());
- connect(mSlicerManagers.back(),SIGNAL(currentImageChanged(std::string)),
+ connect(mSlicerManagers.back(), SIGNAL(currentImageChanged(std::string)),
this,SLOT(CurrentImageChanged(std::string)));
- connect(mSlicerManagers.back(),SIGNAL(
- UpdatePosition(int, double, double, double, double, double, double, double)),this,
- SLOT(MousePositionChanged(int,double, double, double, double, double, double, double)));
- connect(mSlicerManagers.back(),SIGNAL(UpdateVector(int, double, double, double, double)),
+ connect(mSlicerManagers.back(), SIGNAL(UpdatePosition(int, double, double, double, double, double, double, double)),
+ this,SLOT(MousePositionChanged(int,double, double, double, double, double, double, double)));
+ connect(mSlicerManagers.back(), SIGNAL(UpdateVector(int, double, double, double, double)),
this, SLOT(VectorChanged(int,double,double,double, double)));
- connect(mSlicerManagers.back(),SIGNAL(UpdateOverlay(int, double, double)),
+ connect(mSlicerManagers.back(), SIGNAL(UpdateOverlay(int, double, double)),
this, SLOT(OverlayChanged(int,double,double)));
- connect(mSlicerManagers.back(),SIGNAL(UpdateFusion(int, double)),
+ connect(mSlicerManagers.back(), SIGNAL(UpdateFusion(int, double)),
this, SLOT(FusionChanged(int,double)));
- connect(mSlicerManagers.back(),SIGNAL(UpdateWindows(int, int, int)),
+ connect(mSlicerManagers.back(), SIGNAL(UpdateWindows(int, int, int)),
this,SLOT(WindowsChanged(int, int, int)));
- connect(mSlicerManagers.back(),SIGNAL(WindowLevelChanged(double, double,int, int)),
+ connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged(double, double,int, int)),
this,SLOT(WindowLevelChanged(double, double, int, int)));
- connect(mSlicerManagers.back(),SIGNAL(UpdateSlice(int,int)),
+ connect(mSlicerManagers.back(), SIGNAL(UpdateSlice(int,int)),
this,SLOT(UpdateSlice(int,int)));
- connect(mSlicerManagers.back(),SIGNAL(UpdateTSlice(int, int)),
+ connect(mSlicerManagers.back(), SIGNAL(UpdateTSlice(int, int)),
this,SLOT(UpdateTSlice(int, int)));
- connect(mSlicerManagers.back(),SIGNAL(UpdateSliceRange(int,int,int,int,int)),
+ connect(mSlicerManagers.back(), SIGNAL(UpdateSliceRange(int,int,int,int,int)),
this,SLOT(UpdateSliceRange(int,int,int,int,int)));
- connect(mSlicerManagers.back(),SIGNAL(UpdateLinkManager(std::string,int,double,double,double,int)),
+ connect(mSlicerManagers.back(), SIGNAL(UpdateLinkManager(std::string,int,double,double,double,int)),
this,SLOT(UpdateLinkManager(std::string,int,double,double,double,int)));
+ connect(mSlicerManagers.back(), SIGNAL(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)),
+ this,SLOT(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)));
connect(mSlicerManagers.back(),SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
InitSlicers();
numberofsuccesulreads++;
}
//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+QTreeWidgetItem* vvMainWindow::GetItemFromSlicerManager(vvSlicerManager* sm) {
+ QString id = sm->GetId().c_str();
+ for (int i = 0; i < DataTree->topLevelItemCount(); i++)
+ {
+ if (DataTree->topLevelItem(i)->data(COLUMN_IMAGE_NAME,Qt::UserRole).toString() == id)
+ return DataTree->topLevelItem(i);
+ }
+ return NULL;
+}
+//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::DisplayChanged(QTreeWidgetItem *clicked_item, int column) {
int index = GetSlicerIndexFromItem(clicked_item);
return;
for (unsigned int i = 0; i < mSlicerManagers.size(); i++)
{
+ //Trick to avoid redoing twice the job for a key (sr)
+ mSlicerManagers[i]->GetSlicer(column-1)->GetRenderWindow()-> GetInteractor()->SetKeySym("Crap");
+
QTreeWidgetItem* current_row=DataTree->topLevelItem(i);
if (DataTree->topLevelItem(index) == current_row)
{
}
//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+void vvMainWindow::ChangeImageWithIndexOffset(vvSlicerManager *sm, int slicer, int offset)
+{
+ int index = 0;
+ while(sm != mSlicerManagers[index])
+ index++;
+ index = (index+offset) % mSlicerManagers.size();
+
+ QTreeWidgetItem* item = GetItemFromSlicerManager(mSlicerManagers[index]);
+ //CurrentImageChanged(mSlicerManagers[index]->GetId()); //select new image
+ item->setData(slicer+1,Qt::CheckStateRole,2); //change checkbox
+ DisplayChanged(item,slicer+1);
+}
+//------------------------------------------------------------------------------
+
void vvMainWindow::HorizontalSliderMoved(int value,int column, int slicer_index)
{
for (unsigned int i = 0; i < mSlicerManagers.size(); i++)
//------------------------------------------------------------------------------
void vvMainWindow::AddImage(vvImage::Pointer image,std::string filename)
{
- vvSlicerManager* m = new vvSlicerManager(4);
- m->SetImage(image);
- m->SetFilename(filename);
- AddImage(m);
-}
-
-//------------------------------------------------------------------------------
-void vvMainWindow::AddImage(vvSlicerManager * slicer_manager) {
+ vvSlicerManager* slicer_manager = new vvSlicerManager(4);
+ slicer_manager->SetImage(image);
+ slicer_manager->SetFilename(filename);
mSlicerManagers.push_back(slicer_manager);
- std::string filename = slicer_manager->GetFileName();
-
//create an item in the tree with good settings
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setData(0,Qt::UserRole,slicer_manager->GetFileName().c_str());//files[i].c_str());
linkPanel->addImage(filename, id.toStdString());
- connect(mSlicerManagers.back(),SIGNAL(currentImageChanged(std::string)),
- this,SLOT(CurrentImageChanged(std::string)));
- connect(mSlicerManagers.back(),SIGNAL(
- UpdatePosition(int, double, double, double, double, double, double, double)),this,
- SLOT(MousePositionChanged(int,double, double, double, double, double, double, double)));
- connect(mSlicerManagers.back(),SIGNAL(UpdateVector(int, double, double, double, double)),
+ connect(mSlicerManagers.back(), SIGNAL(currentImageChanged(std::string)),
+ this, SLOT(CurrentImageChanged(std::string)));
+ connect(mSlicerManagers.back(), SIGNAL(UpdatePosition(int, double, double, double, double, double, double, double)),
+ this, SLOT(MousePositionChanged(int,double, double, double, double, double, double, double)));
+ connect(mSlicerManagers.back(), SIGNAL(UpdateVector(int, double, double, double, double)),
this, SLOT(VectorChanged(int,double,double,double, double)));
- connect(mSlicerManagers.back(),SIGNAL(UpdateOverlay(int, double, double)),
+ connect(mSlicerManagers.back(), SIGNAL(UpdateOverlay(int, double, double)),
this, SLOT(OverlayChanged(int,double,double)));
- connect(mSlicerManagers.back(),SIGNAL(UpdateFusion(int, double)),
+ connect(mSlicerManagers.back(), SIGNAL(UpdateFusion(int, double)),
this, SLOT(FusionChanged(int,double)));
- connect(mSlicerManagers.back(),SIGNAL(UpdateWindows(int, int, int)),
+ connect(mSlicerManagers.back(), SIGNAL(UpdateWindows(int, int, int)),
this,SLOT(WindowsChanged(int, int, int)));
- connect(mSlicerManagers.back(),SIGNAL(WindowLevelChanged(double, double,int, int)),
+ connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged(double, double,int, int)),
this,SLOT(WindowLevelChanged(double, double, int, int)));
- connect(mSlicerManagers.back(),SIGNAL(UpdateSlice(int,int)),
+ connect(mSlicerManagers.back(), SIGNAL(UpdateSlice(int,int)),
this,SLOT(UpdateSlice(int,int)));
- connect(mSlicerManagers.back(),SIGNAL(UpdateTSlice(int, int)),
+ connect(mSlicerManagers.back(), SIGNAL(UpdateTSlice(int, int)),
this,SLOT(UpdateTSlice(int, int)));
- connect(mSlicerManagers.back(),SIGNAL(UpdateSliceRange(int,int,int,int,int)),
+ connect(mSlicerManagers.back(), SIGNAL(UpdateSliceRange(int,int,int,int,int)),
this,SLOT(UpdateSliceRange(int,int,int,int,int)));
- connect(mSlicerManagers.back(),SIGNAL(UpdateLinkManager(std::string,int,double,double,double,int)),
+ connect(mSlicerManagers.back(), SIGNAL(UpdateLinkManager(std::string,int,double,double,double,int)),
this,SLOT(UpdateLinkManager(std::string,int,double,double,double,int)));
- connect(mSlicerManagers.back(),SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
+ connect(mSlicerManagers.back(), SIGNAL(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)),
+ this,SLOT(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)));
+ connect(mSlicerManagers.back(), SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
UpdateTree();
qApp->processEvents();
InitSlicers();
#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 == "a")
+ {
+ this->SM->PrevImage(VisibleInWindow);
+ return;
+ }
+ if (KeyPress == "q")
+ {
+ this->SM->NextImage(VisibleInWindow);
+ return;
+ }
if (KeyPress == "f" || KeyPress == "F")
{
FlyToPosition(isi->GetInteractor(),this->SM->GetSlicer(VisibleInWindow));
+ return;
}
if (KeyPress == "z")
{
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())
{
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;
}