本文整理汇总了Java中ij.gui.Overlay.add方法的典型用法代码示例。如果您正苦于以下问题:Java Overlay.add方法的具体用法?Java Overlay.add怎么用?Java Overlay.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.gui.Overlay
的用法示例。
在下文中一共展示了Overlay.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateShapes
import ij.gui.Overlay; //导入方法依赖的package包/类
private void updateShapes(final ImagePlus imp) {
lastSourceImage = imp;
if (imp == null) {
return;
}
// Prepare overlay
final Overlay overlay = new Overlay();
for (final Region region : regions) {
final Area area = new Area();
for (final SubRegion subRegion : region.getSubRegions()) {
final Shape shape = ShapeUtils.toShape(subRegion.getRoi());
area.add(new Area(shape));
}
final ShapeRoi roi = new ShapeRoi(area);
roi.setStrokeColor(region.getColor());
roi.setFillColor(region.getColor());
roi.setName(region.getName());
overlay.add(roi);
}
imp.setOverlay(overlay);
}
示例2: label
import ij.gui.Overlay; //导入方法依赖的package包/类
protected void label(Overlay overlay) {
NumberFormat nf = NumberFormat.getInstance();
nf.setMaximumFractionDigits(2);
nf.setMinimumFractionDigits(2);
for (int n = 0; n < tool.cBeads.size(); n++) {
CalibrationBead first = tool.cBeads.get(n);
TextRoi text = new TextRoi(first.getU(), first.getV() - 20, "Bead "
/*
* + tool.ids[n] + " (" + nf.format(first.getX()) + ", " +
* nf.format(first.getY()) + ", " + nf.format(first.getZ()) + " | "
* + nf.format(first.getU()) + ", " + nf.format(first.getV()) + ")"
*/);
overlay.add(text);
}
}
示例3: overlayBeads
import ij.gui.Overlay; //导入方法依赖的package包/类
protected void overlayBeads(ArrayList<PointND> listOfBeads1, double radius1) {
Overlay overlay = new Overlay();
Roi[] beadRois1 = new Roi[listOfBeads1.size()];
for (int i = 0; i < listOfBeads1.size(); i++) {
double x = listOfBeads1.get(i).get(0);
double y = listOfBeads1.get(i).get(1);
beadRois1[i] = new EllipseRoi(x - radius1, y - radius1,
x + radius1, y + radius1, 1.0);
overlay.add(new EllipseRoi(x - radius1, y - radius1, x + radius1, y
+ radius1, 1.0));
}
// overlayMultipleRois(beadRois1);
// label(overlay);
currentImage.setOverlay(overlay);
// this happens in the GUI
// currentImage.setOverlay(overlay);
}
示例4: overlayBeadsF
import ij.gui.Overlay; //导入方法依赖的package包/类
protected void overlayBeadsF(ArrayList<PointND> listOfBeads1, double radius1) {
Overlay overlay = new Overlay();
Roi[] beadRois1 = new Roi[listOfBeads1.size()];
for (int i = 0; i < listOfBeads1.size(); i++) {
if (listOfBeads1.get(i) != null) {
double x = listOfBeads1.get(i).get(0);
double y = listOfBeads1.get(i).get(1);
beadRois1[i] = new EllipseRoi(x - radius1, y - radius1, x
+ radius1, y + radius1, 1.0);
overlay.add(new EllipseRoi(x - radius1, y - radius1, x
+ radius1, y + radius1, 1.0));
}
}
// overlayMultipleRois(beadRois1);
currentImage.setOverlay(overlay);
// this happens in the GUI
// currentImage.setOverlay(overlay);
}
示例5: overlayBeadsCB
import ij.gui.Overlay; //导入方法依赖的package包/类
protected void overlayBeadsCB(ArrayList<CalibrationBead> listOfBeads1,
double radius1) {
Overlay overlay = new Overlay();
overlay.setLabelColor(Color.RED);
overlay.setFillColor(Color.RED);
Roi[] beadRois1 = new Roi[listOfBeads1.size()];
for (int i = 0; i < listOfBeads1.size(); i++) {
double x = listOfBeads1.get(i).getU();
double y = listOfBeads1.get(i).getV();
beadRois1[i] = new EllipseRoi(x - radius1, y - radius1,
x + radius1, y + radius1, 1.0);
overlay.add(new EllipseRoi(x - radius1, y - radius1, x + radius1, y
+ radius1, 1.0));
}
// overlayMultipleRois(beadRois1);
label(overlay);
currentImage.setOverlay(overlay);
// this happens in the GUI
// currentImage.setOverlay(overlay);
}
示例6: addOverlay
import ij.gui.Overlay; //导入方法依赖的package包/类
/**
* Adds an ROI point overlay to the image using the specified colour
*
* @param imp
* @param list
* @param color
*/
public static void addOverlay(ImagePlus imp, List<? extends Coordinate> list, Color color)
{
if (list.isEmpty())
return;
Color strokeColor = color;
Color fillColor = color;
Overlay o = imp.getOverlay();
PointRoi roi = (PointRoi) PointManager.createROI(list);
roi.setStrokeColor(strokeColor);
roi.setFillColor(fillColor);
roi.setShowLabels(false);
if (o == null)
{
imp.setOverlay(roi, strokeColor, 2, fillColor);
}
else
{
o.add(roi);
imp.setOverlay(o);
}
}
示例7: getOverlay
import ij.gui.Overlay; //导入方法依赖的package包/类
private final Overlay getOverlay(Color overlayColor, float overlayWidth) {
Roi[] rois = roiManager.getRoisAsArray();
Overlay over = new Overlay();
for (int j = 0; j < rois.length; j++) {
Roi roi = rois[j];
roi.setStrokeColor(overlayColor);
roi.setStrokeWidth(overlayWidth);
over.add(roi);
}
return over;
}
示例8: appendRoi
import ij.gui.Overlay; //导入方法依赖的package包/类
/**
* Adds a new ROI to the overlay using the coordinates from start to end (non-inclusive)
*
* @param x
* @param y
* @param slice
* @param indices
* @param o
* @param start
* @param end
*/
private void appendRoi(float[] x, float[] y, int[] slice, int[] indices, Overlay o, int start, int end)
{
int p = end - start;
float[] x2 = new float[p];
float[] y2 = new float[p];
for (int j = start, ii = 0; j < end; j++, ii++)
{
x2[ii] = x[indices[j]];
y2[ii] = y[indices[j]];
}
PointRoi roi = new PointRoi(x2, y2, p);
roi.setPosition(slice[indices[start]]);
o.add(roi);
}
示例9: addToOverlay
import ij.gui.Overlay; //导入方法依赖的package包/类
private void addToOverlay(Overlay o, Roi roi, boolean isHyperStack, int frame)
{
if (isHyperStack)
roi.setPosition(0, 0, frame);
else
roi.setPosition(frame);
o.add(roi);
}
示例10: add
import ij.gui.Overlay; //导入方法依赖的package包/类
private void add(Overlay o, float x, float y, Color color)
{
PointRoi p = new PointRoi(x, y);
p.setStrokeColor(color);
p.setFillColor(color);
p.setPointType(1); //PointRoi.CROSSHAIR);
p.setSize(1); //PointRoi.TINY);
o.add(p);
}
示例11: addRoi
import ij.gui.Overlay; //导入方法依赖的package包/类
public static void addRoi(int frame, Overlay o, float[] x, float[] y, int n, Color colour, int pointType, int size)
{
if (n == 0)
return;
PointRoi roi = new PointRoi(x, y, n);
roi.setPointType(pointType);
roi.setFillColor(colour);
roi.setStrokeColor(colour);
if (frame != 0)
roi.setPosition(frame);
if (size != 0)
roi.setSize(size);
o.add(roi);
}
示例12: addToOverlay
import ij.gui.Overlay; //导入方法依赖的package包/类
private void addToOverlay(Overlay o, int frame, int[] x, int[] y, int c, Color color)
{
PointRoi roi = new PointRoi(x, y, c);
roi.setFillColor(color);
roi.setStrokeColor(color);
roi.setPosition(frame);
roi.setShowLabels(false);
o.add(roi);
}
示例13: overlayRAG
import ij.gui.Overlay; //导入方法依赖的package包/类
private void overlayRAG(Set<LabelPair> adjList, ImagePlus imagePlus, ImagePlus targetPlus)
{
IJ.log("display RAG");
// first compute centroids
ImageProcessor image = imagePlus.getProcessor();
int[] labels = LabelImages.findAllLabels(image);
Map<Integer, Integer> labelMap = LabelImages.mapLabelIndices(labels);
double[][] centroids = GeometricMeasures2D.centroids(image, labels);
// create an overlay for drawing edges
Overlay overlay = new Overlay();
// iterate over adjacencies to add edges to overlay
for (LabelPair pair : adjList)
{
// first retrieve index in centroid array
int ind1 = labelMap.get(pair.label1);
int ind2 = labelMap.get(pair.label2);
// coordinates of edge extremities
int x1 = (int) centroids[ind1][0];
int y1 = (int) centroids[ind1][1];
int x2 = (int) centroids[ind2][0];
int y2 = (int) centroids[ind2][1];
// draw current edge
Roi roi = new Line(x1, y1, x2, y2);
roi.setStrokeColor(Color.GREEN);
roi.setStrokeWidth(2);
overlay.add(roi);
}
targetPlus.setOverlay(overlay);
}
示例14: drawPaths
import ij.gui.Overlay; //导入方法依赖的package包/类
public void drawPaths(ImagePlus target, Map<Integer, List<Point>> pathMap)
{
Overlay overlay = new Overlay();
for (Roi roi : pathListToRoiList(pathMap))
{
roi.setStrokeColor(Color.RED);
overlay.add(roi);
}
target.setOverlay(overlay);
}
示例15: add
import ij.gui.Overlay; //导入方法依赖的package包/类
private void add(Overlay overlay, PointRoi roi, int slice, int frame, Color color)
{
// Tie position to the frame but not the channel or slice
//System.out.printf("Add %d to z=%d,t=%d\n", roi.getNCoordinates(), slice, frame);
roi.setPosition(0, slice, frame);
roi.setStrokeColor(color);
roi.setFillColor(color);
roi.setShowLabels(false);
overlay.add(roi);
}