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 #79573 is a reply to message #79572] Mon, 12 March 2012 12:28 Go to previous messageGo to previous message
rogass is currently offline  rogass
Messages: 200
Registered: April 2008
Senior Member
On 12 Mrz., 18:31, Percy Pugwash <percy.pugw...@gmail.com> 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

Hi,
just have a try with this. Note that your tile size must be an integer
part of the original image.

function cr_tile,im,wx,wy
s = size(im,/dim)
nel = n_elements(im)/(wx*wy)
ind = rebin((lindgen(wx,wy) mod wx) + $
rebin(lindgen(1,wy)*s[0],wx,wy,/sample),wx,wy,nel,/
sample)
ind += rebin(reform((lindgen(s))[0:*:wx,0:*:wy],1,1,nel,/
over),wx,wy,nel)
return,im[temporary(ind)]
end

Cheers

CR
[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:27:16 PDT 2025

Total time taken to generate the page: 0.00429 seconds