本文整理汇总了Java中ij.gui.Roi.getType方法的典型用法代码示例。如果您正苦于以下问题:Java Roi.getType方法的具体用法?Java Roi.getType怎么用?Java Roi.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.gui.Roi
的用法示例。
在下文中一共展示了Roi.getType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillOutside
import ij.gui.Roi; //导入方法依赖的package包/类
/**
* Fill in a region outside a specified ROI
* @param ip
* @param roi
*/
public static void fillOutside(ImageProcessor ip, Roi roi, double value) {
// Check we don't have a full rectangle
if (roi.getType() == Roi.RECTANGLE && roi.getBounds().equals(new Rectangle(0, 0, ip.getWidth(), ip.getHeight())))
return;
// if (roi instanceof ShapeRoi) {
// Appears to be a bug with ShapeRois so that filling outside can fail using ImageJ's own code
ByteProcessor bpMask = new ByteProcessor(ip.getWidth(), ip.getHeight());
bpMask.setValue(1);
bpMask.fill(roi);
if (value == 0)
ip.copyBits(bpMask, 0, 0, Blitter.MULTIPLY);
else {
float floatValue = (float)value;
byte[] px = (byte[])bpMask.getPixels();
for (int i = 0; i < px.length; i++) {
if (px[i] == (byte)0)
ip.setf(i, floatValue);
}
}
// } else {
// ip.setValue(value);
// ip.fillOutside(roi);
// }
}
示例2: convertToPathROI
import ij.gui.Roi; //导入方法依赖的package包/类
/**
* Create a ROI from an ImageJ Roi.
*
* @param pathROI
* @param pathImage
* @return
*/
public static ROI convertToPathROI(Roi roi, Calibration cal, double downsampleFactor, final int c, final int z, final int t) {
// if (roi.getType() == Roi.POLYGON || roi.getType() == Roi.TRACED_ROI)
// return convertToPolygonROI((PolygonRoi)roi, cal, downsampleFactor);
if (roi.getType() == Roi.RECTANGLE && roi.getCornerDiameter() == 0)
return getRectangleROI(roi, cal, downsampleFactor, c, z, t);
if (roi.getType() == Roi.OVAL)
return convertToEllipseROI(roi, cal, downsampleFactor, c, z, t);
if (roi instanceof Line)
return convertToLineROI((Line)roi, cal, downsampleFactor, c, z, t);
if (roi instanceof PointRoi)
return convertToPointROI((PolygonRoi)roi, cal, downsampleFactor, c, z, t);
// if (roi instanceof ShapeRoi)
// return convertToAreaROI((ShapeRoi)roi, cal, downsampleFactor);
// // Shape ROIs should be able to handle most eventualities
if (roi instanceof ShapeRoi)
return convertToAreaROI((ShapeRoi)roi, cal, downsampleFactor, c, z, t);
if (roi.isArea())
return convertToPolygonOrAreaROI(roi, cal, downsampleFactor, c, z, t);
// TODO: Integrate ROI not supported exception...?
return null;
}
示例3: getImageList
import ij.gui.Roi; //导入方法依赖的package包/类
private static String[] getImageList()
{
TurboList<String> newImageList = new TurboList<String>();
for (int id : Utils.getIDList())
{
ImagePlus imp = WindowManager.getImage(id);
if (imp == null)
continue;
if (imp.getNDimensions() != 3)
continue;
if (imp.getBitDepth() == 24)
continue;
Roi roi = imp.getRoi();
if (roi == null || roi.getType() != Roi.POINT)
continue;
newImageList.add(imp.getTitle());
}
return newImageList.toArray(new String[0]);
}
示例4: findFitRegion
import ij.gui.Roi; //导入方法依赖的package包/类
private boolean findFitRegion()
{
// Get the centre
Roi roi = imp.getRoi();
if (roi != null && roi.getType() == Roi.POINT)
{
FloatPolygon p = roi.getFloatPolygon();
int n = p.npoints;
if (n != 1)
{
IJ.error(TITLE, "Require a single point ROI");
return false;
}
cx = (int) p.xpoints[0];
cy = (int) p.ypoints[0];
return true;
}
IJ.error(TITLE, "Require a single point ROI");
return false;
}
示例5: setup
import ij.gui.Roi; //导入方法依赖的package包/类
public int setup(String arg, ImagePlus imp)
{
SMLMUsageTracker.recordPlugin(this.getClass(), arg);
if (imp == null)
{
IJ.noImage();
return DONE;
}
Roi roi = imp.getRoi();
if (roi == null || roi.getType() != Roi.POINT)
{
IJ.error("Point ROI required");
return DONE;
}
this.imp = imp;
return showDialog();
}
示例6: getSpots
import ij.gui.Roi; //导入方法依赖的package包/类
/**
* @return Extract all the ROI points
*/
private BasePoint[] getSpots()
{
float z = imp.getStackSize() / 2;
Roi roi = imp.getRoi();
if (roi != null && roi.getType() == Roi.POINT)
{
FloatPolygon p = roi.getFloatPolygon();
int n = p.npoints;
float offset = 0.5f;
// Check if already float coordinates
if (!SimpleArrayUtils.isInteger(p.xpoints) || !SimpleArrayUtils.isInteger(p.ypoints))
offset = 0;
BasePoint[] roiPoints = new BasePoint[n];
for (int i = 0; i < n; i++)
{
roiPoints[i] = new BasePoint(p.xpoints[i] + offset, p.ypoints[i] + offset, z);
}
return roiPoints;
}
return new BasePoint[0];
}
示例7: setup
import ij.gui.Roi; //导入方法依赖的package包/类
public int setup(String arg, ImagePlus imp)
{
SMLMUsageTracker.recordPlugin(this.getClass(), arg);
if (imp == null)
{
IJ.noImage();
return DONE;
}
Roi roi = imp.getRoi();
if (roi != null && roi.getType() != Roi.RECTANGLE)
{
IJ.error("Rectangular ROI required");
return DONE;
}
this.imp = imp;
if (arg.equals("final"))
{
runFinal(imp.getProcessor());
return DONE;
}
return flags;
}
示例8: makePoint
import ij.gui.Roi; //导入方法依赖的package包/类
/** Creates a point selection. */
public static void makePoint(int x, int y) {
ImagePlus img = getImage();
Roi roi = img.getRoi();
if (shiftKeyDown() && roi!=null && roi.getType()==Roi.POINT) {
Polygon p = roi.getPolygon();
p.addPoint(x, y);
img.setRoi(new PointRoi(p.xpoints, p.ypoints, p.npoints));
} else
img.setRoi(new PointRoi(x, y));
}
示例9: hideOverlay
import ij.gui.Roi; //导入方法依赖的package包/类
/**
* Hides the overlay and restores the ROI
*/
private void hideOverlay()
{
// Kill the overlay
activeImp.setOverlay(null);
Roi roi = activeImp.getRoi();
if (roi != null)
{
// If this is a new point then merge it into the saved Point ROI
if (roi.getType() == Roi.POINT && savedRoi != null)
{
// Merge the current ROI and the saved one
PointRoi pointRoi = (PointRoi) savedRoi;
AssignedPoint[] newPoints = PointManager.extractRoiPoints(roi);
for (AssignedPoint p : newPoints)
{
//pointRoi = pointRoi.addPoint(p.getX() - pointRoi.getBounds().x, p.getY() - pointRoi.getBounds().y);
pointRoi = pointRoi.addPoint(p.getX(), p.getY());
}
activeImp.setRoi(pointRoi, true);
}
}
else
{
// No new ROI so just restore from the old one
activeImp.restoreRoi();
}
savedRoi = null;
}
示例10: getImage
import ij.gui.Roi; //导入方法依赖的package包/类
private boolean getImage()
{
// Select an image
GenericDialog gd = new GenericDialog(TITLE);
String[] list = getImageList();
if (list.length == 0)
{
IJ.error("No suitable images");
return false;
}
gd.addChoice("Image", list, pluginSettings.getImage());
gd.showDialog();
if (gd.wasCanceled())
return false;
String image = gd.getNextChoice();
pluginSettings.setImage(image);
imp = WindowManager.getImage(image);
if (imp == null)
{
IJ.error(TITLE, "Failed to find image: " + image);
return false;
}
Roi roi = imp.getRoi();
if (roi == null || roi.getType() != Roi.POINT)
{
IJ.error("Point ROI required");
return false;
}
return true;
}
示例11: setup
import ij.gui.Roi; //导入方法依赖的package包/类
public int setup(String arg, ImagePlus imp)
{
SMLMUsageTracker.recordPlugin(this.getClass(), arg);
extraOptions = Utils.isExtraOptions();
if (imp == null)
{
IJ.noImage();
return DONE;
}
settings = SettingsManager.readPSFEstimatorSettings(0).toBuilder();
// Reset
if (IJ.controlKeyDown())
{
config = new FitEngineConfiguration();
Calibration calibration = SettingsManager.readCalibration(0);
config.getFitConfiguration().setCalibration(calibration);
}
else
{
config = SettingsManager.readFitEngineConfiguration(0);
}
Roi roi = imp.getRoi();
if (roi != null && roi.getType() != Roi.RECTANGLE)
{
IJ.error("Rectangular ROI required");
return DONE;
}
return showDialog(imp);
}
示例12: setup
import ij.gui.Roi; //导入方法依赖的package包/类
public int setup(String arg, ImagePlus imp)
{
if (arg.equals("final"))
{
//imp.resetDisplayRange();
imp.updateAndDraw();
return DONE;
}
SMLMUsageTracker.recordPlugin(this.getClass(), arg);
if (imp == null)
{
IJ.noImage();
return DONE;
}
Roi roi = imp.getRoi();
if (roi != null && roi.getType() != Roi.RECTANGLE)
{
IJ.error("Rectangular ROI required");
return DONE;
}
return flags;
}
示例13: getOnlyRectangularRoi
import ij.gui.Roi; //导入方法依赖的package包/类
protected static Roi getOnlyRectangularRoi( Roi roi )
{
// we can only do rectangular rois
if ( roi != null && roi.getType() != Roi.RECTANGLE )
return null;
return roi;
}
示例14: mouseReleased
import ij.gui.Roi; //导入方法依赖的package包/类
@Override
public void mouseReleased( final MouseEvent e )
{
// here the ROI might have been modified, let's test for that
final Roi roi = imp.getRoi();
if ( roi == null || roi.getType() != Roi.RECTANGLE )
return;
while ( isComputing )
SimpleMultiThreading.threadWait( 10 );
updatePreview( ValueChange.ROI );
}
示例15: updateImageList
import ij.gui.Roi; //导入方法依赖的package包/类
@Override
public void updateImageList()
{
int noOfImages = WindowManager.getImageCount();
List<String> imageList = new ArrayList<String>(noOfImages);
for (int id : gdsc.core.ij.Utils.getIDList())
{
ImagePlus imp = WindowManager.getImage(id);
// Image must be 8-bit/16-bit/32-bit && only contains XYZ dimensions
if (imp != null && (imp.getType() == ImagePlus.GRAY8 || imp.getType() == ImagePlus.GRAY16 ||
imp.getType() == ImagePlus.GRAY32) && (imp.getNChannels() == 1 && imp.getNFrames() == 1))
{
Roi roi = imp.getRoi();
if (roi == null || roi.getType() != Roi.POINT)
continue;
// Check it is not one the result images
String imageTitle = imp.getTitle();
if (!imageTitle.endsWith(FindFoci.TITLE) && !imageTitle.endsWith("clone") &&
!imageTitle.endsWith(" TP") && !imageTitle.endsWith(" FP") && !imageTitle.endsWith(" FN"))
{
imageList.add(imageTitle);
}
}
}
model.setImageList(imageList);
}