-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChange_Attributes.java
More file actions
59 lines (46 loc) · 1.34 KB
/
Copy pathChange_Attributes.java
File metadata and controls
59 lines (46 loc) · 1.34 KB
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
package examples;
import org.scijava.vecmath.Color3f;
import ij.IJ;
import ij.ImagePlus;
import ij.plugin.PlugIn;
import ij.process.StackConverter;
import ij3d.Content;
import ij3d.Image3DUniverse;
public class Change_Attributes implements PlugIn {
public static void main(String[] args) {
new ij.ImageJ();
IJ.runPlugIn("ij3d.examples.Change_Attributes", "");
}
@Override
public void run(String arg) {
// Open an image
String path = "/home/bene/PhD/brains/template.tif";
ImagePlus imp = IJ.openImage(path);
new StackConverter(imp).convertToGray8();
// Create a universe and show it
Image3DUniverse univ = new Image3DUniverse();
univ.show();
// Add the image as an isosurface
Content c = univ.addMesh(imp);
sleep(5);
// Display the Content in purple
c.setColor(new Color3f(0.5f, 0, 0.5f));
sleep(5);
// Make it transparent
c.setTransparency(0.5f);
sleep(5);
// Change the isovalue (= threshold) of the surface
c.setThreshold(50);
sleep(5);
// remove all contents and close the universe
univ.removeAllContents();
univ.close();
}
private static void sleep(int sec) {
try {
Thread.sleep(sec * 1000);
} catch(InterruptedException e) {
System.out.println(e.getMessage());
}
}
}