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


Java Roi.RECTANGLE属性代码示例

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


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

示例1: fillOutside

/**
	 * Fill in a region outside a specified ROI
	 * @param ip
	 * @param roi
	 */
	public static void fillOutside(ImageProcessor ip, Roi roi, double value) {
		// Check we don't have a full rectangle
		if (roi.getType() == Roi.RECTANGLE && roi.getBounds().equals(new Rectangle(0, 0, ip.getWidth(), ip.getHeight())))
			return;
//		if (roi instanceof ShapeRoi) {
			// Appears to be a bug with ShapeRois so that filling outside can fail using ImageJ's own code
			ByteProcessor bpMask = new ByteProcessor(ip.getWidth(), ip.getHeight());
			bpMask.setValue(1);
			bpMask.fill(roi);
			if (value == 0)
				ip.copyBits(bpMask, 0, 0, Blitter.MULTIPLY);
			else {
				float floatValue = (float)value;
				byte[] px = (byte[])bpMask.getPixels();
				for (int i = 0; i < px.length; i++) {
					if (px[i] == (byte)0)
						ip.setf(i, floatValue);
				}
			}
//		} else {
//			ip.setValue(value);
//			ip.fillOutside(roi);
//		}
	}
 
开发者ID:qupath,项目名称:qupath,代码行数:29,代码来源:ROILabeling.java

示例2: convertToPathROI

/**
	 * Create a ROI from an ImageJ Roi.
	 * 
	 * @param pathROI
	 * @param pathImage
	 * @return
	 */
	public static ROI convertToPathROI(Roi roi, Calibration cal, double downsampleFactor, final int c, final int z, final int t) {
//		if (roi.getType() == Roi.POLYGON || roi.getType() == Roi.TRACED_ROI)
//			return convertToPolygonROI((PolygonRoi)roi, cal, downsampleFactor);
		if (roi.getType() == Roi.RECTANGLE && roi.getCornerDiameter() == 0)
			return getRectangleROI(roi, cal, downsampleFactor, c, z, t);
		if (roi.getType() == Roi.OVAL)
			return convertToEllipseROI(roi, cal, downsampleFactor, c, z, t);
		if (roi instanceof Line)
			return convertToLineROI((Line)roi, cal, downsampleFactor, c, z, t);
		if (roi instanceof PointRoi)
			return convertToPointROI((PolygonRoi)roi, cal, downsampleFactor, c, z, t);
//		if (roi instanceof ShapeRoi)
//			return convertToAreaROI((ShapeRoi)roi, cal, downsampleFactor);
//		// Shape ROIs should be able to handle most eventualities
		if (roi instanceof ShapeRoi)
			return convertToAreaROI((ShapeRoi)roi, cal, downsampleFactor, c, z, t);
		if (roi.isArea())
			return convertToPolygonOrAreaROI(roi, cal, downsampleFactor, c, z, t);
		// TODO: Integrate ROI not supported exception...?
		return null;	
	}
 
开发者ID:qupath,项目名称:qupath,代码行数:28,代码来源:ROIConverterIJ.java

示例3: writeOverlay

/** Write an overlay, if supported */
private void writeOverlay(
        XMLStreamWriter xsw,
        Roi roi) 
        throws SlideSetException {
    if(roi instanceof Line)
        writeLine(xsw, (Line) roi);
    else if(roi instanceof OvalRoi)
        writeOvalRoi(xsw, (OvalRoi) roi);
    else if(roi instanceof PointRoi)
        writePointRoi(xsw, (PointRoi) roi);
    else if(roi instanceof PolygonRoi)
        writePolygonRoi(xsw, (PolygonRoi) roi);
    else if(roi instanceof ShapeRoi)
        writeShapeRoi(xsw, (ShapeRoi) roi);
    else if(roi.getType() == Roi.RECTANGLE)
        writeRectangle(xsw, roi);
    else
        throw new UnsupportedOverlayException(
                "Unsupported ROI type: " 
                + roi.getClass().getName());
}
 
开发者ID:bnanes,项目名称:slideset,代码行数:22,代码来源:IJ1ROIsToSVGFileWriter.java

示例4: 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.RECTANGLE)
	{
		IJ.error("Rectangular ROI required");
		return DONE;
	}

	this.imp = imp;
	if (arg.equals("final"))
	{
		runFinal(imp.getProcessor());
		return DONE;
	}

	return flags;
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:26,代码来源:GaussianFit.java

示例5: 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.RECTANGLE)
	{
		IJ.error("Rectangular ROI required");
		return DONE;
	}

	return flags;
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:19,代码来源:SpotFinderPreview.java

示例6: setup

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

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

	settings = SettingsManager.readPSFEstimatorSettings(0).toBuilder();
	// Reset
	if (IJ.controlKeyDown())
	{
		config = new FitEngineConfiguration();
		Calibration calibration = SettingsManager.readCalibration(0);
		config.getFitConfiguration().setCalibration(calibration);
	}
	else
	{
		config = SettingsManager.readFitEngineConfiguration(0);
	}

	Roi roi = imp.getRoi();
	if (roi != null && roi.getType() != Roi.RECTANGLE)
	{
		IJ.error("Rectangular ROI required");
		return DONE;
	}

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

示例7: setup

public int setup(String arg, ImagePlus imp)
{
	if (arg.equals("final"))
	{
		//imp.resetDisplayRange();
		imp.updateAndDraw();

		return DONE;
	}

	SMLMUsageTracker.recordPlugin(this.getClass(), arg);

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

	Roi roi = imp.getRoi();
	if (roi != null && roi.getType() != Roi.RECTANGLE)
	{
		IJ.error("Rectangular ROI required");
		return DONE;
	}

	return flags;
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:27,代码来源:SmoothImage.java

示例8: checkRoi

private boolean checkRoi(ImagePlus imp1, ImagePlus imp2)
{
	boolean img1HasROI, img2HasROI;

	if (imp1.getRoi() != null)
		img1HasROI = true;
	else
		img1HasROI = false;

	if (imp2.getRoi() != null)
		img2HasROI = true;
	else
		img2HasROI = false;

	if (img1HasROI && !img2HasROI || img2HasROI && !img1HasROI)
	{
		IJ.error("Eigher both images should have a ROI or none of them.");

		return false;
	}

	if (img1HasROI)
	{
		int type1 = imp1.getRoi().getType();
		int type2 = imp2.getRoi().getType();

		if (type1 != Roi.RECTANGLE)
		{
			IJ.error(imp1.getTitle() + " has a ROI which is no rectangle.");
		}

		if (type2 != Roi.RECTANGLE)
		{
			IJ.error(imp2.getTitle() + " has a ROI which is no rectangle.");
		}
	}

	return true;
}
 
开发者ID:fiji,项目名称:Stitching,代码行数:39,代码来源:Stitching_2D.java

示例9: checkRoi

private boolean checkRoi(ImagePlus imp1, ImagePlus imp2)
{
	boolean img1HasROI, img2HasROI;

	if (imp1.getRoi() != null) img1HasROI = true;
	else img1HasROI = false;

	if (imp2.getRoi() != null) img2HasROI = true;
	else img2HasROI = false;

	if (img1HasROI && !img2HasROI || img2HasROI && !img1HasROI)
	{
		IJ.error("Either both images should have a ROI or none of them.");
		return false;
	}

	if (img1HasROI)
	{
		int type1 = imp1.getRoi().getType();
		int type2 = imp2.getRoi().getType();

		if (type1 != Roi.RECTANGLE)
		{
			IJ.error(imp1.getTitle() + " has a ROI which is no rectangle.");
		}

		if (type2 != Roi.RECTANGLE)
		{
			IJ.error(imp2.getTitle() + " has a ROI which is no rectangle.");
		}
	}

	return true;
}
 
开发者ID:fiji,项目名称:Stitching,代码行数:34,代码来源:Stitching_3D.java

示例10: getOnlyRectangularRoi

protected static Roi getOnlyRectangularRoi( Roi roi )
{
	// we can only do rectangular rois
	if ( roi != null && roi.getType() != Roi.RECTANGLE )
		return null;
	return roi;
}
 
开发者ID:fiji,项目名称:Stitching,代码行数:7,代码来源:PairWiseStitchingImgLib.java

示例11: mouseReleased

@Override
public void mouseReleased( final MouseEvent e )
{
	// here the ROI might have been modified, let's test for that
	final Roi roi = imp.getRoi();
	
	if ( roi == null || roi.getType() != Roi.RECTANGLE )
		return;
	
	while ( isComputing )
		SimpleMultiThreading.threadWait( 10 );
	
	updatePreview( ValueChange.ROI );				
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:14,代码来源:InteractiveDoG.java

示例12: run

@Override
public void run( String arg )
{
	if ( imp == null )
		imp = WindowManager.getCurrentImage();
	
	standardRectangle = new Rectangle( imp.getWidth()/4, imp.getHeight()/4, imp.getWidth()/2, imp.getHeight()/2 );
	
	if ( imp.getType() == ImagePlus.COLOR_RGB || imp.getType() == ImagePlus.COLOR_256 )
	{			
		IJ.log( "Color images are not supported, please convert to 8, 16 or 32-bit grayscale" );
		return;
	}
	
	Roi roi = imp.getRoi();
	
	if ( roi == null )
	{
		//IJ.log( "A rectangular ROI is required to define the area..." );
		imp.setRoi( standardRectangle );
		roi = imp.getRoi();
	}
	
	if ( roi.getType() != Roi.RECTANGLE )
	{
		IJ.log( "Only rectangular rois are supported..." );
		return;
	}
	
	// copy the ImagePlus into an ArrayImage<FloatType> for faster access
	source = convertToFloat( imp, channel, 0, minIntensityImage, maxIntensityImage );
	
	// show the interactive kit
	displaySliders();

	// add listener to the imageplus slice slider
	sliceObserver = new SliceObserver( imp, new ImagePlusListener() );

	// compute first version
	updatePreview( ValueChange.ALL );		
	isStarted = true;
	
	// check whenever roi is modified to update accordingly
	roiListener = new RoiListener();
	imp.getCanvas().addMouseListener( roiListener );
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:46,代码来源:InteractiveDoG.java


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