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


Java Roi.POINT属性代码示例

本文整理汇总了Java中ij.gui.Roi.POINT属性的典型用法代码示例。如果您正苦于以下问题:Java Roi.POINT属性的具体用法?Java Roi.POINT怎么用?Java Roi.POINT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在ij.gui.Roi的用法示例。


在下文中一共展示了Roi.POINT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getImageList

private static String[] getImageList()
{
	TurboList<String> newImageList = new TurboList<String>();

	for (int id : Utils.getIDList())
	{
		ImagePlus imp = WindowManager.getImage(id);
		if (imp == null)
			continue;
		if (imp.getNDimensions() != 3)
			continue;
		if (imp.getBitDepth() == 24)
			continue;
		Roi roi = imp.getRoi();
		if (roi == null || roi.getType() != Roi.POINT)
			continue;
		newImageList.add(imp.getTitle());
	}

	return newImageList.toArray(new String[0]);
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:21,代码来源:AstigmatismModelManager.java

示例2: findFitRegion

private boolean findFitRegion()
{
	// Get the centre
	Roi roi = imp.getRoi();
	if (roi != null && roi.getType() == Roi.POINT)
	{
		FloatPolygon p = roi.getFloatPolygon();
		int n = p.npoints;
		if (n != 1)
		{
			IJ.error(TITLE, "Require a single point ROI");
			return false;
		}
		cx = (int) p.xpoints[0];
		cy = (int) p.ypoints[0];
		return true;
	}
	IJ.error(TITLE, "Require a single point ROI");
	return false;
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:20,代码来源:AstigmatismModelManager.java

示例3: setup

public int setup(String arg, ImagePlus imp)
{
	SMLMUsageTracker.recordPlugin(this.getClass(), arg);

	if (imp == null)
	{
		IJ.noImage();
		return DONE;
	}

	Roi roi = imp.getRoi();
	if (roi == null || roi.getType() != Roi.POINT)
	{
		IJ.error("Point ROI required");
		return DONE;
	}

	this.imp = imp;

	return showDialog();
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:21,代码来源:PSFCreator.java

示例4: getSpots

/**
 * @return Extract all the ROI points
 */
private BasePoint[] getSpots()
{
	float z = imp.getStackSize() / 2;
	Roi roi = imp.getRoi();
	if (roi != null && roi.getType() == Roi.POINT)
	{
		FloatPolygon p = roi.getFloatPolygon();
		int n = p.npoints;

		float offset = 0.5f;

		// Check if already float coordinates
		if (!SimpleArrayUtils.isInteger(p.xpoints) || !SimpleArrayUtils.isInteger(p.ypoints))
			offset = 0;

		BasePoint[] roiPoints = new BasePoint[n];
		for (int i = 0; i < n; i++)
		{
			roiPoints[i] = new BasePoint(p.xpoints[i] + offset, p.ypoints[i] + offset, z);
		}
		return roiPoints;
	}
	return new BasePoint[0];
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:27,代码来源:PSFCreator.java

示例5: makePoint

/** Creates a point selection. */
public static void makePoint(int x, int y) {
	ImagePlus img = getImage();
	Roi roi = img.getRoi();
	if (shiftKeyDown() && roi!=null && roi.getType()==Roi.POINT) {
		Polygon p = roi.getPolygon();
		p.addPoint(x, y);
		img.setRoi(new PointRoi(p.xpoints, p.ypoints, p.npoints));
	} else
		img.setRoi(new PointRoi(x, y));
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:11,代码来源:IJJazzOMR.java

示例6: getImage

private boolean getImage()
{
	// Select an image
	GenericDialog gd = new GenericDialog(TITLE);
	String[] list = getImageList();
	if (list.length == 0)
	{
		IJ.error("No suitable images");
		return false;
	}
	gd.addChoice("Image", list, pluginSettings.getImage());
	gd.showDialog();
	if (gd.wasCanceled())
		return false;
	String image = gd.getNextChoice();
	pluginSettings.setImage(image);
	imp = WindowManager.getImage(image);
	if (imp == null)
	{
		IJ.error(TITLE, "Failed to find image: " + image);
		return false;
	}
	Roi roi = imp.getRoi();
	if (roi == null || roi.getType() != Roi.POINT)
	{
		IJ.error("Point ROI required");
		return false;
	}
	return true;
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:30,代码来源:AstigmatismModelManager.java

示例7: killPointRoi

private void killPointRoi(ImagePlus imp)
{
	if (imp != null)
	{
		if (imp.getRoi() != null && imp.getRoi().getType() == Roi.POINT)
		{
			imp.killRoi();
		}
	}
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:10,代码来源:FindFoci.java

示例8: updateImageList

@Override
public void updateImageList()
{
	int noOfImages = WindowManager.getImageCount();
	List<String> imageList = new ArrayList<String>(noOfImages);
	for (int id : gdsc.core.ij.Utils.getIDList())
	{
		ImagePlus imp = WindowManager.getImage(id);

		// Image must be 8-bit/16-bit/32-bit && only contains XYZ dimensions
		if (imp != null && (imp.getType() == ImagePlus.GRAY8 || imp.getType() == ImagePlus.GRAY16 ||
				imp.getType() == ImagePlus.GRAY32) && (imp.getNChannels() == 1 && imp.getNFrames() == 1))
		{
			Roi roi = imp.getRoi();
			if (roi == null || roi.getType() != Roi.POINT)
				continue;

			// Check it is not one the result images
			String imageTitle = imp.getTitle();
			if (!imageTitle.endsWith(FindFoci.TITLE) && !imageTitle.endsWith("clone") &&
					!imageTitle.endsWith(" TP") && !imageTitle.endsWith(" FP") && !imageTitle.endsWith(" FN"))
			{
				imageList.add(imageTitle);
			}
		}
	}

	model.setImageList(imageList);
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:29,代码来源:OptimiserController.java

示例9: extractRoiPoints

/**
 * 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;
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:34,代码来源:PointManager.java

示例10: mouseClicked

public void mouseClicked(MouseEvent e)
{
	setShowOverlay(false);

	Roi roi = activeImp.getRoi();
	if (roi != null && roi.getType() == Roi.POINT)
	{
		PointRoi pointRoi = (PointRoi) roi;
		Polygon p = pointRoi.getNonSplineCoordinates();

		if (p.npoints < currentRoiPoints || p.npoints == 1)
		{
			// The ROI has had a point removed or has been restarted at 1 point

			if (p.npoints == 1)
			{
				// Picking has restarted so allow update 
				manager.resetAssigned();
				assignRoiPoints();
			}
			else
			{
				// This is a removal of a point, all other points should already be located at maxima
				reassignRoiPoints();
			}
		}
		else if (p.npoints > currentRoiPoints)
		{
			mapRoiPoint(pointRoi, p.npoints - 1);
		}
	}
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:32,代码来源:FindFociHelperView.java

示例11: mouseReleased

public void mouseReleased(MouseEvent e)
{
	if (dragging)
	{
		dragging = false;
		Roi roi = activeImp.getRoi();
		if (roi != null && roi.getType() == Roi.POINT && roi.getState() == Roi.NORMAL)
		{
			// Find the image x,y coords
			ImageCanvas ic = activeImp.getCanvas();
			int ox = ic.offScreenX(e.getX());
			int oy = ic.offScreenY(e.getY());

			//logMessage("Dropped coords " + ox + "," + oy);

			int index = findRoiPointIndex((PointRoi) roi, ox, oy);

			if (index >= 0)
			{
				if (assignDragged)
				{
					mapRoiPoint((PointRoi) roi, index);
				}
				else
				{
					addRoiPoint((PointRoi) roi, index);
				}
			}
		}
	}
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:31,代码来源:FindFociHelperView.java

示例12: showOverlay

/**
 * Adds the mapped/unmapped points to the image using an overlay
 */
private void showOverlay()
{
	// Build lists of the mapped and unmapped points
	AssignedPoint[] points = getRoiPoints();

	List<AssignedPoint> mapped = new LinkedList<AssignedPoint>();
	List<AssignedPoint> unmapped = new LinkedList<AssignedPoint>();
	for (AssignedPoint p : points)
	{
		if (p.getAssignedId() < 0)
			unmapped.add(p);
		else
			mapped.add(p);
	}

	// Add the overlay
	activeImp.setOverlay(null);
	MatchPlugin.addOverlay(activeImp, mapped, Color.green);
	MatchPlugin.addOverlay(activeImp, unmapped, Color.yellow);

	// Save the ROI and remove it
	savedRoi = activeImp.getRoi();
	if (savedRoi != null && savedRoi.getType() != Roi.POINT)
	{
		savedRoi = null;
	}
	activeImp.killRoi();
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:31,代码来源:FindFociHelperView.java

示例13: hideOverlay

/**
 * Hides the overlay and restores the ROI
 */
private void hideOverlay()
{
	// Kill the overlay
	activeImp.setOverlay(null);

	Roi roi = activeImp.getRoi();
	if (roi != null)
	{
		// If this is a new point then merge it into the saved Point ROI
		if (roi.getType() == Roi.POINT && savedRoi != null)
		{
			// Merge the current ROI and the saved one
			PointRoi pointRoi = (PointRoi) savedRoi;
			AssignedPoint[] newPoints = PointManager.extractRoiPoints(roi);
			for (AssignedPoint p : newPoints)
			{
				//pointRoi = pointRoi.addPoint(p.getX() - pointRoi.getBounds().x, p.getY() - pointRoi.getBounds().y);
				pointRoi = pointRoi.addPoint(p.getX(), p.getY());
			}
			activeImp.setRoi(pointRoi, true);
		}
	}
	else
	{
		// No new ROI so just restore from the old one 
		activeImp.restoreRoi();
	}

	savedRoi = null;
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:33,代码来源:FindFociHelperView.java

示例14: showDialog

private boolean showDialog()
{
	// To improve the flexibility, do not restrict the mask to those suitable for the image. Allow any image for the mask.
	//ArrayList<String> newImageList = FindFoci.buildMaskList(imp);
	//String[] list = newImageList.toArray(new String[0]);
	String[] list = Utils.getImageList(Utils.NO_IMAGE, null);

	GenericDialog gd = new GenericDialog(TITLE);

	gd.addMessage("Extracts the ROI points to file");
	gd.addChoice("Mask", list, mask);
	gd.addStringField("Filename", filename, 30);
	if (imp != null)
		gd.addCheckbox("xyz_only", xyz);

	if (isManagerAvailable())
	{
		gd.addMessage(String.format("%s (%s) present in the ROI manager",
				TextUtils.pleural(nPointRois(), "ROI"), TextUtils.pleural(nPoints(), "point")));
		gd.addCheckbox("Use_manager_ROIs", useManager);
		gd.addCheckbox("Reset_manager", reset);
	}
	else
	{
		Roi roi = imp.getRoi();
		if (roi == null || roi.getType() != Roi.POINT)
		{
			gd.addMessage("Warning: The image does not contain Point ROI.\nAn empty result file will be produced");
		}
	}

	gd.showDialog();

	if (gd.wasCanceled())
		return false;

	mask = gd.getNextChoice();
	filename = gd.getNextString();
	if (imp != null)
		xyz = gd.getNextBoolean();

	if (isManagerAvailable())
	{
		useManager = gd.getNextBoolean();
		reset = gd.getNextBoolean();
	}

	return true;
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:49,代码来源:PointExtractorPlugin.java

示例15: mouseDragged

public void mouseDragged(MouseEvent e)
{
	setShowOverlay(false);

	Roi roi = activeImp.getRoi();
	if (roi != null && roi.getType() == Roi.POINT && roi.getState() == Roi.MOVING_HANDLE)
	{
		if (!dragging)
		{
			dragging = true;

			// Find the image x,y coords
			ImageCanvas ic = activeImp.getCanvas();
			int ox = ic.offScreenX(e.getX());
			int oy = ic.offScreenY(e.getY());

			//logMessage("Image coords " + ox + "," + oy);

			// Check if an assigned point is being moved
			GridPoint movedPoint = manager.findClosestAssignedPoint(ox, oy);

			double mag = activeImp.getCanvas().getMagnification();

			// Distance for the ROI is dependent on magnification.  
			// Approximate distance for mouse to change from cross to finger in X/Y:
			// 50% = 10px
			// 100% = 5px
			// 200% = 2px 
			// Given that the drag could move away from the current ROI centre a bit more 
			// tolerance could be added if this limit is too strict.
			int distanceLimit = (int) Math.ceil(5 / mag);

			// Check the point is within reasonable distance of the mouse
			if (movedPoint != null && Math.abs(movedPoint.getX() - ox) <= distanceLimit &&
					Math.abs(movedPoint.getY() - oy) <= distanceLimit)
			{
				//logMessage("Dragging point " + movedPoint.getX() + "," + movedPoint.getY());
				movedPoint.setAssigned(false);
				setMappedPoints(mappedPoints - 1);
			}
			else
			{
				setUnmappedPoints(unmappedPoints - 1);
			}
		}
	}
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:47,代码来源:FindFociHelperView.java


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