The particular case that had caused me problems is this:
typedef itk::Image<Node, 2> ImageType;
itk::ImageRegionConstIterator<ImageType> imageIterator =
itk::ImageRegionConstIterator<ImageType>(image, region);
// make a vector of pointers to particular nodes
std::vector<Node*> nodes;
while(!imageIterator.IsAtEnd())
{
nodes.push_back( &(imageIterator.Get()) );
++imageIterator;
}
With the above, I get "warning: taking address of temporary" (and indeed it works incorrectly). The .Get() method of the iterator return a reference to the data at the pixel, so I thought that would be ok, but I guess I don't fully understand references.
My thought was that if the image was Image<Node*, 2> then .Get() would just return the address of the actual node and everything would be ok. Does that make sense?