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

Home » Public Forums » archive » Re: Array Tiling - The IDL Way
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: Array Tiling - The IDL Way [message #79574 is a reply to message #79573] Mon, 12 March 2012 11:54 Go to previous messageGo to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 3/12/12 11:31 AM, Percy Pugwash wrote:
> I have a large array that I'd like to break up into tiles (square tiles of side T). I would like to have those tiles in the form of a stack, such that my array goes from dimensions [Nx*T,Ny*T] to [T,T,Nx*Ny].
>
> Is there any way I can do this using only functions like REFORM and TRANSPOSE and no for-loops? Ideally I'd like to do it in-place too. I've been racking my brain for a nice IDLesque way to do this, but no luck thus far...
>
> P

I think this is what you are trying to do:

IDL> a = indgen(10, 10)
IDL> b = transpose(reform(a, 2, 5, 2, 5), [1, 3, 0, 2])

This will break the image a into 5 tiles of size 2 in each dimension. So
you can do the following, e.g., to retrieve the tile at (4, 4):

IDL> print, reform(b[4, 4, *, *])
88 89
98 99

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL, A Guide to Learning IDL: http://modernidl.idldev.com
Research Mathematician
Tech-X Corporation
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: how to extend a vector from size A to size B, (A<B) without "damage" the data in A
Next Topic: please send your resume

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

Current Time: Wed Oct 08 19:32:29 PDT 2025

Total time taken to generate the page: 0.00400 seconds