Works for me.I just realised I left in some code I shouldn't have. Try the below (also attached):.nirs=samples[*,*,7]
nird=data[*,*,7]
d=size(nirs,/dim)
i=where(nirs gt 0)
o=where(nird eq 0)
m=min(nirs)
out=0
help, m
foreach b, bindgen(6) do begin
band=samples[*,*,b]
r=linfit(nirs,band)
band=data[*,*,b]
deglint=long(band - r[1] * (nird - m)+0.5)
deglint=0
if size(out, /n_dimensions) eq 0 then $ ;Image stack doesn't exist yet
out=temporary(deglint) $
else $ ;Concatenate image to stack
out=[[[temporary(out)]],[[temporary(deglint)]]]
endforeach
out=[[[temporary(out)]],[[data[*,*,6]]]]
out=[[[temporary(out)]],[[data[*,*,7]]]]
end
An example using the above code:Before[ATTACH=CONFIG]11237[/ATTACH]After[ATTACH=CONFIG]11238[/ATTACH]