Hello,
I'm working on a procedure that will help automate the hyperspectral workflow I've been repeating by hand to whiten my data and associated spectral library. The idea is to provide the file name of a hyperspectral file and an ROI file that identifies a convenient uniform area to use for the shift difference noise calculations. I attempted to use the ENVI 'ForwardMNFTransform' Task, but it doesn't appear that this task allows you to perform a shift difference noise calculation. Thus, I have resorted to the MNF_DOIT routine, but I am again encountering problems applying the shift difference.
Here's my current code:
PRO whitening_automation
; Specify input file and ROI to use for noise statistics calculation (ideally, a uniform dark area)
inFile = FILEPATH('006_140820_175610_L2S.dat', ROOT_DIR="F:\L2Data\")
roiFile = FILEPATH('006_140820_175610_uniform.roi', ROOT_DIR="F:\L2Data\")
; Also provide an output directory and root filename to use for output files
outDir = "F:\HSI_demo\"
rootName = "006_140820_175610"
; Open input file and load the uniform ROI to use for whitening
raster = e.OpenRaster(inFile)
ENVI_Restore_ROIs, roiFile
; Get the input file ID and query the file for dimensions and number of bands
fid = ENVIRasterToFID(raster)
ENVI_File_Query, fid, DIMS=dims, NB=nb
; Get the pointer ID for the ROI
roiID = ENVI_GET_ROI_IDS(FID=fid)
; Now perform MNF transform
ENVI_Doit, 'MNF_Doit', $
FID = fid, $
DIMS = dims, $
POS = Lindgen(nb), $
OUT_NAME = outDir+rootName+'_mnf' $
SD_DIMS = roiID, $
/SHIFT_DIFF, $
STA_NAME = outDir+rootName+'_mnf.sta', $
NOISE_STA_NAME = outDir+rootName+'_mnf_noise.sta', $
/NO_PLOT, $
R_FID = mnf_fid
Can anyone identify where this has gone wrong or provide an alternative that uses the ENVI 'ForwardMNFTransform' Task? Thanks!