this,SLOT(UpdateSliceRange(int,int,int,int,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(UpdateLinkedNavigation(std::string,vvSlicerManager*)),
- this,SLOT(UpdateLinkedNavigation(std::string,vvSlicerManager*)));
+ connect(mSlicerManagers.back(), SIGNAL(UpdateLinkedNavigation(std::string,vvSlicerManager*,vvSlicer*)),
+ this,SLOT(UpdateLinkedNavigation(std::string,vvSlicerManager*,vvSlicer*)));
connect(mSlicerManagers.back(), SIGNAL(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)),
this,SLOT(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)));
connect(mSlicerManagers.back(),SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-void vvMainWindow::UpdateLinkedNavigation(std::string id, vvSlicerManager * sm)
+void vvMainWindow::UpdateLinkedNavigation(std::string id, vvSlicerManager * sm, vvSlicer* refSlicer)
{
for (unsigned int i = 0; i < mSlicerManagers.size(); i++) {
if (id == mSlicerManagers[i]->GetId()) {
- mSlicerManagers[i]->UpdateLinkedNavigation(sm->GetSlicer(0));
+ mSlicerManagers[i]->UpdateLinkedNavigation(refSlicer);
}
}
}
}
if (linkPanel->isLinkAll()) {
- emit UpdateLinkedNavigation(mSlicerManagers[sm1]->GetId(), mSlicerManagers[mCurrentPickedImageIndex]);
- emit UpdateLinkedNavigation(mSlicerManagers[sm2]->GetId(), mSlicerManagers[mCurrentPickedImageIndex]);
+ emit UpdateLinkedNavigation(mSlicerManagers[sm1]->GetId(), mSlicerManagers[mCurrentPickedImageIndex], mSlicerManagers[mCurrentPickedImageIndex]->GetSlicer(0));
+ emit UpdateLinkedNavigation(mSlicerManagers[sm2]->GetId(), mSlicerManagers[mCurrentPickedImageIndex], mSlicerManagers[mCurrentPickedImageIndex]->GetSlicer(0));
}
else {
- emit UpdateLinkedNavigation(mSlicerManagers[sm2]->GetId(), mSlicerManagers[sm1]);
+ emit UpdateLinkedNavigation(mSlicerManagers[sm2]->GetId(), mSlicerManagers[sm1], mSlicerManagers[sm1]->GetSlicer(0));
}
}
this,SLOT(UpdateSliceRange(int,int,int,int,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(UpdateLinkedNavigation(std::string,vvSlicerManager*)),
- this,SLOT(UpdateLinkedNavigation(std::string,vvSlicerManager*)));
+ connect(mSlicerManagers.back(), SIGNAL(UpdateLinkedNavigation(std::string,vvSlicerManager*,vvSlicer*)),
+ this,SLOT(UpdateLinkedNavigation(std::string,vvSlicerManager*,vvSlicer*)));
connect(mSlicerManagers.back(), SIGNAL(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)),
this,SLOT(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)));
connect(mSlicerManagers.back(), SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
class vtkRenderer;
class vtkMatrix4x4;
class vvDicomSeriesSelector;
+class vvSlicer;
//------------------------------------------------------------------------------
class vvMainWindow: public vvMainWindowBase,
void SwitchWindowLevel();
void ApplyWindowLevelToAllImages();
void UpdateLinkManager(std::string id, int slicer, double x, double y, double z, int temps);
- void UpdateLinkedNavigation(std::string id, vvSlicerManager *sm);
+ void UpdateLinkedNavigation(std::string id, vvSlicerManager *sm, vvSlicer* refSlicer);
void AddLink(QString image1,QString image2);
void RemoveLink(QString image1,QString image2);
void ChangeImageWithIndexOffset(vvSlicerManager *sm, int slicer, int offset);
double X = (mCurrent[0] - this->GetInput()->GetOrigin()[0])/this->GetInput()->GetSpacing()[0];
double Y = (mCurrent[1] - this->GetInput()->GetOrigin()[1])/this->GetInput()->GetSpacing()[1];
double Z = (mCurrent[2] - this->GetInput()->GetOrigin()[2])/this->GetInput()->GetSpacing()[2];
+
+// if (X < this->GetInput()->GetWholeExtent()[0]) X = this->GetInput()->GetWholeExtent()[0];
+// else if (X > this->GetInput()->GetWholeExtent()[1]) X = this->GetInput()->GetWholeExtent()[1];
+// if (Y < this->GetInput()->GetWholeExtent()[2]) Y = this->GetInput()->GetWholeExtent()[2];
+// else if (Y > this->GetInput()->GetWholeExtent()[3]) Y = this->GetInput()->GetWholeExtent()[3];
+// if (Z < this->GetInput()->GetWholeExtent()[4]) Z = this->GetInput()->GetWholeExtent()[4];
+// else if (Z > this->GetInput()->GetWholeExtent()[5]) Z = this->GetInput()->GetWholeExtent()[5];
+
if (X >= this->GetInput()->GetWholeExtent()[0] &&
X <= this->GetInput()->GetWholeExtent()[1] &&
Y >= this->GetInput()->GetWholeExtent()[2] &&
Y <= this->GetInput()->GetWholeExtent()[3] &&
Z >= this->GetInput()->GetWholeExtent()[4] &&
Z <= this->GetInput()->GetWholeExtent()[5]) {
+
+
int ix, iy, iz;
double value = this->GetScalarComponentAsDouble(this->GetInput(), X, Y, Z, ix, iy, iz);
this->UpdateDisplayExtent();
// Seems to work without this line
- // this->Render();
+ //this->Render();
}
//----------------------------------------------------------------------------
switch (mSlicers[slicer]->GetSliceOrientation()) {
case vtkImageViewer2::SLICE_ORIENTATION_XY:
- if (mSlicers[slicer]->GetSlice() == (int)floor(z))
- mSlicers[slicer]->Render();
- else
+ if (mSlicers[slicer]->GetSlice() != (int)floor(z))
mSlicers[slicer]->SetSlice((int)floor(z));
break;
case vtkImageViewer2::SLICE_ORIENTATION_XZ:
- if (mSlicers[slicer]->GetSlice() == (int)floor(y))
- mSlicers[slicer]->Render();
- else
+ if (mSlicers[slicer]->GetSlice() != (int)floor(y))
mSlicers[slicer]->SetSlice((int)floor(y));
break;
case vtkImageViewer2::SLICE_ORIENTATION_YZ:
- if (mSlicers[slicer]->GetSlice() == (int)floor(x))
- mSlicers[slicer]->Render();
- else
+ if (mSlicers[slicer]->GetSlice() != (int)floor(x))
mSlicers[slicer]->SetSlice((int)floor(x));
break;
}
+ mSlicers[slicer]->Render();
for ( unsigned int i = 0; i < mSlicers.size(); i++) {
if (i != (unsigned int)slicer && mSlicers[i]->GetImageActor()->GetVisibility()
}
switch (mSlicers[i]->GetSliceOrientation()) {
case vtkImageViewer2::SLICE_ORIENTATION_XY:
- if (mSlicers[i]->GetSlice() == (int)floor(z))
- mSlicers[i]->Render();
- else
+ if (mSlicers[i]->GetSlice() != (int)floor(z))
mSlicers[i]->SetSlice((int)floor(z));
break;
case vtkImageViewer2::SLICE_ORIENTATION_XZ:
- if (mSlicers[i]->GetSlice() == (int)floor(y))
- mSlicers[i]->Render();
- else
+ if (mSlicers[i]->GetSlice() != (int)floor(y))
mSlicers[i]->SetSlice((int)floor(y));
break;
case vtkImageViewer2::SLICE_ORIENTATION_YZ:
- if (mSlicers[i]->GetSlice() == (int)floor(x))
- mSlicers[i]->Render();
- else
+ if (mSlicers[i]->GetSlice() != (int)floor(x))
mSlicers[i]->SetSlice((int)floor(x));
break;
}
+
+ mSlicers[i]->Render();
+
UpdateSlice(i);
UpdateTSlice(i);
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
-void vvSlicerManager::UpdateLinkedNavigation(vvSlicer *slicer, bool bPropagate)
+void vvSlicerManager::UpdateLinkedNavigation(vvSlicer *refSlicer, bool bPropagate)
{
+ vtkCamera *refCam = refSlicer->GetRenderer()->GetActiveCamera();
+ double refPosition[3], refFocal[3];
+ refCam->GetPosition(refPosition);
+ refCam->GetFocalPoint(refFocal);
+
for ( unsigned int i = 0; i < mSlicers.size(); i++) {
- vtkCamera *camera = mSlicers[i] ->GetRenderer()->GetActiveCamera();
- vtkCamera *refCam = slicer->GetRenderer()->GetActiveCamera();
+ vtkCamera *camera = mSlicers[i]->GetRenderer()->GetActiveCamera();
camera->SetParallelScale(refCam->GetParallelScale());
double position[3], focal[3];
camera->GetPosition(position);
camera->GetFocalPoint(focal);
- double refPosition[3], refFocal[3];
- refCam->GetPosition(refPosition);
- refCam->GetFocalPoint(refFocal);
-
- if(slicer->GetSliceOrientation()==mSlicers[i]->GetSliceOrientation()) {
+ if(refSlicer->GetSliceOrientation()==mSlicers[i]->GetSliceOrientation()) {
for(int i=0; i<3; i++) {
position[i] = refPosition[i];
focal[i] = refFocal[i];
}
}
- if(slicer->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XY) {
+ if(refSlicer->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XY) {
if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XZ) {
position[0] = refPosition[0];
focal[0] = refFocal[0];
}
}
- if(slicer->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XZ) {
+ if(refSlicer->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XZ) {
if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_YZ) {
position[2] = refPosition[2];
focal[2] = refFocal[2];
}
}
- if(slicer->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_YZ) {
+ if(refSlicer->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_YZ) {
if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XY) {
position[1] = refPosition[1];
focal[1] = refFocal[1];
Render();
if(bPropagate)
for (std::list<std::string>::const_iterator i = mLinkedId.begin(); i != mLinkedId.end(); i++)
- emit UpdateLinkedNavigation(*i, this);
+ emit UpdateLinkedNavigation(*i, this, refSlicer);
}
//----------------------------------------------------------------------------
void RemoveLink(std::string oldId) {
mLinkedId.remove(oldId);
}
+
+ bool IsLinked() {
+ return mLinkedId.size() > 0;
+ }
///Remove the actor defined by its type and index (example: 3rd contour)
void RemoveActor(const std::string& actor_type, int overlay_index);
void UpdateSliceRange(int slice, int min, int max, int tmin, int tmax);
void WindowLevelChanged(double window, double level, int preset, int colormap);
void UpdateLinkManager(std::string, int slicer, double x, double y, double z, int temps);
- void UpdateLinkedNavigation(std::string, vvSlicerManager*);
+ void UpdateLinkedNavigation(std::string, vvSlicerManager*, vvSlicer*);
void LandmarkAdded();
void ChangeImageWithIndexOffset(vvSlicerManager *sm, int slicer, int offset);
void LeftButtonReleaseSignal(int slicer);
if (event == vtkCommand::StartPickEvent && VisibleInWindow == -1) {
for (int i = 0; i < this->SM->GetNumberOfSlicers(); i++) {
- if (this->SM->GetSlicer(i)->GetCursorVisibility()) {
+ if (this->SM->GetSlicer(i)->GetCursorVisibility() && !this->SM->IsLinked()) {
+ this->SM->GetSlicer(i)->SetCursorVisibility(0);
this->SM->GetSlicer(i)->SetCornerAnnotationVisibility(0);
this->SM->GetSlicer(i)->Render();
}
return;
}
if (KeyPress == "h") {
+ std::cout << "KeyPress == \"h\"\n";
this->SM->SetCursorAndCornerAnnotationVisibility(0);
this->SM->Render();
return;
}
if (event == vtkCommand::EndInteractionEvent) {
- this->SM->Picked();
+ this->SM->Picked();
this->SM->UpdateLinkedNavigation(this->SM->GetSlicer(VisibleInWindow),true);
return;
}
}
if (VisibleInWindow > -1) {
this->SM->Activated();
- //if(!this->SM->GetSlicer(VisibleInWindow)->GetAnnotation()->GetVisibility())
- this->SM->GetSlicer(VisibleInWindow)->GetAnnotation()->SetVisibility(1);
+ this->SM->GetSlicer(VisibleInWindow)->SetCornerAnnotationVisibility(1);
if (event == vtkCommand::MouseWheelForwardEvent && !isi->GetInteractor()->GetControlKey()) {
- this->SM->Picked();
+ 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->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->Picked();
this->SM->UpdateViews(1,VisibleInWindow);
this->SM->UpdateLinked(VisibleInWindow);
this->SM->UpdateInfoOnCursorPosition(VisibleInWindow);
}
if (event == vtkCommand::WindowLevelEvent && mStartSlicer > -1) {
- this->SM->GetSlicer(mStartSlicer)->GetAnnotation()->SetVisibility(1);
+ this->SM->GetSlicer(mStartSlicer)->SetCornerAnnotationVisibility(1);
// Adjust the window level here
int *size = isi->GetInteractor()->GetRenderWindow()->GetSize();
double window = this->InitialWindow;