<div dir="ltr"><div>Thank you for your interest.<br><br>I'll try to explain it as clear as I can...<br>The major goal is to generate an image which any of its pixel is the sum of other images corresponding pixels. <br>
For example: any pixel of the new image should be the sum of the corresponding pixels from the other images (im1(pix) = im2(pix)+im3(pix)). <br>Note that because I don't know in advance the number of the input images, I created a STL container to store the iterators of the images. I chose this way in because later I can increment all the iterators in one loop (until the end of the container) ...<br>
<br>So, back to my code:<br><br>vector of iterators:<br>| it_1 | it_2 | ... | it_n |<br><br>// iterators for the n input images <br>constIteratorType it_1 (img_1, img_1->GetRequestedRegion()); <br>constIteratorType it_2 (img_2, img_2->GetRequestedRegion()); <br>
...<br>constIteratorType it_n (img_n, img_n->GetRequestedRegion()); <br><br>//iterator of the output image<br>
iteratorType
output_it (output_img, output_img->
GetRequestedRegion());<br><br>//container to store the iterators<br>
std::list<constIteratorType> list;<br>std::list<constIteratorType>::iterator it;<br><br>// iterator of the list that suppose to initialize all of the iterators (it_1, it_2, etc)<br></div> for(it =
list.begin(); it < list.end(); it++)<br>
{<br>
it->GoToBegin();<br> }<br><br>//move in parallel with all of the input images and set in the output image the sum of the corresponding images pixel<br>
for(output_it.GoToBegin(); !output_it.IsAtEnd();
++output_it)<br>
{<br> output_val = 0;<br> for (it = list.begin(); it <
list.end(); it++) //move on each image in the list and get it's pixel value <br>
{<br>
output_val = it->Get() + output_val; //get values from each image and
insert in the output
image<br> //
How do I forward the image's iterator from here
?????<br>
}<br>
output_it.Set(output_val);<br> }<br><br>Hope that now it's clearer ...<br><br>Hila<br><br><br><br><div class="gmail_quote">On Mon, Apr 23, 2012 at 4:51 PM, alex Dowson <span dir="ltr"><<a href="mailto:alexdowson@hotmail.com" target="_blank">alexdowson@hotmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div dir="ltr">
<div style="font-size:12pt;font-family:'Calibri'">
<div>Hi</div>
<div> </div>
<div>I think I still did not understand your problem completely . Why you
want to store image in container ? Can you describe what exactly you
trying to do ?</div>
<div> </div>
<div> </div>
<div>Alex</div>
<div> </div>
<div style="font-size:small;font-style:normal;text-decoration:none;font-family:'Calibri';display:inline;font-weight:normal">
<div style="FONT:10pt tahoma">
<div> </div>
<div style="BACKGROUND:#f5f5f5">
<div><b>From:</b> <a title="hilahiler@gmail.com" href="mailto:hilahiler@gmail.com" target="_blank">Hila Hiler</a> </div>
<div><b>Sent:</b> Monday, April 23, 2012 7:15 PM</div>
<div><b>To:</b> <a title="alexdowson@hotmail.com" href="mailto:alexdowson@hotmail.com" target="_blank">alex Dowson</a> </div>
<div><b>Cc:</b> <a title="insight-users@itk.org" href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a> </div>
<div><b>Subject:</b> Re: [Insight-users] container for iterators of
images</div></div></div>
<div> </div></div><div><div class="h5">
<div style="font-size:small;font-style:normal;text-decoration:none;font-family:'Calibri';display:inline;font-weight:normal">
<div dir="ltr">
<div class="gmail_extra">Hi Alex,<br>first of all, many thanks for the
response.<br><br>I'm afraid that you haven't noticed that I did the same as
described in your link (it was the easy part) ...<br>Actually my question was
about a vector of iterators to itk images.<br>Please, read my attached code.
I'll be pleased to understand what have I
missed.<br><br>Regards,<br>Hila<br><br><br>
<div class="gmail_quote">On Mon, Apr 23, 2012 at 4:08 PM, alex Dowson <span dir="ltr"><<a href="mailto:alexdowson@hotmail.com" target="_blank">alexdowson@hotmail.com</a>></span> wrote:<br>
<blockquote style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
<div dir="ltr">
<div dir="ltr">
<div style="FONT-FAMILY:'Calibri';FONT-SIZE:12pt">
<div>Hi</div>
<div> </div>
<div>Look at this examples</div>
<div> </div>
<div> </div>
<div><a href="http://www.itk.org/Wiki/ITK/Examples/Iterators/ImageRegionConstIterator" target="_blank"><font face="Times New Roman">http://www.itk.org/Wiki/ITK/Examples/Iterators/ImageRegionConstIterator</font></a><font face="Times New Roman"> </font></div>
<div><a href="http://www.itk.org/Wiki/ITK/Examples/Iterators/ImageRegionIterator" target="_blank"><font face="Times New Roman">http://www.itk.org/Wiki/ITK/Examples/Iterators/ImageRegionIterator</font></a><font face="Times New Roman"> </font></div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div style="FONT-STYLE:normal;DISPLAY:inline;FONT-FAMILY:'Calibri';FONT-SIZE:small;FONT-WEIGHT:normal;TEXT-DECORATION:none">
<div style="FONT:10pt tahoma">
<div> </div>
<div style="BACKGROUND:#f5f5f5">
<div><b>From:</b> <a title="hilahiler@gmail.com" href="mailto:hilahiler@gmail.com" target="_blank">Hila Hiler</a> </div>
<div><b>Sent:</b> Monday, April 23, 2012 5:57 PM</div>
<div><b>To:</b> <a title="insight-users@itk.org" href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a>
</div>
<div><b>Subject:</b> [Insight-users] container for iterators of
images</div></div></div>
<div> </div></div>
<div style="FONT-STYLE:normal;DISPLAY:inline;FONT-FAMILY:'Calibri';FONT-SIZE:small;FONT-WEIGHT:normal;TEXT-DECORATION:none">
<div>
<div>
<div dir="ltr">Hi All,<br><br>I'd like to generate a new image by summarizing
some other images in the same dimensions.<br>So I generated a new image and a
std::list for the images iterators. (actually, I thought that this dynamic
container is the best way to mange an unknown number of images)<br><br>For
now, it isn't working because I don't know how to forward the image's iterator
from that vector. in other words, how do I do the same as: output_it++ from a
vector?<br><br>Here is my code:<br><br> typedef
itk::ImageRegionIterator
<ImageType>
iteratorType;<br> typedef
itk::ImageRegionConstIterator
<ImageType>
constIteratorType;<br><br>
constIteratorType first_it (first_img,
first_img->GetRequestedRegion()); <br>
iteratorType
output_it (output_img, output_img->
GetRequestedRegion());<br><br>
std::list<constIteratorType> list;<br>
std::list<constIteratorType>::iterator it;<br><br>
list.push_back(first_it);<br><br> if
(second_img.IsNotNull())<br>
{<br> constIteratorType second_it
(second_img, second_img->GetRequestedRegion());
<br> list.push_back
(second_it);<br> }<br><br> //initialize
all the iterators at the begin of input images<br> for(it =
list.begin(); it < list.end(); it++)<br>
{<br>
it->GoToBegin();<br> }<br><br>
for(output_it.GoToBegin(); !output_it.IsAtEnd();
++output_it)<br>
{<br> for(it = list.begin(); it <
list.end(); it++)//move on the images and get at each iteration the pixel
value and insert to the new
image<br>
{<br>
output_val = it->Get() + output_val; //get values from each image and
insert in the output
image<br> //
How do I forward the image's iterator from here
?????<br>
}<br>
<br>
output_it.Set(output_val);<br><br> }<br><br><br><br>Any
thoughts would be very welcome ...<br>Hila<br></div></div></div>
<hr>
_____________________________________<br>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br><br>Visit
other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware
offers ITK Training Courses, for more information visit:<br><a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br><br>Please
keep messages on-topic and check the ITK FAQ at:<br><a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br><br>Follow this link to
subscribe/unsubscribe:<br><a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br></div></div></div></div></blockquote></div>
<div> </div></div></div></div></div></div></div></div></div>
</blockquote></div><br></div>