private void fitEllipse(){ if(fittedEllipse==null){ fittedEllipse = new EllipseFitter(); Rectangle r = outerContour.getBounds(); ImagePlus help = NewImage.createByteImage("", r.width+1, r.height+1, 1, NewImage.FILL_WHITE); ByteProcessor ip = (ByteProcessor) help.getProcessor(); ip.setColor(Color.black); Polygon p = new Polygon(outerContour.xpoints, outerContour.ypoints, outerContour.npoints); p.translate(-r.x, -r.y); ip.resetRoi(); ip.setRoi(p); fittedEllipse.fit(ip, null); } }
/** delete a particle (set from value 255 to current fill value). * Position x,y must be within the particle */ void deleteParticle(int x, int y, ByteProcessor ip, Wand wand) { wand.autoOutline(x, y, 255, 255); if (wand.npoints==0) { IJ.log("wand error selecting edge particle at x, y = "+x+", "+y); return; } Roi roi = new PolygonRoi(wand.xpoints, wand.ypoints, wand.npoints, Roi.TRACED_ROI); ip.snapshot(); //prepare for reset outside of mask ip.setRoi(roi); ip.fill(); ip.reset(ip.getMask()); }
/** delete a particle (set from value 255 to current fill value). * Position x,y must be within the particle */ void deleteParticle(int x, int y, ByteProcessor ip, Wand wand) { wand.autoOutline(x, y, 255, 255); if (wand.npoints==0) { IJ.log("wand error selecting edge particle at x, y = "+x+", "+y); return; } Roi roi = new PolygonRoi(wand.xpoints, wand.ypoints, wand.npoints, Roi.TRACED_ROI); ip.snapshot(); //prepare for reset outside of mask ip.setRoi(roi); ip.fill(); ip.reset(ip.getMask()); }
/** delete a particle (set from value 255 to current fill value). * Position x,y must be within the particle */ void deleteParticle(int x, int y, ByteProcessor ip, Wand wand) { wand.autoOutline(x, y, 255, 255); if (wand.npoints==0) { IJ.log("wand error selecting edge particle at x, y = "+x+", "+y); return; } Roi roi = new PolygonRoi(wand.xpoints, wand.ypoints, wand.npoints, Roi.TRACED_ROI); ip.snapshot(); //prepare for reset outside of mask ip.setRoi(roi); ip.fill(); ip.reset(ip.getMask()); }
bp.setRoi( roi ); final int[] histogram = bp.getHistogram(); // Get histogram from the ROI
Rectangle bounds = roi.getBounds(); roi.setLocation(bounds.x - xmin, bounds.y - ymin); bp.setRoi(roi); if (roi.getType() == Roi.RECTANGLE) bp.fill();
bp.setRoi( roi ); final int[] histogram = bp.getHistogram(); // Get histogram from the ROI
Rectangle bounds = roi.getBounds(); roi.setLocation(bounds.x - xmin, bounds.y - ymin); bp.setRoi(roi); if (roi.getType() == Roi.RECTANGLE) bp.fill();
private void eraseHeaderAreas (ByteProcessor buffer) { final int dmzDyMargin = sheet.getScale().toPixels(constants.staffVerticalMargin); buffer.setValue(255); for (SystemInfo system : sheet.getSystems()) { Staff firstStaff = system.getFirstStaff(); Staff lastStaff = system.getLastStaff(); int start = system.getBounds().x; int stop = firstStaff.getHeaderStop(); int top = firstStaff.getFirstLine().yAt(stop) - dmzDyMargin; int bot = lastStaff.getLastLine().yAt(stop) + dmzDyMargin; buffer.setRoi(start, top, stop - start + 1, bot - top + 1); buffer.fill(); buffer.resetRoi(); } buffer.setValue(0); }