void drawRoi(Graphics g, Roi roi, int index) { int type = roi.getType(); ImagePlus imp2 = roi.getImage(); roi.setImage(imp); Color saveColor = roi.getStrokeColor(); if (saveColor == null) roi.setStrokeColor(defaultColor); if (roi instanceof TextRoi) ((TextRoi) roi).drawText(g); else roi.drawOverlay(g); roi.setStrokeColor(saveColor); if (index >= 0) { if (roi == currentRoi) g.setColor(Roi.getColor()); else g.setColor(defaultColor); drawRoiLabel(g, index, roi); } if (imp2 != null) roi.setImage(imp2); else roi.setImage(null); }