comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: IDL calculating elements in arrays plus there offsets
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL calculating elements in arrays plus there offsets [message #70042 is a reply to message #70041] Mon, 08 March 2010 04:26 Go to previous message
jeanh is currently offline  jeanh
Messages: 79
Registered: November 2009
Member
Let's see last point in your message first.
For images, you don't need more than 3 or 4 dimensions.
1) X
2) Y
3) Z - number of images
4) (RGB)

Now, and this may not be the most efficient way but it will allow you to
understand what is going on, you can do something like:

image1Array
image2Array
nbImagesFirstGroup = 10
nbImagesSecondGroup = 5

for img1 = 0, nbImagesFirstGroup -1 do begin
for img2 = 0, nbImagesSecondGroup -1 do begin
result = image1Array[*,*,img1] - image2Array[*,*,img2]
endfor
endfor


here, image1Array has 3 dimensions (x, y, z). By using the subscript
[*,*,img1], you are accessing "each elements of the 1 and 2nd
dimensions, corresponding to img1", img1 being a simple counter.
Of course, in this example, the result will be overwritten in each
iteration so you may want to save it.

This being said, you should first write a more precise question. "offset
the elements by 1 to the right" can mean lots of things... are yo
comparing 2 images, shifting in the X direction? Y? or are you
considering multiple images?

Jean

On 08/03/2010 6:43 AM, Will wrote:
> Hi
>
> sorry I don't think the heading was very clear there.
>
> I have loaded a group of arrays (jpeg files) into a seperate float
> array, and again with another group of files I have done the same
> thing. I am now trying to have the two arrays perform a subtraction
> calculation with one another and what I want to do is have the arrays
> do this with each other until they have did the calculation with every
> element. i.e
>
> it does the first calculation, then offsets the elements by one to the
> right and does the next calculation then repeats this until it has
> done every element in the array.
>
> I was curious as to how to do this successflly I am currently trying
> to use a FOR loop after my Repeat loop failed. I have the maths I need
> here but I don't know how to access the subscripts of my array. I have
> inputted all the files into an array using the FLOAT command. the
> likes of FLTARR just keeps saying that I have more than 8 dimensions
> and hence it won't work.
>
> Any ideas guys?
>
> Thanks
>
> Will
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: OT: Summer of Code 2010 is on!
Next Topic: Dynamic arrays in structs: re-allocation problem

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 22:45:09 PDT 2025

Total time taken to generate the page: 7.11751 seconds