Skip to content
Snippets Groups Projects
Commit 7d9a5bc0 authored by David Gobbi's avatar David Gobbi
Browse files

Merge branch 'image-style-winlev-fix-rel' into dgobbi-rollup-rel

Change-Id: I870ddbb823afdfbd37ae8ada7ff08d26587d7bef
parents da9478dc 7f08be80
Branches
Tags
No related merge requests found
......@@ -89,6 +89,10 @@ void vtkInteractorStyleImage::StartWindowLevel()
return;
}
this->StartState(VTKIS_WINDOW_LEVEL);
// Get the last (the topmost) image
this->SetCurrentImageToNthImage(-1);
if (this->HandleObservers &&
this->HasObserver(vtkCommand::StartWindowLevelEvent))
{
......@@ -96,9 +100,6 @@ void vtkInteractorStyleImage::StartWindowLevel()
}
else
{
// Get the last (the topmost) image
this->SetCurrentImageToNthImage(-1);
if (this->CurrentImageProperty)
{
vtkImageProperty *property = this->CurrentImageProperty;
......@@ -642,16 +643,25 @@ void vtkInteractorStyleImage::SetCurrentImageToNthImage(int i)
int j = 0;
for (props->InitTraversal(pit); (prop = props->GetNextProp(pit)); )
{
bool foundImageProp = false;
for (prop->InitPathTraversal(); (path = prop->GetNextPath()); )
{
vtkProp *tryProp = path->GetLastNode()->GetViewProp();
if ( (imageProp = vtkImageSlice::SafeDownCast(tryProp)) != 0 )
{
if (j == i) { break; }
if (j == i)
{
foundImageProp = true;
break;
}
imageProp = 0;
j++;
}
}
if (foundImageProp)
{
break;
}
}
if (i < 0)
{
......
......@@ -156,6 +156,14 @@ public:
void SetImageOrientation(const double leftToRight[3],
const double bottomToTop[3]);
// Description:
// Get the current image property, which is set when StartWindowLevel
// is called immediately before StartWindowLevelEvent is generated.
// This is the image property of the topmost vtkImageSlice in the
// renderer or NULL if no image actors are present.
vtkImageProperty *GetCurrentImageProperty() {
return this->CurrentImageProperty; }
protected:
vtkInteractorStyleImage();
~vtkInteractorStyleImage();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment