-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMovie_Recording.java
More file actions
54 lines (41 loc) · 1.2 KB
/
Copy pathMovie_Recording.java
File metadata and controls
54 lines (41 loc) · 1.2 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
package examples;
import ij.process.StackConverter;
import ij.plugin.PlugIn;
import ij.ImagePlus;
import ij.IJ;
import ij3d.Image3DUniverse;
public class Movie_Recording implements PlugIn {
public static void main(String[] args) {
new ij.ImageJ();
IJ.runPlugIn("ij3d.examples.Movie_Recording", "");
}
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 a volume
univ.addVoltex(imp);
sleep(5);
// animate the universe
univ.startAnimation();
sleep(5);
// record a 360 degree rotation around the y-axis
ImagePlus movie = univ.record360();
movie.show();
univ.pauseAnimation();
// 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());
}
}
}