Calculates histogram of facet slopes in atomic force microscopy (AFM) images. See Surface and Interface Analysis 25 (1997) 74.

//Calculates a histogram of slopes of facets in AFM images.  See Chatelier et al. in Surface and Interface Analysis 25 (1997) 741.
//Similar to the output of Gwyddion image analysis software after selecting Data Process-->Statistics -->Slope Distribution --> Inclination (theta)
//Assumes that the AFM image has been plane filtered, is loaded into a 2D wave, and has heights in nanometers
Function slope_freq(w1)
    wave w1
    variable X_index, Y_index, totalcycles=0, array_size, mini_wave_scaling=1
    Prompt mini_wave_scaling, "Enter nm/point value: " // Set prompt for x-y scaling (example:  this should be ~9.78 nm/point for a 512  x 512 pixel image that is 5 microns on a side)
    DoPrompt "nm/point", mini_wave_scaling
    if (V_Flag)
        return -1 // User canceled
    endif
    RemoveFromTable slopes, mini_x, mini_y  //probably could comment out all of the remove/kill statements, but they can be useful.  They will cause errors the first time the function is used.
    Killwaves slopes, mini_x, mini_y
    make/N=3 mini_x
    make/N=3 mini_y
    SetScale/P x 0,(mini_wave_scaling),"", mini_x
    SetScale/P x 0,(mini_wave_scaling),"", mini_y
    wavestats/Q w1
    array_size=V_npnts
    make/N=((array_size^0.5-2)^2) slopes
    for (X_index=1; X_index<(array_size^0.5-1); X_index+=1)
            for (Y_index=1; Y_index<(array_size^0.5-1); Y_index+=1)
                mini_x=w1[Y_index][(p+X_index-1)]
                curvefit/Q line mini_x
                variable dzdx=k1
                mini_y=w1[(p+Y_index-1)][X_index]
                curvefit/Q line mini_y
                variable dzdy=k1
                slopes[totalcycles]=(atan((dzdx^2+dzdy^2)^0.5)/(2*pi))*360  //slopes in degrees are between the normal of the facet and the nominal sample normal
                totalcycles+=1
            endfor
    endfor
    AppendToTable slopes
    Histogram/B={0,0.1,900} slopes,slopes_Hist   //Bin slopes of 0-90 degrees into histogram.  Typically need to duplicate slopes and slopes_Hist waves into other wavenames to save results
End

Forum

Support

Gallery

Igor Pro 8

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More