[vtkusers] Bounds computation of vtkImageData
Timothee Evain
tevain at telecom-paristech.fr
Tue Jan 31 06:14:46 EST 2017
Hello everyone,
It may be more a dev issue, but I think there is a small mistake in the ComputeBounds() method of vtkImageData
When computing upper bounds, code read (line 781 of vtkImageData.cxx):
this->Bounds[1] = origin[0] + (extent[1-swapXBounds] * spacing[0]);
this->Bounds[3] = origin[1] + (extent[3-swapYBounds] * spacing[1]);
this->Bounds[5] = origin[2] + (extent[5-swapZBounds] * spacing[2]);
Since the upper extent is meant to be the index of the last inside point, this leads to upper bounds excluding the upper fringe of data in each direction.
So I guess this part should read something like:
this->Bounds[1] = origin[0] + ( (extent[1-swapXBounds] + 1) * spacing[0]);
this->Bounds[3] = origin[1] + ( (extent[3-swapYBounds] + 1) * spacing[1]);
this->Bounds[5] = origin[2] + ( (extent[5-swapZBounds] + 1) * spacing[2]);
Am I mistaken ?
Tim
More information about the vtkusers
mailing list