[vtkusers] vtkImageIterator: seg fault fixed !
Mathieu Malaterre
Mathieu.Malaterre at creatis.insa-lyon.fr
Fri May 16 06:10:40 EDT 2003
Ken,
As you seems to be the one who wrote this class, you'll be the one I'll
blame ;)
I had some problems with vtkImageIterator within the past few days. But
after modifying the NextSpan() method everything went ok.
Here is my new NextSpan:
template <class DType>
void vtkImageIterator<DType>::NextSpan()
{
this->Pointer += this->Increments[1]; //+= is faster !
this->SpanEndPointer += this->Increments[1];
if (this->Pointer >= this->SliceEndPointer)
{
this->Pointer += this->ContinuousIncrements[2]; //+= is faster !
this->SpanEndPointer += this->ContinuousIncrements[2]; //important
this->SliceEndPointer += this->Increments[2];
}
}
---
Does this sound right ? You need to update SpanEndPointer each time you
modify Pointer, right ?
In case this is right, could someone explain me why this has never shown
up when used in a 'real' vtk pipeline (ie: used in vtkImageCast for
example ?)
Finally, how does this class handle image of more than one scalar ?
Shouldn't we use:
this->SpanEndPointer =
this->Pointer + this->Increments[0]*(ext[1] - ext[0] +
1)*id->GetNumberOfScalarComponents();
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
---
I hope this time someone from Kitware could put some light on it, thanks.
mathieu
--
Mathieu Malaterre
CREATIS
28 Avenue du Doyen LEPINE
B.P. Lyon-Montchat
69394 Lyon Cedex 03
http://www.creatis.insa-lyon.fr/~malaterre/
More information about the vtkusers
mailing list