public ImageProcessor rotateLine(ImagePlus imp, int width) { Roi roi = imp.getRoi(); if (roi==null || roi.getType()!=Roi.LINE) throw new IllegalArgumentException("Straight line selection expected"); Polygon p = ((Line)roi).getPoints(); imp.setRoi(new PolygonRoi(p.xpoints, p.ypoints, 2, Roi.POLYLINE)); ImageProcessor ip2 = imp.getBitDepth()==24?straightenRGB(imp, width):straightenLine(imp, width); imp.setRoi(roi); return ip2; }
public ImageProcessor rotateLine(ImagePlus imp, int width) { Roi roi = imp.getRoi(); if (roi==null || roi.getType()!=Roi.LINE) throw new IllegalArgumentException("Straight line selection expected"); Polygon p = ((Line)roi).getPoints(); imp.setRoi(new PolygonRoi(p.xpoints, p.ypoints, 2, Roi.POLYLINE)); ImageProcessor ip2 = imp.getBitDepth()==24?straightenRGB(imp, width):straightenLine(imp, width); imp.setRoi(roi); return ip2; }
ImageProcessor straightenComposite(ImagePlus imp, int width) { Image img = imp.getImage(); ImagePlus imp2 = new ImagePlus("temp", new ColorProcessor(img)); imp2.setRoi(imp.getRoi()); ImageProcessor ip2 = straightenRGB(imp2, width); imp.setRoi(imp2.getRoi()); return ip2; }
ImageProcessor straightenComposite(ImagePlus imp, int width) { Image img = imp.getImage(); ImagePlus imp2 = new ImagePlus("temp", new ColorProcessor(img)); imp2.setRoi(imp.getRoi()); ImageProcessor ip2 = straightenRGB(imp2, width); imp.setRoi(imp2.getRoi()); return ip2; }
public ImageProcessor straighten(ImagePlus imp, Roi roi, int width) { ImageProcessor ip2; if (imp.getBitDepth()==24 && roi.getType()!=Roi.LINE) ip2 = straightenRGB(imp, width); else if (imp.isComposite() && ((CompositeImage)imp).getMode()==IJ.COMPOSITE) { if (roi.getType()==Roi.LINE) ip2 = rotateCompositeLine(imp, width); else ip2 = straightenComposite(imp, width); } else if (roi.getType()==Roi.LINE) ip2 = rotateLine(imp, width); else ip2 = straightenLine(imp, width); return ip2; }
public ImageProcessor straighten(ImagePlus imp, Roi roi, int width) { ImageProcessor ip2; if (imp.getBitDepth()==24 && roi.getType()!=Roi.LINE) ip2 = straightenRGB(imp, width); else if (imp.isComposite() && ((CompositeImage)imp).getMode()==IJ.COMPOSITE) { if (roi.getType()==Roi.LINE) ip2 = rotateCompositeLine(imp, width); else ip2 = straightenComposite(imp, width); } else if (roi.getType()==Roi.LINE) ip2 = rotateLine(imp, width); else ip2 = straightenLine(imp, width); return ip2; }