Hello,
I‘ve been using Image SXM but I try also ImageJ so that my method is available also for non-Mac user. I want to transfer a makro but I‘m not familiar with the makro procedure (I‘m not a programmer and wont be one).
I uploaded an image, showing the fabric of a slate and the profil. The vertical running mica layers are > 0 and the other (mostly quartz) < 0 of the x-axis.
I want to measure over a given length (here 1 mm):
the number of the single mica layers
the total percentage of all mica layer
In the SXM makro I open the data window from the Plot Profile and the makro reads the values and gives me the aforementioned data. So I don‘t have to count or use Excel etc.
I didn‘t find an existing solution in ImageJ but I think that my topic isn‘t very exotic.
Thank you very much in advance for any solution.
Joern
This is the makro for IMAGE SXM:
{ global variables }
var
v1,v2 : real;
i, n, m, l, p : integer;
{ This macro evaluates a data set, which contains x-Values and a parameter
{ at that point. It searches for sections with equal algebraic signs at the
{ sampling points and calculates their length. It also gives the overall
{ length for positive and negative zones.
{=˝=======================3D========================3D========================3D=======}
{=========================3D========================3D========================3D=======}
procedure ExtractValuesFromString(str :string );
var
tempStr: string;
begin
tempStr := str;
Delete(tempStr, 13, 12); { remove second value fromstring }
v1 := StringToNum(tempStr); { extract first valuefrom string }
tempStr := str;
Delete(tempStr, 1, 12); { remove first value fromstring }
v2 := StringToNum(tempStr); { extract second valuefrom string }
end;
{=========================3D========================3D========================3D=======}
macro 'Line Spacing Measurement';
var
i, n, m, l, p: integer;
c, o, x, y: real;
poz, neg : real;
strwin, strunz: string;
{ note that 'pos' is a macrocommand, so }
{ can't have a variable with thisname }
begin
for m := 1 to 700 do begin { set allarrays to zero }
rUser1[m] := 0; { distance between samplingpoints (a) }
rUser2[m] := 0; { algebraic sign at the samplingpoint (b) }
rUser3[m] := 0; { sections with equal algebraicsigns (z) }
rUser4[m] := 0; { algebraic sign within a section (zz) }
end;
{ macros can access only a limited number ofarrays }
{ so have to make do with these array names }
{#3 The following determines the length of every section with equal sign aswell as }
{ the overall proportion of values < 0 and >= 0 }
{ Now a little trick to correctly determine the first length. To keep thecode }
{ general the first length must be considered as only from the samplingpoint at }
{ zero to half of the distance to its successor }
{ v11_______v12_______v13_______..._______v1n }
{ a[1]__|__a[2]___|__a[3]___|__...___|___a[n] }
n:=1; m:=1; c:=0; x:=0; y:=0;
ResetGetStr; { make sure we are reading fromthe top }
{ of the window }
for i := 1 to 5 do begin
strunz := GetStrFromWindow; { read and ignore the lines inthe header }
PutMessage(strunz);
end;
ExtractValuesFromString(strunz);
c := v1;
rUser1[n] := 0;
rUser3[m] := rUser1[n];
if v2 >= 0 then
rUser2[n] := 1 { macros don't have boolean arrays,so use 0,1 }
else
rUser2[n] := 0;
rUser4[m] := rUser2[n];
if rUser2[n] = 1 then
x := x + rUser1[n]
else
y := y + rUser1[n];
{ Now all further computing can be done within a loop... }
{ The length of the zone around a sampling point v1n (with equal sign) alongthe }
{ line of slice is set to be half the distance to its predecessor plus halfthe }
{ distance to its successor. For every section with equal sign the length issummed }
{ up. The sections are numbered. The overall lengths for respectively < 0(x) and }
{ >= 0 (y) are summed up. }
n := 2;
strunz := GetStrFromWindow;
ExtractValuesFromString(strunz);
while (v1 <> 0) or (v2 <> 0) do begin
o := v1;
rUser1[n-1] := rUser1[n-1] + (0.5*(o-c));
rUser3[m] := rUser1[n-1] + rUser3[m];
rUser1[n] := 0.5*(o-c);
c := v1;
if v2 >= 0 then
rUser2[n] := 1
else
rUser2[n] := 0;
if rUser2[n] <> rUser2[n-1] then
m := m+1;
if rUser2[n] <> rUser2[n-1] then begin
if v2 >= 0 then
rUser4[m] := 1
else
rUser4[m] := 0;
end;
p := m;
if rUser2[n] = 1 then
x := x + rUser1[n-1]
else
y := y + rUser1[n-1];
l := n;
n := n+1;
strunz := GetStrFromWindow;
ExtractValuesFromString(strunz);
end; { while }
if rUser2[l] <> rUser2[l-1] then
m := m+1;
p := m;
rUser3[m] := rUser1[l] + rUser3[m];
{#4 Make new window for results; Write number of section; '1' for positivesign, }
{ '0' for negative sign; length of section }
NewTextWindow(concat(WindowTitle, ' Pos/Neg'));
for m := 1 to p do
writeln('section[', m:4,';', rUser4[m]:2,']', rUser3[m]:8:3);
{#5 Write overall length of slice, and overall length of positive / negative }
{ in unit of length and percentage }
poz := (x*100) / c+0.1;
neg := (y*100) / c+0.1;
writeln;
writeln('Length [µm/%]:', c:8:2, 100:8:2);
writeln('rigide [µm/%]:', y:8:2, neg:8:2);
writeln('mica [µm/%]:', x:8:2, poz:8:2);
end; { macro 'Line Spacing Measurement' }