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

Home » Public Forums » archive » Re: Can this be done using CALL_FUNCTION?
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: Can this be done using CALL_FUNCTION? [message #19372 is a reply to message #19366] Tue, 07 March 2000 00:00 Go to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
edward.s.meinel@aero.org wrote:
>
> OK, here's one for the IDL gurus (since I'm only a little guru would
> that make me a gu-gu?)...
>
> I am working with spectral images. Unfortunately, IDL is geared toward
> multidimensional data in which all of the dimensions are the same type
> (i.e. spatial, spectral, frequency...) but it doesn't like to operate on
> data with mixed dimensions, such as a multispectral image (unless I'm
> missing something really obvious).
>
> Rather than having to rewrite every bloody function/procedure for
> spectral imagery, I was hoping it would be possible to write a generic
> wrapper function along the lines of:
>
> FUNCTION spatial_function, name, image, other_stuff
> im_size = SIZE(image)
> CASE im_size OF
> [... rest of code snipped][/color]

Ed,

in a perfect world you could do this, although you should add
_EXTRA=e to your wrapper to allow for keywords. Unfortunately,
several of the built-in (or library) functions are not forgiving
when it comes to the wrong number of parameters and keywords. Therefore,
you will probably not get around doing something (ugly) like:

function spatial_function, name, image, arg1, arg2, arg3, arg4, _EXTRA=e

im_size = SIZE(image)
CASE im_size OF
...
CASE n_params() OF
2 : CALL_FUNCTION(name,image)
3 : CALL_FUNCTION(name,image,arg1)
4 : CALL_FUNCTION(name,image,arg1,arg2)
...
ENDCASE
...


A way around this? Well, you could rewrite all the functions you would
potentially call from such a wrapper and give them extra arguments which
are simply ignored if they are not needed.
Example:
change
FUNCTION Correlate, X, Y, Covariance = Covariance, Double = Double
into
FUNCTION Correlate, X, Y, DUM1, DUM2, DUM3, DUM4, DUM5, DUM6, $
Covariance = Covariance, Double = Double

And if the function doesn't have keywords, add _EXTRA=e to it.

Good luck,
Martin

--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Converting 8-bit image + pallete to 24 bit image with alpha channel
Next Topic: silly font problem

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

Current Time: Fri Oct 10 19:24:35 PDT 2025

Total time taken to generate the page: 1.92227 seconds