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


Java NewImage.createByteImage方法代码示例

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


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

示例1: testNoImageWhenNoSkeletonisation

import ij.gui.NewImage; //导入方法依赖的package包/类
/**
 * Test that no skeleton image pops open, when the input is already a skeleton
 * (or skeletonisation didn't change it)
 */
@Test
public void testNoImageWhenNoSkeletonisation() throws Exception {
	// SETUP
	final UserInterface mockUI = mock(UserInterface.class);
	IMAGE_J.ui().setDefaultUI(mockUI);
	final ImagePlus pixel = NewImage.createByteImage("Test", 3, 3, 1,
		FILL_BLACK);
	pixel.getStack().getProcessor(1).set(1, 1, (byte) 0xFF);

	// EXECUTE
	final CommandModule module = IMAGE_J.command().run(
		AnalyseSkeletonWrapper.class, true, "inputImage", pixel,
		"pruneCycleMethod", "None").get();

	// VERIFY
	assertFalse(
		"Sanity check failed: plugin cancelled before image could have been shown",
		module.isCanceled());
	verify(mockUI, after(250).never()).show(any(ImagePlus.class));
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:25,代码来源:AnalyseSkeletonWrapperTest.java

示例2: testSkeletonImageWhenSkeletonised

import ij.gui.NewImage; //导入方法依赖的package包/类
/**
 * Test that the skeleton is displayed, when the input image gets skeletonised
 */
@Test
public void testSkeletonImageWhenSkeletonised() throws Exception {
	final UserInterface mockUI = mock(UserInterface.class);
	IMAGE_J.ui().setDefaultUI(mockUI);
	final ImagePlus square = NewImage.createByteImage("Test", 4, 4, 1,
		FILL_BLACK);
	square.getStack().getProcessor(1).set(1, 1, (byte) 0xFF);
	square.getStack().getProcessor(1).set(1, 2, (byte) 0xFF);
	square.getStack().getProcessor(1).set(2, 1, (byte) 0xFF);
	square.getStack().getProcessor(1).set(2, 2, (byte) 0xFF);

	// EXECUTE
	CommandModule module = IMAGE_J.command().run(AnalyseSkeletonWrapper.class,
		true, "inputImage", square, "pruneCycleMethod", "None").get();

	// VERIFY
	assertFalse(
		"Sanity check failed: plugin cancelled before image could have been shown",
		module.isCanceled());
	verify(mockUI, timeout(1000)).show(any(ImagePlus.class));
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:25,代码来源:AnalyseSkeletonWrapperTest.java

示例3: testResultsTableShortestPathFalse

import ij.gui.NewImage; //导入方法依赖的package包/类
/**
 * Results table should have different number of columns when option
 * "calculateShortestPath" is false see {@link #testResultsTable()}
 */
@Test
public void testResultsTableShortestPathFalse() throws Exception {
	// SETUP
	final ImagePlus pixel = NewImage.createByteImage("Test", 4, 4, 1,
		FILL_BLACK);
	pixel.getStack().getProcessor(1).set(1, 1, (byte) 0xFF);

	// EXECUTE
	final CommandModule module = IMAGE_J.command().run(
		AnalyseSkeletonWrapper.class, true, "inputImage", pixel,
		"pruneCycleMethod", "None", "calculateShortestPath", false).get();

	// VERIFY
	@SuppressWarnings("unchecked")
	final Table<DefaultColumn<String>, String> table =
		(Table<DefaultColumn<String>, String>) module.getOutput("resultsTable");
	assertNotNull(table);
	assertEquals("Results table has wrong number of columns", 11, table.size());
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:24,代码来源:AnalyseSkeletonWrapperTest.java

示例4: testAdditionalResultsTableNullWhenVerboseFalse

import ij.gui.NewImage; //导入方法依赖的package包/类
@Test
public void testAdditionalResultsTableNullWhenVerboseFalse()
	throws Exception
{
	// SETUP
	final ImagePlus pixel = NewImage.createByteImage("Test", 4, 4, 1,
		FILL_BLACK);
	pixel.getStack().getProcessor(1).set(1, 1, (byte) 0xFF);

	// EXECUTE
	final CommandModule module = IMAGE_J.command().run(
		AnalyseSkeletonWrapper.class, true, "inputImage", pixel,
		"pruneCycleMethod", "None", "verbose", false).get();

	// VERIFY
	assertNull(module.getOutput("verboseTable"));
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:18,代码来源:AnalyseSkeletonWrapperTest.java

示例5: testNullROIManagerCancelsPlugin

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

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

	// VERIFY
	assertTrue("No ROI Manager should have cancelled the plugin", module
		.isCanceled());
	assertEquals("Cancel reason is incorrect",
		"Can't crop without valid ROIs in the ROIManager", module
			.getCancelReason());
	verify(mockUI, timeout(1000)).dialogPrompt(anyString(), anyString(), any(),
		any());
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:20,代码来源:ThicknessWrapperTest.java

示例6: testNoImageWhenNoSkeletonisation

import ij.gui.NewImage; //导入方法依赖的package包/类
/**
 * Test that no skeleton image pops open, when the input is already a skeleton
 * (or skeletonisation didn't change it)
 */
@Test
public void testNoImageWhenNoSkeletonisation() throws Exception {
	// SETUP
	final UserInterface mockUI = mock(UserInterface.class);
	doNothing().when(mockUI).show(any(ImagePlus.class));
	IMAGE_J.ui().setDefaultUI(mockUI);
	final ImagePlus pixel = NewImage.createByteImage("Test", 3, 3, 1,
		FILL_BLACK);
	pixel.getStack().getProcessor(1).set(1, 1, (byte) 0xFF);

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

	// VERIFY
	assertEquals(
		"Sanity check failed: plugin cancelled before image could have been shown",
		NO_RESULTS_MSG, module.getCancelReason());
	verify(mockUI, after(250).never()).show(any(ImagePlus.class));
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:25,代码来源:IntertrabecularAngleWrapperTest.java

示例7: testSkeletonImageWhenSkeletonised

import ij.gui.NewImage; //导入方法依赖的package包/类
/**
 * Test that the skeleton is displayed, when the input image gets skeletonised
 */
@Test
public void testSkeletonImageWhenSkeletonised() throws Exception {
	// SETUP
	final UserInterface mockUI = mock(UserInterface.class);
	doNothing().when(mockUI).show(any(ImagePlus.class));
	IMAGE_J.ui().setDefaultUI(mockUI);
	final ImagePlus square = NewImage.createByteImage("Test", 4, 4, 1,
		FILL_BLACK);
	square.getStack().getProcessor(1).set(1, 1, (byte) 0xFF);
	square.getStack().getProcessor(1).set(1, 2, (byte) 0xFF);
	square.getStack().getProcessor(1).set(2, 1, (byte) 0xFF);
	square.getStack().getProcessor(1).set(2, 2, (byte) 0xFF);

	// EXECUTE
	IMAGE_J.command().run(IntertrabecularAngleWrapper.class, true, "inputImage",
		square).get();

	// VERIFY
	verify(mockUI, timeout(1000)).show(any(ImagePlus.class));
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:24,代码来源:IntertrabecularAngleWrapperTest.java

示例8: testNoResultsCancelsPlugin

import ij.gui.NewImage; //导入方法依赖的package包/类
@Test
public void testNoResultsCancelsPlugin() throws Exception {
	// SETUP
	final UserInterface mockUI = CommonWrapperTests.mockUIService(IMAGE_J);
	final ImagePlus pixel = NewImage.createByteImage("Test", 3, 3, 1,
		FILL_BLACK);
	pixel.getStack().getProcessor(1).set(1, 1, (byte) 0xFF);

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

	// VERIFY
	assertTrue("Plugin should have cancelled", module.isCanceled());
	assertEquals("Cancel reason is incorrect", NO_RESULTS_MSG, module
		.getCancelReason());
	verify(mockUI, timeout(1000)).dialogPrompt(anyString(), anyString(), any(),
		any());
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:20,代码来源:IntertrabecularAngleWrapperTest.java

示例9: testMultipleGraphsShowsWarningDialog

import ij.gui.NewImage; //导入方法依赖的package包/类
@Test
public void testMultipleGraphsShowsWarningDialog() throws Exception {
	// SETUP
	final UserInterface mockUI = mock(UserInterface.class);
	final SwingDialogPrompt mockPrompt = mock(SwingDialogPrompt.class);
	when(mockUI.dialogPrompt(startsWith("Image has multiple skeletons"),
		anyString(), eq(WARNING_MESSAGE), any())).thenReturn(mockPrompt);
	IMAGE_J.ui().setDefaultUI(mockUI);
	final ImagePlus pixels = NewImage.createByteImage("Test", 4, 4, 1,
		FILL_BLACK);
	pixels.getStack().getProcessor(1).set(1, 1, (byte) 0xFF);
	pixels.getStack().getProcessor(1).set(3, 3, (byte) 0xFF);

	// EXECUTE
	IMAGE_J.command().run(IntertrabecularAngleWrapper.class, true, "inputImage",
		pixels).get();

	// VERIFY
	verify(mockUI, timeout(1000)).dialogPrompt(startsWith(
		"Image has multiple skeletons"), anyString(), eq(WARNING_MESSAGE), any());
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:22,代码来源:IntertrabecularAngleWrapperTest.java

示例10: createTestImage

import ij.gui.NewImage; //导入方法依赖的package包/类
private ImagePlus createTestImage()
{
	final ImagePlus imp = NewImage.createByteImage( "Test image", 100, 100, 1, NewImage.FILL_BLACK );
	final ImageProcessor ip = imp.getProcessor();
	ip.setRoi( new Rectangle( 10, 10, 10, 10 ) );
	ip.setColor( 1 );
	ip.fill();
	ip.setRoi( new Rectangle( 20, 20, 10, 20 ) );
	ip.setColor( 2 );
	ip.fill();
	ip.setRoi( new Rectangle( 40, 40, 10, 30 ) );
	ip.setColor( 3 );
	ip.fill();

	return imp;
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:17,代码来源:LabelingExample.java

示例11: produceNoiseImage

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

示例12: createRectengularMaskImage

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

示例13: createHistogramImage

import ij.gui.NewImage; //导入方法依赖的package包/类
void createHistogramImage(String title) {
	if (title == null)
		title = "Histogram Plot";
	hist_img  = NewImage.createByteImage(title,width,height,1,0);
	ip = hist_img.getProcessor();
       ip.setValue(BACKGROUND);
       ip.fill();
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:9,代码来源:HistogramPlot.java

示例14: testAdditionalResultsTable

import ij.gui.NewImage; //导入方法依赖的package包/类
@Test
public void testAdditionalResultsTable() throws Exception {
	// SETUP
	final ImagePlus line = NewImage.createByteImage("Test", 3, 3, 1,
		FILL_BLACK);
	line.getStack().getProcessor(1).set(1, 1, (byte) 0xFF);
	line.getStack().getProcessor(1).set(2, 2, (byte) 0xFF);
	final String length = String.valueOf(Math.sqrt(2.0));
	final String[] expectedHeaders = { "# Skeleton", "# Branch",
		"Branch length", "V1 x", "V1 y", "V1 z", "V2 x", "V2 y", "V2 z",
		"Euclidean distance", "running average length",
		"average intensity (inner 3rd)", "average intensity" };
	final String[] expectedValues = { "1", "1", length, "1", "1", "0", "2", "2",
		"0", length, length, "255.0", "255.0" };

	// EXECUTE
	final CommandModule module = IMAGE_J.command().run(
		AnalyseSkeletonWrapper.class, true, "inputImage", line,
		"pruneCycleMethod", "None", "verbose", true, "pruneEnds", false).get();

	// VERIFY
	final DefaultGenericTable table = (DefaultGenericTable) module.getOutput(
		"verboseTable");
	assertNotNull(table);
	assertEquals("Results table has wrong number of columns",
		expectedHeaders.length, table.size());
	for (int i = 0; i < table.size(); i++) {
		final PrimitiveColumn<?, ?> column = (PrimitiveColumn<?, ?>) table.get(i);
		assertEquals("Column has incorrect header", expectedHeaders[i], column
			.getHeader());
		assertEquals("Column has wrong number of rows", 1, column.size());
		assertEquals("Column has an incorrect value", expectedValues[i], String
			.valueOf(column.get(0)));
	}
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:36,代码来源:AnalyseSkeletonWrapperTest.java

示例15: testResults

import ij.gui.NewImage; //导入方法依赖的package包/类
@Test
public void testResults() throws Exception {
	// SETUP
	final ImagePlus imagePlus = NewImage.createByteImage("", 2, 2, 2, 1);
	final Calibration calibration = new Calibration();
	calibration.setUnit("mm");
	imagePlus.setCalibration(calibration);
	final String[] expectedHeaders = { "Tb.Th Mean (mm)", "Tb.Th Std Dev (mm)",
		"Tb.Th Max (mm)", "Tb.Sp Mean (mm)", "Tb.Sp Std Dev (mm)",
		"Tb.Sp Max (mm)" };
	final String[][] expectedValues = { { "", "NaN" }, { "", "NaN" }, { "",
		"NaN" }, { "10.392304420471191", "" }, { "0.0", "" }, {
			"10.392304420471191", "" } };

	// EXECUTE
	final CommandModule module = IMAGE_J.command().run(ThicknessWrapper.class,
		true, "inputImage", imagePlus, "mapChoice", "Both", "maskArtefacts",
		false, "cropToRois", false, "showMaps", false).get();

	// VERIFY
	@SuppressWarnings("unchecked")
	final Table<DefaultColumn<String>, String> table =
		(Table<DefaultColumn<String>, String>) module.getOutput("resultsTable");
	assertNotNull(table);
	assertEquals("Results table has wrong number of columns", 7, table.size());
	for (int i = 0; i < 6; i++) {
		final DefaultColumn<String> column = table.get(i + 1);
		assertEquals(expectedHeaders[i], column.getHeader());
		for (int j = 0; j < 2; j++) {
			assertEquals("Column has an incorrect value", expectedValues[i][j],
				column.getValue(j));
		}
	}
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:35,代码来源:ThicknessWrapperTest.java


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