Humboldt-Universität zu Berlin - Faculty of Mathematics and Natural Sciences - Strukturforschung / Elektronenmikroskopie


// This script plots the average spectrum of a selection of a 3D stack
number sx,sy,sz,top,left,bottom,right,count
Image stack,spectrum

if (!GetFrontImage(stack))
throw("Please open an image stack first!")


// if no selection was chosen, then take the whole image stack:
if (!GetSelection(stack,top,left,bottom,right)) {
top=0; left=0; bottom=sy; right=sx;

spectrum = RealImage("Spectrum",4,sz,1)
for (count=0;count<sz;count++)
spectrum[0,count,1,count+1] = mean(stack[left,top,count,right,bottom,count+1])

setname(spectrum,"spectrum of "+getname(stack))