本文整理汇总了Java中ij.gui.Overlay类的典型用法代码示例。如果您正苦于以下问题:Java Overlay类的具体用法?Java Overlay怎么用?Java Overlay使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Overlay类属于ij.gui包,在下文中一共展示了Overlay类的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: addRoi
import ij.gui.Overlay; //导入依赖的package包/类
public static void addRoi(ImagePlus imp, int slice, PointRoi roi)
{
if (imp != null && slice > 0 && slice <= imp.getStackSize())
{
imp.setSlice(slice);
if (imp.getWindow() != null)
imp.getWindow().toFront();
if (roi != null)
{
//imp.setRoi(roi);
if (imp.getStackSize() > 1)
roi.setPosition(slice);
Overlay o = new Overlay(roi);
o.setStrokeColor(Color.green);
imp.setOverlay(o);
}
else
{
imp.setOverlay(null);
}
}
}
示例7: Worker
import ij.gui.Overlay; //导入依赖的package包/类
/**
* Instantiates a new worker.
*
* @param jobs
* the jobs
* @param stack
* the stack
* @param actualCoordinates
* the actual coordinates
* @param fitConfig
* the fit config
* @param maxCount
* the max count
* @param o
* the o
*/
public Worker(BlockingQueue<Integer> jobs, ImageStack stack,
TIntObjectHashMap<ArrayList<Coordinate>> actualCoordinates, FitConfiguration fitConfig, Overlay o)
{
this.jobs = jobs;
this.stack = stack;
this.actualCoordinates = actualCoordinates;
this.fitConfig = fitConfig.clone();
this.gf = new Gaussian2DFitter(this.fitConfig);
this.spotFilter = config.createSpotFilter();
this.relativeIntensity = !spotFilter.isAbsoluteIntensity();
fitting = config.getFittingWidth();
// Fit window is 2*fitting+1. The distance limit is thus 0.5 pixel higher than fitting.
limit = fitting + 0.5;
spotHistogram = new int[20];
resultHistogram = new int[spotHistogram.length];
neighbourHistogram = new int[3][spotHistogram.length];
almostNeighbourHistogram = new int[3][spotHistogram.length];
this.o = o;
rampedScore = new RampedScore(lowerDistance, matchDistance);
if (signalFactor > 0)
signalScore = new RampedScore(lowerSignalFactor, signalFactor);
}
示例8: 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);
}
}
示例9: doProjection
import ij.gui.Overlay; //导入依赖的package包/类
/** Performs actual projection using specified method. If handleOverlay,
adds stack overlay elements from startSlice to stopSlice to projection*/
public void doProjection(boolean handleOverlay) {
doProjection();
Overlay overlay = imp.getOverlay();
if (handleOverlay && overlay!=null)
projImage.setOverlay(projectStackRois(overlay));
}
示例10: doProjection
import ij.gui.Overlay; //导入依赖的package包/类
/** Performs actual projection using specified method. If handleOverlay,
adds stack overlay elements from startSlice to stopSlice to projection*/
public void doProjection(boolean handleOverlay) {
doProjection();
Overlay overlay = imp.getOverlay();
if (handleOverlay && overlay!=null)
projImage.setOverlay(projectStackRois(overlay));
}
示例11: run
import ij.gui.Overlay; //导入依赖的package包/类
@Override
public void run(String arg) {
ImagePlus imp = IJ.getImage();
if (imp == null)
return;
Overlay overlay = imp.getOverlay();
if (overlay == null || overlay.size() == 0) {
IJ.showMessage("No overlay found!");
return;
}
QuPathGUI gui = QuPathGUI.getInstance();
if (gui == null) {
IJ.showMessage("QuPath viewer not found!");
return;
}
GenericDialog gd = new GenericDialog("Send overlay to QuPath");
gd.addChoice("Choose_object_type", new String[]{"Annotation", "Detection"}, "Detection");
gd.addCheckbox("Include_measurements", false);
gd.showDialog();
if (gd.wasCanceled())
return;
typeChoice = gd.getNextChoice();
boolean asDetection = "Detection".equals(typeChoice);
includeMeasurements = gd.getNextBoolean();
QuPathViewer viewer = gui.getViewer();
ImageServer<BufferedImage> server = viewer.getServer();
double downsample = IJTools.estimateDownsampleFactor(imp, server);
PathObjectHierarchy hierarchy = gui.getViewer().getHierarchy();
List<PathObject> pathObjects = createPathObjectsFromROIs(imp, overlay.toArray(), server, downsample, asDetection, includeMeasurements, -1, viewer.getZPosition(), viewer.getTPosition());
if (!pathObjects.isEmpty()) {
Platform.runLater(() -> hierarchy.addPathObjects(pathObjects, true));
}
}
示例12: addPointsToOverlay
import ij.gui.Overlay; //导入依赖的package包/类
public static Overlay addPointsToOverlay(double[] xCoord, double[] yCoord, Overlay overlay, int slice, Color c, int markerType) {
assert xCoord.length == yCoord.length;
float[] xs = new float[xCoord.length];
float[] ys = new float[yCoord.length];
for(int i = 0; i < xCoord.length; i++) {
xs[i] = (float) xCoord[i];
ys[i] = (float) yCoord[i];
}
overlay.add(new MultiplePointsRoi(xs, ys, slice, c, markerType));
return overlay;
}
示例13: 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;
}
示例14: 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);
}
示例15: 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);
}