Hi Jose,<br>
<br>
I am not sure if any such thing exist. Maybe someone else can comment on it. The least you can do is use image
region iterator instead of nested for loops. Here is an example for
your reference:<br>
<br>
<a href="http://www.itk.org/Wiki/ITK/Examples/Iterators/ImageRegionIterator" target="_blank">http://www.itk.org/Wiki/ITK/Examples/Iterators/ImageRegionIterator</a><br>
<br>
HTH<br>
Saurabh<br><br><div class="gmail_quote">On Thu, Sep 6, 2012 at 1:27 AM, <span dir="ltr"><<a href="mailto:jose@apollomit.com" target="_blank">jose@apollomit.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello ITK Users,<br>
<br>
We are creating an OrientedImage from an array of integers (received from IDL) in the following way:<br>
<br>
//----------------------------<u></u>------------------------------<u></u>--------<br>
ImageType::IndexType pixelIndex;<br>
int i=0;<br>
for(ImageType::IndexValueType l = 0; l < params[2]; l++){<br>
for(ImageType::IndexValueType r = 0; r < params[1]; r++)<br>
{<br>
for(ImageType::IndexValueType s = 0; s < params[0]; s++)<br>
{<br>
pixelIndex[0] = s;<br>
pixelIndex[1] = r;<br>
pixelIndex[2] = l;<br>
<br>
image->SetPixel(pixelIndex,<u></u>input[i]);<br>
i++;<br>
}<br>
}<br>
}<br>
//----------------------------<u></u>---------------------<br>
<br>
<br>
<br>
I was wondering if I could create this image without having to traverse the entire array (and avoid the O(n3) complexity).<br>
I have an integer array with the values (input[]), so there should be a way to just make the image point to the array right? i. e. something like: *image = *input ? or I don't know just another way to create an image that I don't have to set pixel by pixel.<br>
I would greatly appreciate any help.<br>
thanks<br>
-Jose<br>
<br>
______________________________<u></u>_______<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/<u></u>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/<u></u>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_<u></u>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/<u></u>listinfo/insight-users</a><br>
</blockquote></div><br>