var sampleMin = newArray(); var sampleMax = newArray(); var sampleMean= newArray(); var sampleStdDev = newArray(); var samples = newArray(); macro "Roughness approximater" { /* * Roughness approximater * * Macro to determine the 'roughness' of a surface in a binary AmiraMesh file * Assumptions: * Object oriented laterally i.e. slices look through the xy plane / along the z axis * Z = 0 is the bottom, Z = max is the top * the surface is defined as the FIRST edge encountered relative to the base of the object * Macro fails for complicated structures, or objects that deviate significantly from a predominantly * smooth surface relative to the base * * Measurements are all in pixels */ print("\\Clear"); IJ.log("Starting analysis"); IJ.log("*****************"); dir = getDirectory("Choose Source Directory "); dir1 = getDirectory("Save location for results"); extension = ".am"; setBatchMode(true); n = 0; processFolder(dir); Sample_Name = samples; Min = sampleMin; Max = sampleMax; Mean = sampleMean; StdDev = sampleStdDev; Array.show("Summary", Sample_Name, Min, Max, Mean, StdDev); summaryName = replace(dir, ":", "-"); summaryName = replace(summaryName, " ", "_"); saveAs("Results", dir1+"Summary Results for "+summaryName+".txt"); function processFolder(dir) { list = getFileList(dir); for (i=0; i