<div class="gmail_quote">On Mon, Feb 28, 2011 at 9:10 AM, Cory Quammen <span dir="ltr"><<a href="mailto:cquammen@cs.unc.edu">cquammen@cs.unc.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
David,<br>
<br>
The Get() method in the iterator makes a copy of the pixel value and<br>
returns it to the caller. This copy exists in a temporary variable,<br>
and you are taking the address of that copy (not the original), thus<br>
the warning. To my knowledge, there is no way to operate directly on<br>
the pixel value through the Get() method in the iterator.<br>
<br>
This should let you do what you are looking to do.<br>
<br>
PixelType pixel = imageIterator->Get();<br>
// modify pixel value<br>
imageIterator->Set(pixel);<br>
<br>
It's an extra line to set the new pixel value, but this is likely less<br>
error prone than operating on a reference to a pixel value.<br>
<br>
Cory<br></blockquote><div><br></div><div>Thanks for confirming there is no way to do this. Using Set() won't work for me - what I was trying to do was:</div><div><br></div><div>std::vector<PixelType*> pixels;</div>
<div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><div>itk::ImageRegionIterator<ImageType> imageIterator = itk::ImageRegionIterator<ImageType>(image, region);</div>
<div><div> while(!imageIterator.IsAtEnd())</div><div> {</div><div> if(someCondition(pixel))</div><div> pixels.push_back(&pixel);</div><div> }</div></div><div>ChangePixels(pixels);</div></span></div><div>
<br></div><div>How do you think a proposition of adding a GetAddress() function to the iterators would go?</div><meta http-equiv="content-type" content="text/html; charset=utf-8"><br><div>David</div></div>