/** 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; }
return null; Straightener straightener = new Straightener(); int w = 1, h = lineWidth; ImageStack stack = image.getStack();
/** 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; }
double[] getWideLineProfile(ImagePlus imp, int lineWidth) { Roi roi = (Roi)imp.getRoi().clone(); ImageProcessor ip2 = (new Straightener()).straightenLine(imp, lineWidth); int width = ip2.getWidth(); int height = ip2.getHeight(); if (ip2 instanceof FloatProcessor) return 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; imp.setRoi(roi); if (roi.getType()==Roi.POLYLINE&& !((PolygonRoi)roi).isSplineFit()) { ((PolygonRoi)roi).fitSpline(); imp.draw(); } return profile; }
protected static float[] getProfile(ImageProcessor ip, PolygonRoi roi, boolean fitSpline, int lineWidth) { if (fitSpline && !roi.isSplineFit()) { roi = (PolygonRoi)roi.clone(); roi.fitSpline(); } ImagePlus dummy = new ImagePlus("dummy", ip); dummy.setRoi(roi); Straightener straightener = new Straightener(); ip = straightener.straightenLine(dummy, lineWidth); int w = ip.getWidth(); float[] result = new float[w]; // need to average explicitely for (int j = 0; j < w; j++) { float value = ip.getf(j, 0); for (int k = 1; k < lineWidth; k++) value += ip.getf(j, k); result[j] = value / lineWidth; } return result; } }
double[] getWideLineProfile(ImagePlus imp, int lineWidth) { Roi roi = (Roi)imp.getRoi().clone(); ImageProcessor ip2 = (new Straightener()).straightenLine(imp, lineWidth); int width = ip2.getWidth(); int height = ip2.getHeight(); if (ip2 instanceof FloatProcessor) return 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; imp.setRoi(roi); if (roi.getType()==Roi.POLYLINE&& !((PolygonRoi)roi).isSplineFit()) { ((PolygonRoi)roi).fitSpline(); imp.draw(); } return profile; }
int height = rois.length * linesPerROI; float[][] values = new float[height][]; Straightener straightener = new Straightener(); ImageStack stack = image.getStack(); for (int i = 0; i < rois.length; i++)
int height = rois.length * linesPerROI; float[][] values = new float[height][]; Straightener straightener = new Straightener(); ImageStack stack = image.getStack(); for (int i = 0; i < rois.length; i++)
Straightener straightener = new Straightener(); int w = 1, h = lineWidth; ImageStack stack = image.getStack();
Calibration cal = imp2.getCalibration().copy(); imp2.getCalibration().disableDensityCalibration(); ip2 = (new Straightener()).straightenLine(imp2, lineWidth); imp2.setCalibration(cal); ip2 = convertToOriginalDepth(imp2, ip2); } else if (lineWidth>1) { if ((measurements&AREA)!=0 || (measurements&MEAN)!=0 || calibrated) { ip2 = (new Straightener()).straightenLine(imp2, lineWidth); if (limit!=0) ip2 = convertToOriginalDepth(imp2, ip2);
Calibration cal = imp2.getCalibration().copy(); imp2.getCalibration().disableDensityCalibration(); ip2 = (new Straightener()).straightenLine(imp2, lineWidth); imp2.setCalibration(cal); ip2 = convertToOriginalDepth(imp2, ip2); } else if (lineWidth>1) { if ((measurements&AREA)!=0 || (measurements&MEAN)!=0 || calibrated) { ip2 = (new Straightener()).straightenLine(imp2, lineWidth); if (limit!=0) ip2 = convertToOriginalDepth(imp2, ip2);
ip2.setRoi(saveR); } else { ip2 = (new Straightener()).straightenLine(imp, lineWidth); stats = ImageStatistics.getStatistics(ip2, params, cal);
ip2.setRoi(saveR); } else { ip2 = (new Straightener()).straightenLine(imp, lineWidth); stats = ImageStatistics.getStatistics(ip2, params, cal);