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

Home » Public Forums » archive » Re: Convert 3D to 1D, apply fuction then convert back to 3D
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: Convert 3D to 1D, apply fuction then convert back to 3D [message #71433 is a reply to message #71431] Sun, 20 June 2010 18:14 Go to previous messageGo to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jun 20, 9:58 pm, Mat <m...@waikato.ac.nz> wrote:
> No the function used the "imageR" from above which is a floating 1D 5
> element array (reformed from a 5 band 3d image (satellite reflectance)
> and returned a 3-element array(water quality). The function is complex
> and not my code so I'm not in a position to post it sorry. So for each
> pixel in the original tiff I want the water quality (three parameters)
> in an image format. I hope this helps.

imageR as you wrote above is 2D (5,npix), not 1D.

Now I think what you mean is that you have a 5-channel image (a
(5,nx,ny) array), where you want to apply some function that takes
each of the 5 bands for each pixel, and returns 3 values for each,
which you want to put into a 3-channel image (3,nx,ny). If that is the
case, this does not indicate any need for reforming, it could be done
with something like

result=dblarr(3,nx,ny)
for i=0,ny-1 do for j=0,nx-1 do
result[*,j,i]=some_function(image[*,j,i])

> I think it is simpler if somebody posts a code to convert an
> image(5,nx*xy) to 1D, then convert it back to the original image. I
> think I could fill in the gaps.

I do not think you need to do it, but if you want to, it would be

image1d=reform(image2d,5L*nx*ny)

then, to get it back,

image2d=reform(image1d,5,nx,ny)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Selecting data from two separate arrays
Next Topic: Re: MPFIT Chance probability

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

Current Time: Fri Oct 10 14:31:57 PDT 2025

Total time taken to generate the page: 0.88073 seconds