Skip to content

Commit 6dfb59a

Browse files
authored
Add macro that produces the morphonets logo
1 parent 8309e99 commit 6dfb59a

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

MorphonetsLogo.ijm

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// Creates the Morphonets logo
2+
3+
4+
// settings and canvas
5+
zoomFactor = 10;
6+
setLineWidth(6 * zoomFactor);
7+
newImage("MorphonetsLogo", "8-bit black", 512 * zoomFactor , 512 * zoomFactor, 1);
8+
9+
// Position of central node
10+
xc= 360; yc= 250;
11+
12+
// make child nodes
13+
x1=238; y1=72;
14+
makeNode(x1, y1, 40, 30);
15+
16+
x1=96; y1=126;
17+
makeNode(x1, y1, 48, 120);
18+
19+
x1=142; y1=300;
20+
makeNode(x1, y1, 38, 170);
21+
22+
x1=234; y1=416;
23+
makeNode(x1, y1, 52, 210);
24+
25+
// make central node
26+
outerRadius = 108;
27+
makeNode(xc, yc, outerRadius, 0);
28+
makeNodeExtended(xc, yc, outerRadius, 180, false);
29+
makeNode(xc, yc, outerRadius * 0.85, 250);
30+
31+
// make gap in outer circle
32+
nickCircle(xc, yc, outerRadius);
33+
34+
// apply colors
35+
colorize();
36+
37+
38+
function nickCircle(x, y, r) {
39+
w = 120 * zoomFactor; h = 20 * zoomFactor;
40+
x = x * zoomFactor;
41+
y = y * zoomFactor;
42+
r = r * zoomFactor;
43+
setColor(0);
44+
fillRect(x - w/2, y + r - h /2 , w, h);
45+
fillRect(x - w/2, y - r - h /2 , w, h);
46+
}
47+
48+
function makeNode(x, y, r, value) {
49+
makeNodeExtended(x, y, r, value, true);
50+
}
51+
52+
function makeNodeExtended(x, y, r, value, fillFlag) {
53+
setColor(225); // edge color
54+
drawLine(xc * zoomFactor, yc * zoomFactor, x * zoomFactor, y * zoomFactor);
55+
setColor(value); // node color
56+
x = x * zoomFactor;
57+
y = y * zoomFactor;
58+
r = r * zoomFactor;
59+
xcorner = x - r ;
60+
ycorner = y - r;
61+
if (fillFlag) {
62+
fillOval(xcorner, ycorner, r * 2, r * 2);
63+
} else {
64+
drawOval(xcorner, ycorner, r * 2, r * 2);
65+
}
66+
}
67+
68+
function colorize() {
69+
run("mpl-viridis");
70+
getLut(reds, greens, blues);
71+
reds[0] = 255; greens[0] = 255; blues[0] = 255;
72+
setLut(reds, greens, blues);
73+
}

0 commit comments

Comments
 (0)