<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><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></blockquote></div></div></div></blockquote><div><br></div><div>I think this is what you're looking for:</div><div><br></div><a href="http://www.itk.org/Wiki/ITK/Examples/IO/ImportImageFilter">http://www.itk.org/Wiki/ITK/Examples/IO/ImportImageFilter</a><br clear="all">
<br>(If it is, it would be great if you could add some comments to that example :) ).</div><div class="gmail_quote"><br>David</div>