ij.gui.TextRoi Java Examples

The following examples show how to use ij.gui.TextRoi. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DrawTableValuesPlugin.java    From MorphoLibJ with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void drawValues(ImagePlus target)
	{
	    Overlay overlay = new Overlay();
//	    Calibration calib = target.getCalibration();
	    
        double[] xPos = getColumnValues(this.table, this.xPosHeaderName);
        double[] yPos = getColumnValues(this.table, this.yPosHeaderName);
        if (this.calibratedPosition)
        {
            Calibration calib = target.getCalibration();
            for (int i = 0; i < xPos.length; i++)
            {
                xPos[i] = xPos[i] * calib.pixelWidth  + calib.xOrigin;
                yPos[i] = yPos[i] * calib.pixelHeight + calib.yOrigin;
            }
        }
            
        double[] values = getColumnValues(this.table, this.valueHeaderName);

        for (int i = 0; i < xPos.length; i++)
        {
            Roi roi = new TextRoi(
                    xPos[i] + this.xOffset,
                    yPos[i] + this.yOffset,
                    String.format(this.pattern,  values[i]));
            overlay.add(roi);
        }

	    target.setOverlay(overlay);
	}
 
Example #2
Source File: DLabel.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
public DLabel(final Project project, final String text, final double x, final double y) {
	super(project, text, x, y);
	this.type = TEXT; // default
	this.width = 1;
	this.height = 1;
	this.font = new Font(TextRoi.getFont(), TextRoi.getStyle(), TextRoi.getSize());
	addToDatabase();
}