[Insight-developers] iterator troubles

Damion Shelton dmsst59+@pitt.edu
Thu, 19 Jul 2001 16:57:08 -0400


Hi...

I've been following the iterator discussion and updated my code to account
for the GoToBegin() syntax change. Unfortunately, I've hit a snag relating
to the Get() function of ImageRegionIterator.

In the following examples, note that bpiterator is a blox pixel iterator
(just your basic stl list iterator) of type itk::BloxPixel::iterator. Also,
bloxIt is an ImageRegionIterator which walks an itk::BoundaryPointImage
(inherited from Image).

The following code fragment compiles and executes correctly.

for (bpiterator = bloxIt.Value().begin(); bpiterator !=
bloxIt.Value().end(); ++bpiterator)
{
...use bpiterator
}

As does (bloxindex obtained from bloxIt.GetIndex() ):

for (bpiterator = bloxBoundaryPointImage->GetPixel(bloxindex).begin();
      bpiterator != bloxBoundaryPointImage->GetPixel(bloxindex).end();
      ++bpiterator)
{
...use bpiterator
}

However, the following code block DOES NOT work, and did last week:

for (bpiterator = bloxIt.Get().begin(); bpiterator != bloxIt.Get().end();
++bpiterator)
{
...use bpiterator
}

Any ideas? What differs between, Value(), Get(), and manually accessing the
pixel via the index? This should hopefully clear up the remaining bug in the
example that illustrates how to use spatial functions, bloxels and blolumes,
etc.

Thanks in advance,

-Damion-