本文整理汇总了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());
}
示例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);
}
示例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);
}
示例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();
}
}
示例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();
}
}
示例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;
}