本文整理汇总了Java中ij.gui.PointRoi.getBounds方法的典型用法代码示例。如果您正苦于以下问题:Java PointRoi.getBounds方法的具体用法?Java PointRoi.getBounds怎么用?Java PointRoi.getBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.gui.PointRoi
的用法示例。
在下文中一共展示了PointRoi.getBounds方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findRoiPointIndex
import ij.gui.PointRoi; //导入方法依赖的package包/类
private int findRoiPointIndex(PointRoi roi, int ox, int oy)
{
Polygon p = ((PolygonRoi) roi).getNonSplineCoordinates();
int n = p.npoints;
Rectangle bounds = roi.getBounds();
for (int i = 0; i < n; i++)
{
int x = bounds.x + p.xpoints[i];
int y = bounds.y + p.ypoints[i];
if (x == ox && y == oy)
return i;
}
return -1;
}
示例2: mapRoiPoint
import ij.gui.PointRoi; //导入方法依赖的package包/类
/**
* Maps the given roi point to the highest unassigned grid point using the GridPointManager
*
* @param roi
* @param roiIndex
*/
private void mapRoiPoint(PointRoi roi, int roiIndex)
{
synchronized (updatingPointsLock)
{
Polygon p = ((PolygonRoi) roi).getNonSplineCoordinates();
Rectangle bounds = roi.getBounds();
int x = bounds.x + p.xpoints[roiIndex];
int y = bounds.y + p.ypoints[roiIndex];
GridPoint gridPoint = manager.findUnassignedPoint(x, y);
if (gridPoint != null)
{
addMappedPoint(x, y, gridPoint, roiIndex + 1);
// Update the ROI if the peak was re-mapped
// First update the existing points using the current bounds
for (int i = 0; i < p.npoints; i++)
{
if (i != roiIndex)
{
p.xpoints[i] += bounds.x;
p.ypoints[i] += bounds.y;
}
}
// Add the new position
p.xpoints[roiIndex] = gridPoint.getXint();
p.ypoints[roiIndex] = gridPoint.getYint();
activeImp.setRoi(new PointRoi(p.xpoints, p.ypoints, p.npoints));
}
else
{
addUnmappedPoint(x, y, roiIndex + 1);
}
currentRoiPoints = p.npoints;
}
}
示例3: addRoiPoint
import ij.gui.PointRoi; //导入方法依赖的package包/类
/**
* Add the given roi point without mapping
*
* @param roi
* @param roiIndex
*/
private void addRoiPoint(PointRoi roi, int roiIndex)
{
synchronized (updatingPointsLock)
{
Polygon p = ((PolygonRoi) roi).getNonSplineCoordinates();
Rectangle bounds = roi.getBounds();
int x = bounds.x + p.xpoints[roiIndex];
int y = bounds.y + p.ypoints[roiIndex];
addUnmappedPoint(x, y, roiIndex + 1);
currentRoiPoints = p.npoints;
}
}
示例4: loadPointRoiAsLandmarks
import ij.gui.PointRoi; //导入方法依赖的package包/类
/**
* Load point rois in the source and target images as landmarks.
*
* @param sourceImp source image plus
* @param targetImp target image plus
* @param sourceStack stack of source related points (output)
* @param targetStack stack of target related points (output)
*/
public static void loadPointRoiAsLandmarks(ImagePlus sourceImp,
ImagePlus targetImp,
Stack <Point> sourceStack,
Stack <Point> targetStack)
{
Roi roiSource = sourceImp.getRoi();
Roi roiTarget = targetImp.getRoi();
if(roiSource instanceof PointRoi && roiTarget instanceof PointRoi)
{
PointRoi prSource = (PointRoi) roiSource;
int[] xSource = prSource.getXCoordinates();
PointRoi prTarget = (PointRoi) roiTarget;
int[] xTarget = prTarget.getXCoordinates();
int numOfPoints = xSource.length;
// If the number of points in both images is not the same,
// we do nothing.
if(numOfPoints != xTarget.length)
return;
// Otherwise we load the points in order as landmarks.
int[] ySource = prSource.getYCoordinates();
int[] yTarget = prTarget.getYCoordinates();
// The coordinates from the point rois are relative to the
// bounding box origin.
Rectangle recSource = prSource.getBounds();
int originXSource = recSource.x;
int originYSource = recSource.y;
Rectangle recTarget = prTarget.getBounds();
int originXTarget = recTarget.x;
int originYTarget = recTarget.y;
for(int i = 0; i < numOfPoints; i++)
{
sourceStack.push(new Point(xSource[i] + originXSource, ySource[i] + originYSource));
targetStack.push(new Point(xTarget[i] + originXTarget, yTarget[i] + originYTarget));
}
}
}
示例5: loadPointRoiAsLandmarks
import ij.gui.PointRoi; //导入方法依赖的package包/类
/**
* Load point rois in the source and target images as landmarks.
*/
private void loadPointRoiAsLandmarks()
{
Roi roiSource = this.previousSourceRoi = sourceImp.getRoi();
Roi roiTarget = this.previousTargetRoi = targetImp.getRoi();
if(roiSource instanceof PointRoi && roiTarget instanceof PointRoi)
{
PointRoi prSource = (PointRoi) roiSource;
int[] xSource = prSource.getXCoordinates();
PointRoi prTarget = (PointRoi) roiTarget;
int[] xTarget = prTarget.getXCoordinates();
int numOfPoints = xSource.length;
// If the number of points in both images is not the same,
// we do nothing.
if(numOfPoints != xTarget.length)
return;
// Otherwise we load the points in order as landmarks.
int[] ySource = prSource.getYCoordinates();
int[] yTarget = prTarget.getYCoordinates();
// The coordinates from the point rois are relative to the
// bounding box origin.
Rectangle recSource = prSource.getBounds();
int originXSource = recSource.x;
int originYSource = recSource.y;
Rectangle recTarget = prTarget.getBounds();
int originXTarget = recTarget.x;
int originYTarget = recTarget.y;
for(int i = 0; i < numOfPoints; i++)
{
sourcePh.addPoint(xSource[i] + originXSource, ySource[i] + originYSource);
targetPh.addPoint(xTarget[i] + originXTarget, yTarget[i] + originYTarget);
}
sourceImp.setRoi(sourcePh);
targetImp.setRoi(targetPh);
}
}