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

Home » Public Forums » archive » Re: Help with MNF in ENVI
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
Re: Help with MNF in ENVI [message #39128] Wed, 21 April 2004 08:55
jnettle1 is currently offline  jnettle1
Messages: 27
Registered: January 2001
Junior Member
You were apparently looking for a way to programatically apply an MNF
to a set of spectra, but just in case you're willing to do it by and
and missed it, ENVI has an "Apply forward MNF to spectra" routine that
I believe will do just what you want. But I don't know if there's a
"doit" procedure that goes along with it. I haven't played with
these kinds of operations that much. Anyway, just thought I'd mention
this, just in case :)

Jeff



Zhihong Pan <zpan@malibu.eecs.uci.edu> wrote in message news:<Pine.GSO.4.58.0404201803450.22467@malibu.eecs.uci.edu>...
> You are the man, Peter.
>
> You got it all correct (it's ## if you want to know). I was messing with
> evec but no luck. Thanks again.
>
> Pan
>
> PS, just read your reply again. Found a minor bug, for AVG, it's only
> computed for the selected bands but stored in original order. So the
> non-selected bands have zero in the array.
>
> On Wed, 21 Apr 2004, Peter Mason wrote:
>
>> Zhihong Pan wrote:
>>> Hi, All
>>>
>>> First post here, need help for MNF transformation in ENVI program.
>>>
>>> I can use MNF_DOIT for transformation of an image. But now I want to
>>> apply the existing MNF transformation to a few spectra but ENVI
>>> doesn't support it. I assume the transformation matrix is saved in the
>>> M

NF statistics file but not sure about the details. Any comments
>>> appreciated.
>>>
>>> BTW, this might not be the correct forum for ENVI question. Any
>>> recommends of forums for ENVI program?
>>>
>>> Thanks
>>
>>
>> It seems to be okay to post ENVI questions here. <cringes>
>> Anyway... I was also faced with this issue a few years ago. I did some
>> experiments and, IIRC, in an MNF stats file the forward transformation
>> matrix is saved in the spot where the *covariance* matrix is usually saved.
>> The MNF eigenvalues are saved in the eigenvalue spot. Not sure about the
>> eigenvectors spot - possibly the reverse transformation matrix.
>> It has been some time since I checked this and things might have changed,
>> but assuming they haven't, this is how you'd get the goodies to do your own
>> MNF transform:
>> envi_get_statistics, stats_file_name, cpos=cpos, mean=avg, cov=fmnf,
>> eval=mnfeval
>> (You don't actually need MNFEVAL for the transform but it's handy for a
>> plot.)
>> More detail:
>> The image mean (AVG) is always computed for all bands while the MNF stats
>> can be computed for a subset. CPOS is an index array showing which bands
>> were used. Last I checked, an ENVI stats file doesn't contain band
>> wavelengths so the only check that you can do to see if the stats file
>> *might* be spectrally compatible with your spectra is along these lines:
>> Compare your full number of bands against N_ELEMENTS(AVG) and the size and
>> contents of your selected-bands index array against CPOS.
>> In order to do the transform you will have to extract the MNF's input
>> channel subset from AVG:
>> AVG_SUB=AVG[CPOS]
>> The transform for a spectrum SPEC then goes something like this:
>> (SPEC-AVG_SUB) ## FMNF
>> ( # or ##? You ask too much of me :-) FMNF or TRANSPOSE(FMNF)? Again,
>> you ask too much :-) A couple of experiments with an image and you'll be
>> there.)
>>
>> BTW, if you are thinking of transforming, say, resampled spectral-library
>> spectra using MNF stats calculated for an image, remember that it'll only
>> work if the spectra are of the same kind as what's in the image (e.g., both
>> reflectance) and are scaled the same (e.g., both 0 to 10000). (This in
>> addition to having the same #bands and wavelengths.)
>>
>>
>> HTH
>> Cheers
>> Peter Mason
>>
>>
>>
Re: Help with MNF in ENVI [message #39136 is a reply to message #39128] Tue, 20 April 2004 18:08 Go to previous message
Zhihong Pan is currently offline  Zhihong Pan
Messages: 1
Registered: April 2004
Junior Member
You are the man, Peter.

You got it all correct (it's ## if you want to know). I was messing with
evec but no luck. Thanks again.

Pan

PS, just read your reply again. Found a minor bug, for AVG, it's only
computed for the selected bands but stored in original order. So the
non-selected bands have zero in the array.

On Wed, 21 Apr 2004, Peter Mason wrote:

> Zhihong Pan wrote:
>> Hi, All
>>
>> First post here, need help for MNF transformation in ENVI program.
>>
>> I can use MNF_DOIT for transformation of an image. But now I want to
>> apply the existing MNF transformation to a few spectra but ENVI
>> doesn't support it. I assume the transformation matrix is saved in the
>> MNF statistics file but not sure about the details. Any comments
>> appreciated.
>>
>> BTW, this might not be the correct forum for ENVI question. Any
>> recommends of forums for ENVI program?
>>
>> Thanks
>
>
> It seems to be okay to post ENVI questions here. <cringes>
> Anyway... I was also faced with this issue a few years ago. I did some
> experiments and, IIRC, in an MNF stats file the forward transformation
> matrix is saved in the spot where the *covariance* matrix is usually saved.
> The MNF eigenvalues are saved in the eigenvalue spot. Not sure about the
> eigenvectors spot - possibly the reverse transformation matrix.
> It has been some time since I checked this and things might have changed,
> but assuming they haven't, this is how you'd get the goodies to do your own
> MNF transform:
> envi_get_statistics, stats_file_name, cpos=cpos, mean=avg, cov=fmnf,
> eval=mnfeval
> (You don't actually need MNFEVAL for the transform but it's handy for a
> plot.)
> More detail:
> The image mean (AVG) is always computed for all bands while the MNF stats
> can be computed for a subset. CPOS is an index array showing which bands
> were used. Last I checked, an ENVI stats file doesn't contain band
> wavelengths so the only check that you can do to see if the stats file
> *might* be spectrally compatible with your spectra is along these lines:
> Compare your full number of bands against N_ELEMENTS(AVG) and the size and
> contents of your selected-bands index array against CPOS.
> In order to do the transform you will have to extract the MNF's input
> channel subset from AVG:
> AVG_SUB=AVG[CPOS]
> The transform for a spectrum SPEC then goes something like this:
> (SPEC-AVG_SUB) ## FMNF
> ( # or ##? You ask too much of me :-) FMNF or TRANSPOSE(FMNF)? Again,
> you ask too much :-) A couple of experiments with an image and you'll be
> there.)
>
> BTW, if you are thinking of transforming, say, resampled spectral-library
> spectra using MNF stats calculated for an image, remember that it'll only
> work if the spectra are of the same kind as what's in the image (e.g., both
> reflectance) and are scaled the same (e.g., both 0 to 10000). (This in
> addition to having the same #bands and wavelengths.)
>
>
> HTH
> Cheers
> Peter Mason
>
>
>
Re: Help with MNF in ENVI [message #39137 is a reply to message #39136] Tue, 20 April 2004 17:32 Go to previous message
Peter Mason is currently offline  Peter Mason
Messages: 145
Registered: June 1996
Senior Member
Zhihong Pan wrote:
> Hi, All
>
> First post here, need help for MNF transformation in ENVI program.
>
> I can use MNF_DOIT for transformation of an image. But now I want to
> apply the existing MNF transformation to a few spectra but ENVI
> doesn't support it. I assume the transformation matrix is saved in the
> MNF statistics file but not sure about the details. Any comments
> appreciated.
>
> BTW, this might not be the correct forum for ENVI question. Any
> recommends of forums for ENVI program?
>
> Thanks


It seems to be okay to post ENVI questions here. <cringes>
Anyway... I was also faced with this issue a few years ago. I did some
experiments and, IIRC, in an MNF stats file the forward transformation
matrix is saved in the spot where the *covariance* matrix is usually saved.
The MNF eigenvalues are saved in the eigenvalue spot. Not sure about the
eigenvectors spot - possibly the reverse transformation matrix.
It has been some time since I checked this and things might have changed,
but assuming they haven't, this is how you'd get the goodies to do your own
MNF transform:
envi_get_statistics, stats_file_name, cpos=cpos, mean=avg, cov=fmnf,
eval=mnfeval
(You don't actually need MNFEVAL for the transform but it's handy for a
plot.)
More detail:
The image mean (AVG) is always computed for all bands while the MNF stats
can be computed for a subset. CPOS is an index array showing which bands
were used. Last I checked, an ENVI stats file doesn't contain band
wavelengths so the only check that you can do to see if the stats file
*might* be spectrally compatible with your spectra is along these lines:
Compare your full number of bands against N_ELEMENTS(AVG) and the size and
contents of your selected-bands index array against CPOS.
In order to do the transform you will have to extract the MNF's input
channel subset from AVG:
AVG_SUB=AVG[CPOS]
The transform for a spectrum SPEC then goes something like this:
(SPEC-AVG_SUB) ## FMNF
( # or ##? You ask too much of me :-) FMNF or TRANSPOSE(FMNF)? Again,
you ask too much :-) A couple of experiments with an image and you'll be
there.)

BTW, if you are thinking of transforming, say, resampled spectral-library
spectra using MNF stats calculated for an image, remember that it'll only
work if the spectra are of the same kind as what's in the image (e.g., both
reflectance) and are scaled the same (e.g., both 0 to 10000). (This in
addition to having the same #bands and wavelengths.)


HTH
Cheers
Peter Mason
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: xmanager to call object methods?
Next Topic: explicit redraw does nothing until expose(?) event - IDLitComponent propertysheets

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

Current Time: Wed Oct 08 15:28:28 PDT 2025

Total time taken to generate the page: 0.00433 seconds