Skip to content

Commit

Permalink
BUG: calculate range of active scalar
Browse files Browse the repository at this point in the history
Getting the scalar range on the poly data was returning an
incorrect tuple. Get the range of the active scalar array instead.

Issue #3672
  • Loading branch information
Nicole Aucoin committed May 16, 2014
1 parent 979d08b commit 068c624
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 6 deletions.
Expand Up @@ -25,6 +25,7 @@ Version: $Revision: 1.3 $
#include <vtkAssignAttribute.h>
#include <vtkCallbackCommand.h>
#include <vtkObjectFactory.h>
#include <vtkPointData.h>
#include <vtkVersion.h>

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -142,7 +143,6 @@ void vtkMRMLFiberBundleGlyphDisplayNode::UpdatePolyDataPipeline()

if (!this->Visibility)
{
std::cout << "no visibility" << std::endl;
return;
}

Expand Down Expand Up @@ -283,7 +283,18 @@ void vtkMRMLFiberBundleGlyphDisplayNode::UpdatePolyDataPipeline()
#else
this->GetOutputPolyDataConnection()->GetProducer()->Update();
#endif
this->GetOutputPolyData()->GetScalarRange(range);
vtkPointData *pointData = this->GetOutputPolyData()->GetPointData();
if (pointData &&
pointData->GetArray(this->GetActiveScalarName()))
{
double *activeScalarRange = pointData->GetArray(
this->GetActiveScalarName())->GetRange();
if (activeScalarRange)
{
range[0] = activeScalarRange[0];
range[1] = activeScalarRange[1];
}
}
}
}

Expand Down
Expand Up @@ -282,7 +282,18 @@ void vtkMRMLFiberBundleLineDisplayNode::UpdatePolyDataPipeline()
#else
this->GetOutputPolyDataConnection()->GetProducer()->Update();
#endif
this->GetOutputPolyData()->GetScalarRange(range);
vtkPointData *pointData = this->GetOutputPolyData()->GetPointData();
if (pointData &&
pointData->GetArray(this->GetActiveScalarName()))
{
double *activeScalarRange = pointData->GetArray(
this->GetActiveScalarName())->GetRange();
if (activeScalarRange)
{
range[0] = activeScalarRange[0];
range[1] = activeScalarRange[1];
}
}
}
}
if ((this->GetColorMode ( ) == vtkMRMLFiberBundleDisplayNode::colorModeMeanFiberOrientation) ||
Expand All @@ -299,7 +310,18 @@ void vtkMRMLFiberBundleLineDisplayNode::UpdatePolyDataPipeline()
#else
this->GetInputPolyDataConnection()->GetProducer()->Update();
#endif
this->GetInputPolyData()->GetScalarRange(range);
vtkPointData *pointData = this->GetOutputPolyData()->GetPointData();
if (pointData &&
pointData->GetArray(this->GetActiveScalarName()))
{
double *activeScalarRange = pointData->GetArray(
this->GetActiveScalarName())->GetRange();
if (activeScalarRange)
{
range[0] = activeScalarRange[0];
range[1] = activeScalarRange[1];
}
}
}
//this->ScalarRange[0] = range[0];
//this->ScalarRange[1] = range[1];
Expand Down
Expand Up @@ -326,7 +326,18 @@ void vtkMRMLFiberBundleTubeDisplayNode::UpdatePolyDataPipeline()
#else
this->GetOutputPolyDataConnection()->GetProducer()->Update();
#endif
this->GetOutputPolyData()->GetScalarRange(range);
vtkPointData *pointData = this->GetOutputPolyData()->GetPointData();
if (pointData &&
pointData->GetArray(this->GetActiveScalarName()))
{
double *activeScalarRange = pointData->GetArray(
this->GetActiveScalarName())->GetRange();
if (activeScalarRange)
{
range[0] = activeScalarRange[0];
range[1] = activeScalarRange[1];
}
}
}
}
else if ((this->GetColorMode ( ) == vtkMRMLFiberBundleDisplayNode::colorModeMeanFiberOrientation) ||
Expand All @@ -343,7 +354,18 @@ void vtkMRMLFiberBundleTubeDisplayNode::UpdatePolyDataPipeline()
#else
this->GetInputPolyDataConnection()->GetProducer()->Update();
#endif
this->GetInputPolyData()->GetScalarRange(range);
vtkPointData *pointData = this->GetOutputPolyData()->GetPointData();
if (pointData &&
pointData->GetArray(this->GetActiveScalarName()))
{
double *activeScalarRange = pointData->GetArray(
this->GetActiveScalarName())->GetRange();
if (activeScalarRange)
{
range[0] = activeScalarRange[0];
range[1] = activeScalarRange[1];
}
}
}
//this->ScalarRange[0] = range[0];
//this->ScalarRange[1] = range[1];
Expand Down

0 comments on commit 068c624

Please sign in to comment.