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


Java NewImage.FILL_BLACK属性代码示例

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


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

示例1: createImage

/** Creates a new imagePlus. <code>Type</code> should contain "8-bit", "16-bit", "32-bit" or "RGB". 
	 In addition, it can contain "white", "black" or "ramp" (the default is "white"). <code>Width</code> 
 	and <code>height</code> specify the width and height of the image in pixels.  
 	<code>Depth</code> specifies the number of stack slices. */
 public static ImagePlus createImage(String title, String type, int width, int height, int depth) {
	type = type.toLowerCase(Locale.US);
	int bitDepth = 8;
	if (type.indexOf("16")!=-1) bitDepth = 16;
	if (type.indexOf("24")!=-1||type.indexOf("rgb")!=-1) bitDepth = 24;
	if (type.indexOf("32")!=-1) bitDepth = 32;
	int options = NewImage.FILL_WHITE;
	if (bitDepth==16 || bitDepth==32)
		options = NewImage.FILL_BLACK;
	if (type.indexOf("white")!=-1)
		options = NewImage.FILL_WHITE;
	else if (type.indexOf("black")!=-1)
		options = NewImage.FILL_BLACK;
	else if (type.indexOf("ramp")!=-1)
		options = NewImage.FILL_RAMP;
	options += NewImage.CHECK_AVAILABLE_MEMORY;
	return NewImage.createImage(title, width, height, depth, bitDepth, options);
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:22,代码来源:IJJazzOMR.java

示例2: produceNoiseImage

/**
 * Creates a noisy image that is created by repeatedly adding points
 * with random intensity to the canvas. That way it tries to mimic the
 * way a microscope produces images.
 *
 * @param <T> The wanted output type.
 * @param width The image width.
 * @param height The image height.
 * @param dotSize The size of the dots.
 * @param numDots The number of dots.
 * @param smoothingSigma The two dimensional sigma for smoothing.
 * @return The noise image.
 */
public static <T extends RealType<T> & NativeType<T>> RandomAccessibleInterval<T> produceNoiseImage(int width,
		int height, float dotSize, int numDots) {
	/* For now (probably until ImageJ2 is out) we use an
	 * ImageJ image to draw circles.
	 */
	int options = NewImage.FILL_BLACK + NewImage.CHECK_AVAILABLE_MEMORY;
        ImagePlus img = NewImage.createByteImage("Noise", width, height, 1, options);
	ImageProcessor imp = img.getProcessor();

	float dotRadius = dotSize * 0.5f;
	int dotIntSize = (int) dotSize;

	for (int i=0; i < numDots; i++) {
		int x = (int) (Math.random() * width - dotRadius);
		int y = (int) (Math.random() * height - dotRadius);
		imp.setColor(Color.WHITE);
		imp.fillOval(x, y, dotIntSize, dotIntSize);
	}
	// we changed the data, so update it
	img.updateImage();
	// create the new image
	RandomAccessibleInterval<T> noiseImage = ImagePlusAdapter.wrap(img);

	return noiseImage;
}
 
开发者ID:fiji,项目名称:Colocalisation_Analysis,代码行数:38,代码来源:TestImageAccessor.java

示例3: createRectengularMaskImage

/**
 * Creates a mask image with a black background and a white
 * rectangular foreground.
 *
 * @param width The width of the result image.
 * @param height The height of the result image.
 * @param offset The offset of the rectangular mask.
 * @param size The size of the rectangular mask.
 * @return A black image with a white rectangle on it.
 */
public static <T extends RealType<T> & NativeType<T>> RandomAccessibleInterval<T> createRectengularMaskImage(
		long width, long height, long[] offset, long[] size) {
	/* For now (probably until ImageJ2 is out) we use an
	 * ImageJ image to draw lines.
	 */
	int options = NewImage.FILL_BLACK + NewImage.CHECK_AVAILABLE_MEMORY;
        ImagePlus img = NewImage.createByteImage("Noise", (int)width, (int)height, 1, options);
	ImageProcessor imp = img.getProcessor();
	imp.setColor(Color.WHITE);
	Roi rect = new Roi(offset[0], offset[1], size[0], size[1]);

	imp.fill(rect);
	// we changed the data, so update it
	img.updateImage();

	return ImagePlusAdapter.wrap(img);
}
 
开发者ID:fiji,项目名称:Colocalisation_Analysis,代码行数:27,代码来源:TestImageAccessor.java

示例4: produceSticksNoiseImage

/**
 * This method creates a noise image that is made of many little
 * sticks oriented in a random direction. How many of them and
 * what the length of them are can be specified.
 *
 * @return a new noise image that is not smoothed
 */
public static <T extends RealType<T> & NativeType<T>> RandomAccessibleInterval<T> produceSticksNoiseImage(int width,
		int height, int numSticks, int lineWidth, double maxLength) {
	/* For now (probably until ImageJ2 is out) we use an
	 * ImageJ image to draw lines.
	 */
	int options = NewImage.FILL_BLACK + NewImage.CHECK_AVAILABLE_MEMORY;
        ImagePlus img = NewImage.createByteImage("Noise", width, height, 1, options);
	ImageProcessor imp = img.getProcessor();
	imp.setColor(Color.WHITE);
	imp.setLineWidth(lineWidth);

	for (int i=0; i < numSticks; i++) {
		// find random starting point
		int x = (int) (Math.random() * width);
		int y = (int) (Math.random() * height);
		// create random stick length and direction
		double length = Math.random() * maxLength;
		double angle = Math.random() * 2 * Math.PI;
		// calculate random point on circle, for the direction
		int destX = x + (int) (length * Math.cos(angle));
		int destY = y + (int) (length * Math.sin(angle));
		// now draw the line
		imp.drawLine(x, y, destX, destY);
	}
	// we changed the data, so update it
	img.updateImage();

	return ImagePlusAdapter.wrap(img);
}
 
开发者ID:fiji,项目名称:Colocalisation_Analysis,代码行数:36,代码来源:TestImageAccessor.java


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