ImageProcessor rotateCompositeLine(ImagePlus imp, int width) { Image img = imp.getImage(); ImagePlus imp2 = new ImagePlus("temp", new ColorProcessor(img)); imp2.setRoi(imp.getRoi()); ImageProcessor ip2 = rotateLine(imp2, width); return ip2; }
ImageProcessor rotateCompositeLine(ImagePlus imp, int width) { Image img = imp.getImage(); ImagePlus imp2 = new ImagePlus("temp", new ColorProcessor(img)); imp2.setRoi(imp.getRoi()); ImageProcessor ip2 = rotateLine(imp2, width); return ip2; }
/** Returns the pixel values along this line. */ public double[] getPixels() { double[] profile; if (getStrokeWidth()<=1) { ImageProcessor ip = imp.getProcessor(); profile = ip.getLine(x1d, y1d, x2d, y2d); } else { ImageProcessor ip2 = (new Straightener()).rotateLine(imp,(int)getStrokeWidth()); if (ip2==null) return new double[0]; int width = ip2.getWidth(); int height = ip2.getHeight(); if (ip2 instanceof FloatProcessor) return ProfilePlot.getColumnAverageProfile(new Rectangle(0,0,width,height),ip2); profile = new double[width]; double[] aLine; ip2.setInterpolate(false); for (int y=0; y<height; y++) { aLine = ip2.getLine(0, y, width-1, y); for (int i=0; i<width; i++) profile[i] += aLine[i]; } for (int i=0; i<width; i++) profile[i] /= height; } return profile; }
/** Returns the pixel values along this line. */ public double[] getPixels() { double[] profile; if (getStrokeWidth()<=1) { ImageProcessor ip = imp.getProcessor(); profile = ip.getLine(x1d, y1d, x2d, y2d); } else { ImageProcessor ip2 = (new Straightener()).rotateLine(imp,(int)getStrokeWidth()); if (ip2==null) return new double[0]; int width = ip2.getWidth(); int height = ip2.getHeight(); if (ip2 instanceof FloatProcessor) return ProfilePlot.getColumnAverageProfile(new Rectangle(0,0,width,height),ip2); profile = new double[width]; double[] aLine; ip2.setInterpolate(false); for (int y=0; y<height; y++) { aLine = ip2.getLine(0, y, width-1, y); for (int i=0; i<width; i++) profile[i] += aLine[i]; } for (int i=0; i<width; i++) profile[i] /= height; } return profile; }
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; }