public synchronized VolumeGrid getVolumeGrid() { if (this.volumeGrid == null) { final Morphology morph = this.getMorphology(); final TreePoint[] tpa = morph.getTreePoints(); final Discretization disc = this.getDiscretization(); double d = disc.getDefaultMaxElementSide(); double deltaX = disc.spineDeltaX != null ? disc.spineDeltaX : d; // <--WK 6 22 2007 // (1) iterate through all endpoints and their associated radii. // (2) divide each radius by successively increasing odd numbers until // the divided value becomes less than the defaultMaxElementSide. // (3) select the smallest among the divided radii values as d. double[] diameters = new double[tpa.length]; double[] candidate_grid_sizes = new double[tpa.length]; for (int i = 0; i < tpa.length; i++) { double diameter = tpa[i].getRadius() * 2; diameters[i] = diameter; double denominator = 1; while (diameter / denominator > d) denominator += 2; // divide by successive odd numbers candidate_grid_sizes[i] = diameter / denominator; } d = Math.min(d, ArrayUtil.min(candidate_grid_sizes)); log.info( "Subvolume grid size is: {} (from radii {}, candidates {}, default {})", d, diameters, candidate_grid_sizes, disc.getDefaultMaxElementSide()); if (disc.curvedElements()) { TreeCurvedElementDiscretizer tced = new TreeCurvedElementDiscretizer(tpa); volumeGrid = tced.buildGrid( d, disc.getResolutionHM(), disc.getSurfaceLayers(), disc.getMaxAspectRatio()); } else volumeGrid = TreeBoxDiscretizer.buildGrid( tpa, d, disc.getResolutionHM(), disc.getSurfaceLayers(), this.getGeometry(), this.depth2D); SpineLocator.locate(this.spineSeed, morph.getSpineDistribution(), deltaX, volumeGrid); volumeGrid.fix(); log.info("{} subvolumes", volumeGrid.size()); } return this.volumeGrid; }
public synchronized int[][] getStimulationTargets() { VolumeGrid grid = this.getVolumeGrid(); String[] targets = this.getStimulationTable().getTargetIDs(); return grid.getAreaIndexes(targets); }