mMainWidget = this;
mCurrentTime = -1;
mCurrentSelectedImageId = "";
+ mCurrentPickedImageId = "";
+ mCurrentPickedImageIndex = 0;
//Init the contextMenu
this->setContextMenuPolicy(Qt::CustomContextMenu);
//timerMemory->setInterval(5);
connect(timerMemory, SIGNAL(timeout()), this, SLOT(UpdateMemoryUsage()));
timerMemory->start(2000);
+
}
//------------------------------------------------------------------------------
connect(mSlicerManagers.back(), SIGNAL(currentImageChanged(std::string)),
this,SLOT(CurrentImageChanged(std::string)));
+ connect(mSlicerManagers.back(), SIGNAL(currentPickedImageChanged(std::string)),
+ this, SLOT(CurrentPickedImageChanged(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)),
}
//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+void vvMainWindow::CurrentPickedImageChanged(std::string id)
+{
+ if (id == mCurrentPickedImageId) return; // Do nothing
+ int selected = 0;
+ for (int i = 0; i < DataTree->topLevelItemCount(); i++) {
+ if (DataTree->topLevelItem(i)->data(COLUMN_IMAGE_NAME,Qt::UserRole).toString().toStdString() == id) {
+ selected = i;
+ } else {
+ DataTree->topLevelItem(i)->setSelected(0);
+ }
+ for (int child = 0; child < DataTree->topLevelItem(i)->childCount(); child++)
+ DataTree->topLevelItem(i)->child(child)->setSelected(0);
+
+ }
+ DataTree->topLevelItem(selected)->setSelected(1);
+ mCurrentPickedImageId = id;
+ mCurrentPickedImageIndex = selected;
+}
+//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::ImageInfoChanged()
{
inputSizeInBytes = GetSizeInBytes(imageSelected->GetActualMemorySize()*1000);
}
- transformation = imageSelected->GetTransform()->GetMatrix();
-
QString dim = QString::number(dimension) + " (";
dim += pixelType + ")";
infoPanel->setOrigin(GetVectorDoubleAsString(origin));
infoPanel->setSpacing(GetVectorDoubleAsString(inputSpacing));
infoPanel->setNPixel(QString::number(NPixel)+" ("+inputSizeInBytes+")");
+ transformation = imageSelected->GetTransform()->GetMatrix();
infoPanel->setTransformation(Get4x4MatrixDoubleAsString(transformation));
landmarksPanel->SetCurrentLandmarks(mSlicerManagers[index]->GetLandmarks(),
//------------------------------------------------------------------------------
void vvMainWindow::AddLink(QString image1,QString image2)
{
+ unsigned int sm1 = 0;
+ unsigned int sm2 = 0;
+
for (unsigned int i = 0; i < mSlicerManagers.size(); i++) {
if (image1.toStdString() == mSlicerManagers[i]->GetId()) {
mSlicerManagers[i]->AddLink(image2.toStdString());
+ sm1 = i;
}
if (image2.toStdString() == mSlicerManagers[i]->GetId()) {
mSlicerManagers[i]->AddLink(image1.toStdString());
+ sm2 = i;
}
}
+
+ if (linkPanel->isLinkAll()) {
+ emit UpdateLinkedNavigation(mSlicerManagers[sm1]->GetId(), mSlicerManagers[mCurrentPickedImageIndex]);
+ emit UpdateLinkedNavigation(mSlicerManagers[sm2]->GetId(), mSlicerManagers[mCurrentPickedImageIndex]);
+ }
+ else {
+ emit UpdateLinkedNavigation(mSlicerManagers[sm2]->GetId(), mSlicerManagers[sm1]);
+ }
}
+
//------------------------------------------------------------------------------
connect(mSlicerManagers.back(), SIGNAL(currentImageChanged(std::string)),
this, SLOT(CurrentImageChanged(std::string)));
+ connect(mSlicerManagers.back(), SIGNAL(currentPickedImageChanged(std::string)),
+ this, SLOT(CurrentPickedImageChanged(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)),
}
if (event == vtkCommand::EndInteractionEvent) {
+ this->SM->Picked();
this->SM->UpdateLinkedNavigation(this->SM->GetSlicer(VisibleInWindow),true);
return;
}
this->SM->GetSlicer(VisibleInWindow)->GetAnnotation()->SetVisibility(1);
if (event == vtkCommand::MouseWheelForwardEvent && !isi->GetInteractor()->GetControlKey()) {
+ this->SM->Picked();
this->SM->GetSlicer(VisibleInWindow)->SetSlice(this->SM->GetSlicer(VisibleInWindow)->GetSlice()+1);
this->SM->UpdateSlice(VisibleInWindow);
} else if (event == vtkCommand::MouseWheelForwardEvent && isi->GetInteractor()->GetControlKey()) {
this->Dolly(pow((double)1.1, factor),isi->GetInteractor());
Execute(caller, vtkCommand::EndInteractionEvent, NULL);
} else if (event == vtkCommand::MouseWheelBackwardEvent && !isi->GetInteractor()->GetControlKey()) {
+ this->SM->Picked();
this->SM->GetSlicer(VisibleInWindow)->SetSlice(this->SM->GetSlicer(VisibleInWindow)->GetSlice()-1);
this->SM->UpdateSlice(VisibleInWindow);
} else if (event == vtkCommand::MouseWheelBackwardEvent && isi->GetInteractor()->GetControlKey()) {
this->SM->Render();
}
if (event == vtkCommand::PickEvent || event == vtkCommand::StartPickEvent) {
+ this->SM->Picked();
this->SM->UpdateViews(1,VisibleInWindow);
this->SM->UpdateLinked(VisibleInWindow);
this->SM->UpdateInfoOnCursorPosition(VisibleInWindow);