You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ImageAdaptor should have its own ComputeOffset, ImageRegionIterator support broken #5870
ImageRegionIterator does not work well with ImageAdaptor. For example, the following for loop appears to hang forever, because the iterator never reaches the end:
for (ImageRegionIterator iterator(adaptor, region); !iterator.IsAtEnd(); ++iterator)
{
iterator.Set(42);
}
I think this should be solved by adding a ComputeOffset member function to itk::ImageAdaptor, which simply calls ComputeOffset on its internal image (not on its base class)!
Looks like this issue has been there for a very, very long time already!
Some historical facts:
ImageAdaptor was introduced by commit ab81321, Luis Ibanez (@luisibanez), Nov 12, 2000. It had both ComputeIndexandComputeOffset, implemented by calling the corresponding member function of the internal image.
Both ComputeIndexandComputeOffset were then removed by commit bea33f4, Jim Miller (@millerjv), Feb 21, 2001. Instead, ImageAdaptor inherited these member functions from its base class, ImageBase, from then.
Luis Ibanez added ComputeIndex back to ImageAdaptor with 9526fc8, Apr 17, 2001, calling the corresponding member function of the internal image instead of depending on its base class, ImageBase. Could it be that he might have intended to add ComputeOffset back to ImageAdaptor as well...? 🤷
The very first version of ImageRegionIterator, commit 0ace998, Jim Miller, Aug 10, 2000 already called m_Image->ComputeOffset( ind ) in its operator++.
Note that for an ImageAdaptor, the offset table of its internal image (adaptor->m_Image->m_OffsetTable) may be different from the offset table of its base class (adaptor->ImageBase::m_OffsetTable). Looks like that caused the unexpected values from adaptor->ComputeIndex(index)
Activity
BUG: Add ImageAdaptor::ComputeOffset, to fix ImageRegionIterator support
BUG: Add ImageAdaptor::ComputeOffset, to fix ImageRegionIterator support
N-Dekker commentedon Mar 6, 2026
Looks like this issue has been there for a very, very long time already!
Some historical facts:
ComputeIndexandComputeOffset, implemented by calling the corresponding member function of the internal image.ComputeIndexandComputeOffsetwere then removed by commit bea33f4, Jim Miller (@millerjv), Feb 21, 2001. Instead, ImageAdaptor inherited these member functions from its base class, ImageBase, from then.ComputeIndexback to ImageAdaptor with 9526fc8, Apr 17, 2001, calling the corresponding member function of the internal image instead of depending on its base class, ImageBase. Could it be that he might have intended to addComputeOffsetback to ImageAdaptor as well...? 🤷m_Image->ComputeOffset( ind )in itsoperator++.N-Dekker commentedon Mar 6, 2026
Note that for an ImageAdaptor, the offset table of its internal image (
adaptor->m_Image->m_OffsetTable) may be different from the offset table of its base class (adaptor->ImageBase::m_OffsetTable). Looks like that caused the unexpected values fromadaptor->ComputeIndex(index)BUG: Add ImageAdaptor::ComputeOffset, to fix ImageRegionIterator support
BUG: Add ImageAdaptor::ComputeOffset, to fix ImageRegionIterator support
BUG: Add ImageAdaptor::ComputeOffset, to fix ImageRegionIterator support
BUG: Add ImageAdaptor::ComputeOffset, to fix ImageRegionIterator support
BUG: Add ImageAdaptor::ComputeOffset, to fix ImageRegionIterator support
BUG: Add ImageAdaptor::ComputeOffset, to fix ImageRegionIterator support
BUG: Add ImageAdaptor::ComputeOffset, to fix ImageRegionIterator support