本文整理汇总了Java中ij.gui.Roi.setLocation方法的典型用法代码示例。如果您正苦于以下问题:Java Roi.setLocation方法的具体用法?Java Roi.setLocation怎么用?Java Roi.setLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.gui.Roi
的用法示例。
在下文中一共展示了Roi.setLocation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractSelection
import ij.gui.Roi; //导入方法依赖的package包/类
private Roi extractSelection(ImageProcessor maskIp, int maskId, int channel, int slice, int frame)
{
maskIp.setThreshold(maskId, maskId, ImageProcessor.NO_LUT_UPDATE);
ThresholdToSelection ts = new ThresholdToSelection();
Roi roi = ts.convert(maskIp);
if (imp.getStackSize() == 1)
{
roi.setPosition(0);
}
else if (imp.isDisplayedHyperStack())
{
if (showOverlay != 1)
slice = 0; // Display across entire slice stack
roi.setPosition(channel, slice, frame);
}
else
{
// We cannot support display across the entire stack if this is not a hyperstack
int index = imp.getStackIndex(channel, slice, frame);
roi.setPosition(index);
}
Rectangle roiBounds = roi.getBounds();
roi.setLocation(bounds.x + roiBounds.x, bounds.y + roiBounds.y);
return roi;
}
示例2: measureMembrane
import ij.gui.Roi; //导入方法依赖的package包/类
public static void measureMembrane(PathObject po, ImageProcessor ip, String ipName, Calibration cal, double downsampleFactor) {
Roi roi = ROIConverterIJ.convertToIJRoi(po.getROI(), cal, downsampleFactor);
Rectangle bounds = roi.getBounds();
ByteProcessor bp = new ByteProcessor(bounds.width, bounds.height);
roi.setLocation(0, 0);
bp.setValue(255);
bp.draw(roi);
double sum = 0;
int count = 0;
double min = Double.POSITIVE_INFINITY;
double max = Double.NEGATIVE_INFINITY;
for (int y = 0; y < bounds.height; y++) {
for (int x = 0; x < bounds.width; x++) {
if (bp.get(x, y) != 0) {
double val = ip.getf(x+bounds.x, y+bounds.y);
sum += val;
count++;
if (val > max)
max = val;
if (val < min)
min = val;
}
}
}
roi.setLocation(bounds.x, bounds.y);
po.getMeasurementList().addMeasurement("Membrane mean"+SPLIT_CHAR+" "+ipName, sum/count);
// po.addMeasurement("Membrane min"+SPLIT_CHAR+" "+ipName, min);
// po.addMeasurement("Membrane max"+SPLIT_CHAR+" "+ipName, max);
}
示例3: getPerimeter
import ij.gui.Roi; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private double getPerimeter(ImageProcessor maskIp, int maskId, Overlay overlay, int z)
{
maskIp.setThreshold(maskId, maskId, ImageProcessor.NO_LUT_UPDATE);
ThresholdToSelection ts = new ThresholdToSelection();
Roi roi = ts.convert(maskIp);
if (overlay != null)
{
roi.setPosition(z);
roi.setLocation(bounds.x, bounds.y);
overlay.add(roi);
}
double perimeter = roi.getLength();
return perimeter;
}
示例4: run
import ij.gui.Roi; //导入方法依赖的package包/类
@Override
public void run(String arg) {
// Open an image
String path = "/home/bene/PhD/brains/template.tif";
ImagePlus imp = IJ.openImage(path);
new StackConverter(imp).convertToGray8();
// Create a universe and show it
Image3DUniverse univ = new Image3DUniverse();
univ.show();
univ.rotateY(30 * Math.PI / 180);
// Add the image as a volume
Content c = univ.addVoltex(imp);
sleep(5);
// Retrieve the VoltexGroup
VoltexGroup voltex = (VoltexGroup)c.getContent();
// Define a ROI
Roi roi = new OvalRoi(240, 220, 70, 50);
// Define a fill color
byte fillValue = (byte)100;
// Fill the part of the volume which results from the
// projection of the polygon onto the volume:
voltex.fillRoi(univ.getCanvas(), roi, fillValue);
sleep(5);
// This can be optimally used for deleting some parts of
// the volume:
fillValue = (byte)0;
roi.setLocation(150, 150);
voltex.fillRoi(univ.getCanvas(), roi, fillValue);
sleep(5);
// The internal image is changed, too:
imp.show();
}