当前位置: 首页>>代码示例>>Java>>正文


Java PointRoi.getBounds方法代码示例

本文整理汇总了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;
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:17,代码来源:FindFociHelperView.java

示例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;
	}
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:45,代码来源:FindFociHelperView.java

示例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;
	}
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:20,代码来源:FindFociHelperView.java

示例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));
		}			
	}

}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:55,代码来源:MiscTools.java

示例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);
	}

}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:50,代码来源:MainDialog.java


注:本文中的ij.gui.PointRoi.getBounds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。