[Insight-users] Creating ITK image with data from IDL
David Doria
daviddoria at gmail.com
Thu Sep 6 12:51:27 EDT 2012
>
> 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
>>
>
I think this is what you're looking for:
http://www.itk.org/Wiki/ITK/Examples/IO/ImportImageFilter
(If it is, it would be great if you could add some comments to that example
:) ).
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120906/2f8c5e50/attachment.htm>
More information about the Insight-users
mailing list