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


Java NewImage.createImage方法代码示例

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


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

示例1: testNullROIManagerCancelsPlugin

import ij.gui.NewImage; //导入方法依赖的package包/类
@Test
public void testNullROIManagerCancelsPlugin() throws Exception {
	// SETUP
	final UserInterface mockUI = CommonWrapperTests.mockUIService(IMAGE_J);
	final ImagePlus imagePlus = NewImage.createImage("", 5, 5, 5, 8, 1);

	// EXECUTE
	final CommandModule module = IMAGE_J.command().run(
		FitEllipsoidWrapper.class, true, "inputImage", imagePlus).get();

	// VERIFY
	assertTrue("No ROI Manager should have cancelled the plugin", module
		.isCanceled());
	assertTrue("Cancel reason is incorrect", module.getCancelReason()
		.startsWith("Please populate ROI Manager with at least " +
			QUADRIC_TERMS));
	verify(mockUI, timeout(1000)).dialogPrompt(anyString(), anyString(), any(),
		any());
   }
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:20,代码来源:FitEllipsoidWrapperTest.java

示例2: testRun

import ij.gui.NewImage; //导入方法依赖的package包/类
@Test
public void testRun() throws Exception {
	// SETUP
	final String expectedTitle = "Skeleton of Test";
	final ImagePlus imagePlus = NewImage.createImage("Test", 5, 5, 5, 8, 1);
	final Calibration calibration = new Calibration();
	calibration.setUnit("my unit");
	imagePlus.setCalibration(calibration);

	// EXECUTE
	final CommandModule module = IMAGE_J.command().run(SkeletoniseWrapper.class,
		true, "inputImage", imagePlus).get();

	// VERIFY
	final ImagePlus skeleton = (ImagePlus) module.getOutput("skeleton");
	assertNotNull("Skeleton image should not be null", skeleton);
	assertEquals("Skeleton has wrong title", expectedTitle, skeleton
		.getTitle());
	assertEquals("Skeleton should have same calibration", "my unit", skeleton
		.getCalibration().getUnit());
       assertNotSame("Original image should not have been overwritten",
		imagePlus, skeleton);
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:24,代码来源:SkeletoniseWrapperTest.java

示例3: createImage

import ij.gui.NewImage; //导入方法依赖的package包/类
/** 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,代码行数:23,代码来源:IJJazzOMR.java

示例4: showRegions

import ij.gui.NewImage; //导入方法依赖的package包/类
/**
 * Show new images using only pixels within the bounds of the given thresholds
 * 
 * @param mlevel
 *            The number of thresholds
 * @param t
 *            The thresholds
 * @param imp
 *            The image
 */
public void showRegions(int mlevel, int[] t, ImagePlus imp)
{
	int width = imp.getWidth();
	int height = imp.getHeight();
	int bitDepth = imp.getBitDepth();

	double max = imp.getDisplayRangeMax();
	double min = imp.getDisplayRangeMin();

	ImageStack stack = imp.getImageStack();
	int slices = stack.getSize();
	ImagePlus[] region = new ImagePlus[mlevel];
	ImageStack[] rstack = new ImageStack[mlevel];
	ImageProcessor[] rip = new ImageProcessor[mlevel];
	for (int i = 0; i < mlevel; ++i)
	{
		region[i] = NewImage.createImage(imp.getTitle() + " Region " + i, width, height, slices, bitDepth,
				NewImage.FILL_BLACK);
		rstack[i] = region[i].getImageStack();
	}
	
	int[] newT = new int[mlevel +1];
	System.arraycopy(t, 0, newT, 0, mlevel);
	newT[mlevel] = Integer.MAX_VALUE;
	t = newT;
	
	for (int slice = 1; slice <= slices; slice++)
	{
		ImageProcessor ip = stack.getProcessor(slice);
		for (int i = 0; i < mlevel; ++i)
		{
			rip[i] = rstack[i].getProcessor(slice);
		}
		for (int i = 0; i < ip.getPixelCount(); ++i)
		{
			int val = ip.get(i);
			int k=0;
			while (val > t[k+1])
				k++;
			rip[k].set(i, val);
		}
	}
	for (int i = 0; i < mlevel; i++)
	{
		region[i].setDisplayRange(min, max);
		region[i].show();
	}
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:59,代码来源:Multi_OtsuThreshold.java

示例5: showMasks

import ij.gui.NewImage; //导入方法依赖的package包/类
/**
 * Show new mask images using only pixels within the bounds of the given thresholds
 * 
 * @param mlevel
 *            The number of thresholds
 * @param t
 *            The thresholds
 * @param imp
 *            The image
 */
public void showMasks(int mlevel, int[] t, ImagePlus imp)
{
	int width = imp.getWidth();
	int height = imp.getHeight();

	ImageStack stack = imp.getImageStack();
	int slices = stack.getSize();
	ImagePlus[] region = new ImagePlus[mlevel];
	ImageStack[] rstack = new ImageStack[mlevel];
	ImageProcessor[] rip = new ImageProcessor[mlevel];
	for (int i = 0; i < mlevel; ++i)
	{
		region[i] = NewImage.createImage(imp.getTitle() + " Mask " + i, width, height, slices, 8,
				NewImage.FILL_BLACK);
		rstack[i] = region[i].getImageStack();
	}
	int[] newT = new int[mlevel +1];
	System.arraycopy(t, 0, newT, 0, mlevel);
	newT[mlevel] = Integer.MAX_VALUE;
	t = newT;
	for (int slice = 1; slice <= slices; slice++)
	{
		ImageProcessor ip = stack.getProcessor(slice);
		for (int i = 0; i < mlevel; ++i)
		{
			rip[i] = rstack[i].getProcessor(slice);
		}
		for (int i = 0; i < ip.getPixelCount(); ++i)
		{
			int val = ip.get(i);
			int k=0;
			while (val > t[k+1])
				k++;
			rip[k].set(i, 255);
		}
	}
	for (int i = 0; i < mlevel; i++)
	{
		region[i].setDisplayRange(0, 255);
		region[i].show();
	}
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:53,代码来源:Multi_OtsuThreshold.java

示例6: getRenderingCanvas

import ij.gui.NewImage; //导入方法依赖的package包/类
/**
 * Returns a zero-filled image (8-bit) large enough to include all the paths
 * currently loaded by the plugin.
 *
 * @return the rendering canvas
 * @throws RuntimeException
 *             if called before successfully loading a file
 */
public ImagePlus getRenderingCanvas() {
	initializeTracingCanvas();
	xy = NewImage.createImage("Canvas", width, height, depth, 8, NewImage.FILL_BLACK);
	return xy;
}
 
开发者ID:tferr,项目名称:hIPNAT,代码行数:14,代码来源:ImportTracings.java


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