/* * Roughness measurement macro * v1.17.10 * Developed by M Foley, Sydney Microscopy & Microanalysis * * function processFolder loops through to find files for analysis & then produces the output * function processImage actually runs the analysis on individual files * function updateLogBar produces a scrolling 'progress' bar for the log window * * Assumption: slices start at the bottom of the sample, highest slice = furtherest from the base */ startTime = getTime(); // Timekeeping setBatchMode(true); var fileNames = newArray(); // Arrays to hold results as Global Variables var filezRq = newArray(); var filezRa = newArray(); var filezRv = newArray(); var filezRp = newArray(); var filezRt = newArray(); var filezRsk = newArray(); var filezRku = newArray(); var fileStdDevRA = newArray(); dir1 = getDirectory("Choose Source Directory "); // Location of datasets extension = ".am"; // Format - .am or .tiff if (getBoolean("Process folder "+dir1, "Yes please", "No thanks") ==1){ processFolder(dir1);} // Last chance to check things function processFolder(dir1) { print("\\Clear"); print("Processing folder "+dir1); // Line 0; print("\n"); // Reserved for ***** print("\n"); // Update of what we're doing print("------------------------------------------"); // Spacer list = getFileList(dir1); for (i=0; i0; y--){ // to find where the first non-zero pixel exists val = getPixel(x,y); // when found, dump to the xPos & yPos arrays if (val==255){ xPos[x] = x; yPos[x] = y; y = 0; } if(x==width-1) {yPos[x] = yPos[x-1];} // Fix for edge - skeletonisation erodes the final pixel } } yPos_Rq = 0; // Reset the Rn value arrays for this slice yPos_Ra = 0; yPos_Rv = height; yPos_Rp = 0; yPos_Rt = 0; yPos_Rsk = 0; yPos_Rku = 0; Array.getStatistics(yPos, min, max, mean, std); // Find the mean yPos value for (i=0; i