[Insight-users] Creating ITK image with data from IDL
Saurabh Garg
srbh.garg at gmail.com
Thu Sep 6 12:46:23 EDT 2012
Hi Jose,
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:
http://www.itk.org/Wiki/ITK/Examples/Iterators/ImageRegionIterator
HTH
Saurabh
On Thu, Sep 6, 2012 at 1:27 AM, <jose at apollomit.com> wrote:
> Hello ITK Users,
>
> We are creating an OrientedImage from an array of integers (received from
> IDL) in the following way:
>
> //----------------------------**------------------------------**--------
> ImageType::IndexType pixelIndex;
> int i=0;
> for(ImageType::IndexValueType l = 0; l < params[2]; l++){
> for(ImageType::IndexValueType r = 0; r <
> params[1]; r++)
> {
> for(ImageType::IndexValueType s = 0; s <
> params[0]; s++)
> {
> pixelIndex[0] = s;
> pixelIndex[1] = r;
> pixelIndex[2] = l;
>
> image->SetPixel(pixelIndex,**
> input[i]);
> i++;
> }
> }
> }
> //----------------------------**---------------------
>
>
>
> I was wondering if I could create this image without having to traverse
> the entire array (and avoid the O(n3) complexity).
> 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.
> I would greatly appreciate any help.
> thanks
> -Jose
>
> ______________________________**_______
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/**opensource/opensource.html<http://www.kitware.com/opensource/opensource.html>
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/**products/protraining.php<http://www.kitware.com/products/protraining.php>
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_**FAQ <http://www.itk.org/Wiki/ITK_FAQ>
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/**listinfo/insight-users<http://www.itk.org/mailman/listinfo/insight-users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120906/0de1ce7b/attachment.htm>
More information about the Insight-users
mailing list