Posted by
Krs5 on
Jun 02, 2014; 7:53am
URL: http://imagej.273.s1.nabble.com/4-measurements-macro-tp5007976p5007977.html
Dear Adam,
I have not tested your code as I am not sure what you try to do but I see a few problems
print(getTitle()+" \t"+length1+" \t"+length2+" \t"+length3+”\t”+length4+”); should read:
print(getTitle()+" \t"+length1+" \t"+length2+" \t"+length3+" \t"+length4);
I also notice that some of your "s are not correct but probably copied in. Sometime ImageJ does not like this. In your line above the last 3 "s are not the same as the others.
Hope this helps
Best wishes
Kees
Dr Ir K.R. Straatman
Senior Experimental Officer
Advanced Imaging Facility
Centre for Core Biotechnology Services
University of Leicester
http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/lite/aif-----Original Message-----
From: ImageJ Interest Group [mailto:
[hidden email]] On Behalf Of Adam Huttenlocker
Sent: 02 June 2014 04:34
To:
[hidden email]
Subject: 4 measurements macro
Hello ImageJ enthusiasts.
I am trying to write code for a series of macros that record 'n'
measurements (in this case 4) in 'n' separate columns. I did this by modifying an old script called the 'Measure3lengths' macro and trying to add a 4th column, but I keep getting an error message when I try to run it.
Can anyone see what the problem is in my code (copied below)?
var length1=-1, length2=-1, length3=-1, length4=-1;
macro "Measure Length 1 [a]" {
requires("1.30h");
length1 = getLength(1);
}
macro "Measure Length 2 [s]" {
length2 = getLength(2);
}
macro "Measure Length 3 [d]" {
if (length1==-1)
exit("Length1 is missing");
if (length2==-1)
exit("Length2 is missing");
length3 = getLength(3);
}
macro "Measure Length 4 [f]” {
if (length1==-1)
exit("Length1 is missing");
if (length2==-1)
exit("Length2 is missing");
if (length3==-1)
exit("Length3 is missing");
length4 = getLength(4);
print(getTitle()+" \t"+length1+" \t"+length2+" \t"+length3+”
\t”+length4+”);
length1=-1; length2=-1; length3=-1; length4=-1; }
function getLength(n) {
getLine(x1, y1, x2, y2, width);
getVoxelSize(width, height, depth, unit);
length = sqrt((x2-x1)*(x2-x1)*width*width + (y2-y1)*(y2-y1)*height*height);
if (x1==-1)
exit("Stright line selection required");
showStatus("Length"+n+" = "+length+" "+unit);
return length;
}
Adam K. Huttenlocker, PhD
Postdoctoral Research Fellow
Department of Biology, University of Utah & Natural History Museum of Utah Salt Lake City, UT 84112
Office: 801-585-7756
Cell: 303-808-6792
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html