This post has been edited 2 times, last edit by "DrChaotica" (Nov 12th 2007, 6:17pm)
This post has been edited 1 times, last edit by "Panschk[FP]" (Nov 12th 2007, 7:38pm)
Source code |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
// _w und _h initialisieren if (viewmode==0) { //transversale Sicht _w = active_file.getImageWidth(); _h = active_file.getImageHeight(); } else if (viewmode==1) { //sagittale Sicht _w = _slices.getImageHeight(); _h = _slices.getNumberOfImages(); } else if (viewmode==2) { //frontale Sicht _w = _slices.getImageWidth(); _h = _slices.getNumberOfImages(); } // _w and _h need to be initialized BEFORE filling the image array ! if (_bg_img==null || _bg_img.getWidth(null)!=_w || _bg_img.getHeight(null)!=_h) { reallocate(); } |
Source code |
|
1 2 3 4 5 6 7 8 9 10 |
private void reallocate() { _w = _slices.getImageWidth(); _h = _slices.getImageHeight(); _bg_pixels = new int[_w*_h]; _bg_mis = new MemoryImageSource(_w, _h, _bg_pixels, 0, _w); _bg_mis.setAnimated(true); _bg_img = createImage(_bg_mis); ... usw. |
This post has been edited 1 times, last edit by "Markus" (Nov 12th 2007, 8:35pm)
Java source code |
|
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 |
public void laplace_smooth(Vector<Point3f> vertices, Vector<Integer> triangles, int numIterations) { //Nachbarschaft der Punkte berechnen Vector<Set<Integer>> neighborhoods = new Vector<Set<Integer>>(vertices.size()); neighborhoods.setSize(vertices.size()); for(int i = 0; i < vertices.size(); ++i) neighborhoods.set(i, new CopyOnWriteArraySet<Integer>()); for(int i = 0; i < triangles.size(); i += 3) { int i0 = triangles.get(i+0); int i1 = triangles.get(i+1); int i2 = triangles.get(i+2); neighborhoods.get(i0).add(i1); neighborhoods.get(i0).add(i2); neighborhoods.get(i1).add(i0); neighborhoods.get(i1).add(i2); neighborhoods.get(i2).add(i0); neighborhoods.get(i2).add(i1); } //jeden Punkt ins Zentrum seiner topologischen Nachbarn ziehen for(int iter = 0; iter < numIterations; ++iter) { System.out.println("iteration " + iter); Vector<Point3f> temp_vertices = new Vector<Point3f>(vertices.size()); temp_vertices.setSize(vertices.size()); for(int i = 0; i < vertices.size(); ++i) { Point3f p = new Point3f(0,0,0); int count = 0; for(int n : neighborhoods.get(i)) { p.add(vertices.get(n)); ++count; } p.scale(1.0f/count); temp_vertices.set(i, p); } for(int i = 0; i < vertices.size(); ++i) { vertices.set(i, temp_vertices.get(i)); } } } |
This post has been edited 2 times, last edit by "DrChaotica" (Dec 30th 2007, 9:41pm)
Wer die Sachen ebenfalls haben will, kann sich jetzt ja auch an mich wenden;-]
Oder einfach mal ins StudIP schauen. So wie es aussieht sind mittlerweile alle 8 Blätter online (habe sie mir allerdings noch nicht angesehen)