-
Notifications
You must be signed in to change notification settings - Fork 2
/
_DKR_Measure_Linear_Spindle_Batch.txt
65 lines (44 loc) · 1.69 KB
/
_DKR_Measure_Linear_Spindle_Batch.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//takes linearized spindle projections and writes a results table from
//a line drawn across the middle of the image (spindle center)
//
//***this macro takes ONLY the middle pixel value for each column,
//see _DKR_Measure_Linear_Spindle_Batch(Grp).txt for pooled center sections
macro "_DKR_Measure_Linear_Spindle_Batch"{
if(nImages>0) exit ("close all images before proceeding");
run("Clear Results");
dir1 = getDirectory("Choose source directory");
if (dir1=="")
exit("No directory available");
//get a list of all the files in this folder
list = getFileList(dir1);
//iterate through each image
for(i=0;i<list.length;i++){
//open the image and set its variables
open(dir1+list[i]);
getDimensions(width, height, channels, slices, frames);
getPixelSize(unit, pixelWidth, pixelHeight);
name = getTitle;
run("Subtract Background...", "rolling=50");
//spindleLength = width*pixelWidth;
//add more lines to the results table if it is not long enough
for(line=0;line<width;line++){
setResult(unit,line,line*pixelWidth);
}
//append the data to a new labeled column
for(line=0;line<width;line++){
//define where to take the data from
//place = 0; //use this to get a line along the top of the image (backgroundish)
top = (height-15)/2; //use this to get a line along midline
run("Specify...", "width=1 height=15 x="+line+" y="+top);
getStatistics(area, mean);
value = round(mean);
setResult(name,line,value);
}
updateResults();
selectWindow(list[i]);
close();
wait(25);
}
selectWindow("Results");
saveAs("Measurements", dir1+"Results.xls");
print("Results saved as \n"+dir1+"Results.xls");