Commit 012c45da authored by David Gobbi's avatar David Gobbi
Browse files

BUG 13001: Fix backwards compatibility of GetSliceNumberMin/Max().

In VTK 5.10 the vtkImageActor was reimplemented with vtkImageSliceMapper.
As an unwanted side-effect, the use of SetDisplayExtent caused the
GetSliceNumberMin/Max methods to always return the current slice.
This patch fixes the problem and restores backwards compatibility.

Change-Id: If01bfd47cd7bfa3d8ff98a7c8b979f628f23ec23
parent 12f985b0
......@@ -111,17 +111,23 @@ int vtkImageSliceMapper::ProcessRequest(
// compute display extent
if(request->Has(vtkStreamingDemandDrivenPipeline::REQUEST_INFORMATION()))
{
int wholeExtent[6];
int *extent = this->DataWholeExtent;
double *spacing = this->DataSpacing;
double *origin = this->DataOrigin;
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
inInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), extent);
inInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), wholeExtent);
inInfo->Get(vtkDataObject::SPACING(), spacing);
inInfo->Get(vtkDataObject::ORIGIN(), origin);
vtkMatrix4x4 *matrix = this->GetDataToWorldMatrix();
for (int k = 0; k < 6; k++)
{
extent[k] = wholeExtent[k];
}
if (this->Cropping)
{
for (int i = 0; i < 3; i++)
......@@ -160,16 +166,16 @@ int vtkImageSliceMapper::ProcessRequest(
int orientation = this->Orientation % 3;
this->SliceNumberMinValue = extent[2*orientation];
this->SliceNumberMaxValue = extent[2*orientation + 1];
this->SliceNumberMinValue = wholeExtent[2*orientation];
this->SliceNumberMaxValue = wholeExtent[2*orientation + 1];
if (this->SliceNumber < this->SliceNumberMinValue)
if (this->SliceNumber < extent[2*orientation])
{
this->SliceNumber = this->SliceNumberMinValue;
this->SliceNumber = extent[2*orientation];
}
if (this->SliceNumber > this->SliceNumberMaxValue)
if (this->SliceNumber > extent[2*orientation + 1])
{
this->SliceNumber = this->SliceNumberMaxValue;
this->SliceNumber = extent[2*orientation + 1];
}
extent[2*orientation] = this->SliceNumber;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment