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

Home » Public Forums » archive » how to manipulate data that are stored in memory directly?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
how to manipulate data that are stored in memory directly? [message #84933] Tue, 18 June 2013 14:01 Go to next message
itscd is currently offline  itscd
Messages: 1
Registered: June 2013
Junior Member
Hey guys, this might be a simple question, but it has been bothering me for a while: how to retrieve the data stored in memory and manipulate them as a simple IDL variable?

For example, the following is a piece of standard IDL code to use the layer stacking function in ENVI:

envi_doit, 'envi_layer_stacking_doit', $
fid=fid, pos=pos, dims=dims, $
out_dt=out_dt, out_name=out_name, $
interp=0, out_ps=out_ps, $
out_proj=out_proj, r_fid=r_fid , /EXCLUSIVE, /IN_MEMORY

Because i specified the keyword "IN_MEMORY", the processed data (in this case a multi-layer image) will be stored in memory instead of writing into a file. But if i want to manipulate the processed data as an array right away, is there a way to retrieve the data in memory and manipulate them directly? In the past the general way for me to deal with this kind of situation was to write the data into files, and then read the files into objects and manipulate the objects, but i figure there must be a shortcut which allows me to skip this time-consuming step of writing and reading.

Thank you so much!
Re: how to manipulate data that are stored in memory directly? [message #84934 is a reply to message #84933] Tue, 18 June 2013 14:09 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
itscd writes:

> Hey guys, this might be a simple question, but it has been bothering me for a while: how to retrieve the data stored in memory and manipulate them as a simple IDL variable?
>
> For example, the following is a piece of standard IDL code to use the layer stacking function in ENVI:
>
> envi_doit, 'envi_layer_stacking_doit', $
> fid=fid, pos=pos, dims=dims, $
> out_dt=out_dt, out_name=out_name, $
> interp=0, out_ps=out_ps, $
> out_proj=out_proj, r_fid=r_fid , /EXCLUSIVE, /IN_MEMORY
>
> Because i specified the keyword "IN_MEMORY", the processed data (in this case a multi-layer image) will be stored in memory instead of writing into a file. But if i want to manipulate the processed data as an array right away, is there a way to retrieve the data in memory and manipulate them directly? In the past the general way for me to deal with this kind of situation was to write the data into files, and then read the files into objects and manipulate the objects,
but i figure there must be a shortcut which allows me to skip this time-consuming step of writing and reading.
>

Alas, if you could do this the secrets of ENVI would fall open to you,
and the gods would descend on you and destroy you. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: how to manipulate data that are stored in memory directly? [message #84938 is a reply to message #84934] Wed, 19 June 2013 03:31 Go to previous messageGo to next message
Josh Sixsmith is currently offline  Josh Sixsmith
Messages: 13
Registered: December 2012
Junior Member
As David mentioned, I don't think you have much luck in being able to manipulate it directly.
However, you can use the returned fid in your case 'r_fid', and let ENVI's magic tiling routines for you to process small chunks of data at a time. Any of ENVI's 'do_it' routines should be able to process via the 'r_fid' as well.

Another option (if you want to use anything but ENVI's routines) is to use ENVI_GET_DATA and retrieve one band at a time. You'll have to allocate an array large enough to handle all bands and feed in one band at a time within or loop or something. But now you've just doubled your memory use. It's probably better just to write it to disk and then read it into memory.

Cheers
Josh
Re: how to manipulate data that are stored in memory directly? [message #85022 is a reply to message #84938] Mon, 24 June 2013 01:37 Go to previous message
Rob Klooster is currently offline  Rob Klooster
Messages: 18
Registered: February 2013
Junior Member
In ENVI classic, there is the option to "Export as IDL variable" (under File)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Avoiding Loops in IDL 8.2.2
Next Topic: what 's mean?

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

Current Time: Wed Oct 08 13:31:43 PDT 2025

Total time taken to generate the page: 0.00461 seconds