1 package org.textensor.stochdiff.disc;
2
3 import org.textensor.report.E;
4 import org.textensor.stochdiff.numeric.morph.TreePoint;
5 import org.textensor.stochdiff.numeric.morph.TreeWriter;
6 import org.textensor.stochdiff.numeric.morph.VolumeGrid;
7
8 import java.io.File;
9
10 import java.util.HashMap;
11
12
13 public class TreeCurvedElementDiscretizer {
14
15 TreePoint[] srcPoints;
16
17
18 public TreeCurvedElementDiscretizer(TreePoint[] points) {
19 srcPoints = points;
20 }
21
22
23 public VolumeGrid buildGrid(double d, HashMap<String, Double> resHM, double[] surfaceLayers, double mar) {
24
25 TreePoint base = srcPoints[0];
26 TreeUtil.parentizeFrom(base, srcPoints);
27 TreeUtil.orientAC(base, srcPoints);
28
29 SegmentSlicer ss = new SegmentSlicer(srcPoints);
30
31
32 TreePoint[] slicedPoints = ss.getFixedWidthSlices(d, resHM);
33
34 TreeWriter tw = new TreeWriter(slicedPoints);
35 tw.writeSWC(new File("discretized-tree.swc"));
36
37 VolumeGrid vgrid = null;
38
39 DiscSplitter dsplit = new DiscSplitter(slicedPoints, d, resHM, surfaceLayers, mar);
40 vgrid = dsplit.buildGrid();
41
42 return vgrid;
43 }
44
45
46 }