本文整理汇总了Java中ij.process.ShortProcessor.fill方法的典型用法代码示例。如果您正苦于以下问题:Java ShortProcessor.fill方法的具体用法?Java ShortProcessor.fill怎么用?Java ShortProcessor.fill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.process.ShortProcessor
的用法示例。
在下文中一共展示了ShortProcessor.fill方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import ij.process.ShortProcessor; //导入方法依赖的package包/类
private ShortProcessor initialize(ImageProcessor marker)
{
// size of image
sizeX = marker.getWidth();
sizeY = marker.getHeight();
ShortProcessor distMap = new ShortProcessor(sizeX, sizeY);
distMap.setValue(0);
distMap.fill();
// initialize empty image with either 0 (foreground) or Inf (background)
for (int y = 0; y < sizeY; y++)
{
for (int x = 0; x < sizeX; x++)
{
int val = marker.get(x, y) & 0x00ff;
distMap.set(x, y, val == 0 ? Short.MAX_VALUE : 0);
}
}
return distMap;
}
示例2: initializeResult
import ij.process.ShortProcessor; //导入方法依赖的package包/类
private ShortProcessor initializeResult(ImageProcessor labelImage)
{
// size of image
int sizeX = labelImage.getWidth();
int sizeY = labelImage.getHeight();
// create new empty image, and fill it with black
ShortProcessor distMap = new ShortProcessor(sizeX, sizeY);
distMap.setValue(0);
distMap.fill();
// initialize empty image with either 0 (background) or Inf (foreground)
for (int y = 0; y < sizeY; y++)
{
for (int x = 0; x < sizeX; x++)
{
int label = (int) labelImage.getf(x, y);
distMap.set(x, y, label == 0 ? 0 : Short.MAX_VALUE);
}
}
return distMap;
}
示例3: checkMask
import ij.process.ShortProcessor; //导入方法依赖的package包/类
private ImagePlus checkMask(ImagePlus imp, String maskImage)
{
ImagePlus maskImp = WindowManager.getImage(maskImage);
if (maskImp == null)
{
// Build a mask image using the input image ROI
Roi roi = imp.getRoi();
if (roi == null || !roi.isArea())
{
IJ.showMessage("Error", "No region defined (use an area ROI or an input mask)");
return null;
}
ShortProcessor ip = new ShortProcessor(imp.getWidth(), imp.getHeight());
ip.setValue(1);
ip.setRoi(roi);
ip.fill(roi);
// Label each separate region with a different number
labelRegions(ip);
maskImp = new ImagePlus("Mask", ip);
}
if (imp.getNSlices() > 1 && maskImp.getNSlices() != 1 && maskImp.getNSlices() != imp.getNSlices())
{
IJ.showMessage("Error", "Mask region has incorrect slice dimension");
return null;
}
if (imp.getNChannels() > 1 && maskImp.getNChannels() != 1 && maskImp.getNChannels() != imp.getNChannels())
{
IJ.showMessage("Error", "Mask region has incorrect channel dimension");
return null;
}
if (imp.getNFrames() > 1 && processFrames && maskImp.getNFrames() != 1 &&
maskImp.getNFrames() != imp.getNFrames())
{
IJ.showMessage("Error", "Mask region has incorrect frame dimension");
return null;
}
return maskImp;
}