本文整理汇总了Java中ij.gui.Roi.getPosition方法的典型用法代码示例。如果您正苦于以下问题:Java Roi.getPosition方法的具体用法?Java Roi.getPosition怎么用?Java Roi.getPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.gui.Roi
的用法示例。
在下文中一共展示了Roi.getPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSliceRoi
import ij.gui.Roi; //导入方法依赖的package包/类
/**
* Return a list of ROIs that are active in the given slice, sliceNumber.
* ROIs without a slice number are assumed to be active in all slices.
*
* @param roiMan an instance of {@link RoiManager}
* @param stack a image stack
* @param sliceNumber the number of slice in the stack.
* @return A list of active ROIs on the slice. Returns an empty list if
* roiMan == null or stack == null Returns an empty list if slice
* number is out of bounds
*/
public static ArrayList<Roi> getSliceRoi(final RoiManager roiMan, final ImageStack stack, final int sliceNumber) {
final ArrayList<Roi> roiList = new ArrayList<Roi>();
if (roiMan == null || stack == null) {
return roiList;
}
if (sliceNumber < 1 || sliceNumber > stack.getSize()) {
return roiList;
}
final Roi[] rois = roiMan.getRoisAsArray();
for (final Roi roi : rois) {
final String roiName = roi.getName();
if (roiName == null) {
continue;
}
final int roiSliceNumber = roiMan.getSliceNumber(roiName);
final int roiPosition = roi.getPosition();
if (roiSliceNumber == sliceNumber || roiSliceNumber == NO_SLICE_NUMBER || roiPosition == sliceNumber) {
roiList.add(roi);
}
}
return roiList;
}
示例2: isEndPoint
import ij.gui.Roi; //导入方法依赖的package包/类
/**
* Check if the point is an 'unprotected' end point.
*
* @param point actual point
* @param roi Only points outside this ROI will have end-point status. ROI
* can be associated to a single image in the stack (or all) as
* per {@link ij.gui.Roi#getPosition ij.gui.Roi.getPosition()}
* @return true if the point has end-point status
*/
private boolean isEndPoint(Point point, Roi roi)
{
boolean endPoint = isEndPoint(point);
if (endPoint && roi != null)
{
// Is roi associated with all the images in the ImageStack?
boolean roiContainsZ = (roi.getPosition()==0) ? true : roi.getPosition()==point.z;
// Maintain end-point status only if point lies outside roi boundaries
endPoint = !(roi.contains(point.x, point.y) && roiContainsZ);
}
return endPoint;
}
示例3: extractRoiPoints
import ij.gui.Roi; //导入方法依赖的package包/类
/**
* Extracts the points from the given Point ROI
*
* @param roi
* @return The list of points (can be zero length)
*/
public static AssignedPoint[] extractRoiPoints(Roi roi)
{
AssignedPoint[] roiPoints = null;
if (roi != null && roi.getType() == Roi.POINT)
{
Polygon p = ((PolygonRoi) roi).getNonSplineCoordinates();
int n = p.npoints;
Rectangle bounds = roi.getBounds();
// The ROI has either a hyperstack position or a stack position, but not both.
// Both will be zero if the ROI has no 3D information.
int z = roi.getZPosition();
if (z == 0)
z = roi.getPosition();
roiPoints = new AssignedPoint[n];
for (int i = 0; i < n; i++)
{
roiPoints[i] = new AssignedPoint(bounds.x + p.xpoints[i], bounds.y + p.ypoints[i], z, i);
}
}
else
{
roiPoints = new AssignedPoint[0];
}
return roiPoints;
}