示例#1
0
 /* Wraps everything into a Cell Manager Class*/
 private CellManager toCellManager(ImagePlus imp, ArrayList<PolygonRoi> rois, ImagePlus av_imp) {
   CellManager cm = new CellManager(av_imp, imp, this.ovr);
   Iterator itr = rois.iterator();
   ArrayList<Double> av_sig = new ArrayList<>();
   PolygonRoi roi;
   while (itr.hasNext()) {
     roi = (PolygonRoi) itr.next();
     av_sig = Activity_Analysis.getAverageSignal(imp, roi);
     CalciumSignal ca_sig = new CalciumSignal(av_sig, this.dt_r);
     ovr.add(roi);
     ca_sig.DeltaF();
     cm.addCell(ca_sig, roi);
   }
   //            catch(Exception e){
   //                IJ.showMessage(e.getMessage());
   //            }
   //        }
   ovr.setLabelColor(Color.WHITE);
   //        ovr.setFillColor(Color.GREEN);
   ovr.setStrokeColor(Color.getHSBColor(100, 30, 87));
   av_imp.setOverlay(ovr);
   av_imp.show();
   IJ.run("In [+]", "");
   IJ.run("In [+]", "");
   return cm;
 }
示例#2
0
 void drawAllROIs(Graphics g) {
   RoiManager rm = RoiManager.getInstance();
   if (rm == null) {
     rm = Interpreter.getBatchModeRoiManager();
     if (rm != null && rm.getList().getItemCount() == 0) rm = null;
   }
   if (rm == null) {
     // if (showAllList!=null)
     //	overlay = showAllList;
     showAllROIs = false;
     repaint();
     return;
   }
   initGraphics(g, null, showAllColor);
   Hashtable rois = rm.getROIs();
   java.awt.List list = rm.getList();
   boolean drawLabels = rm.getDrawLabels();
   currentRoi = null;
   int n = list.getItemCount();
   if (IJ.debugMode) IJ.log("paint: drawing " + n + " \"Show All\" ROIs");
   if (labelRects == null || labelRects.length != n) labelRects = new Rectangle[n];
   if (!drawLabels) showAllList = new Overlay();
   else showAllList = null;
   if (imp == null) return;
   int currentImage = imp.getCurrentSlice();
   int channel = 0, slice = 0, frame = 0;
   boolean hyperstack = imp.isHyperStack();
   if (hyperstack) {
     channel = imp.getChannel();
     slice = imp.getSlice();
     frame = imp.getFrame();
   }
   drawNames = Prefs.useNamesAsLabels;
   for (int i = 0; i < n; i++) {
     String label = list.getItem(i);
     Roi roi = (Roi) rois.get(label);
     if (roi == null) continue;
     if (showAllList != null) showAllList.add(roi);
     if (i < 200 && drawLabels && roi == imp.getRoi()) currentRoi = roi;
     if (Prefs.showAllSliceOnly && imp.getStackSize() > 1) {
       if (hyperstack && roi.getPosition() == 0) {
         int c = roi.getCPosition();
         int z = roi.getZPosition();
         int t = roi.getTPosition();
         if ((c == 0 || c == channel) && (z == 0 || z == slice) && (t == 0 || t == frame))
           drawRoi(g, roi, drawLabels ? i : -1);
       } else {
         int position = roi.getPosition();
         if (position == 0) position = getSliceNumber(roi.getName());
         if (position == 0 || position == currentImage) drawRoi(g, roi, drawLabels ? i : -1);
       }
     } else drawRoi(g, roi, drawLabels ? i : -1);
   }
   ((Graphics2D) g).setStroke(Roi.onePixelWide);
   drawNames = false;
 }
示例#3
0
 /** Return the ROI Manager "Show All" list as an overlay. */
 public Overlay getShowAllList() {
   if (!showAllROIs) return null;
   if (showAllList != null) return showAllList;
   RoiManager rm = RoiManager.getInstance();
   if (rm == null) return null;
   Roi[] rois = rm.getRoisAsArray();
   if (rois.length == 0) return null;
   Overlay overlay = new Overlay();
   for (int i = 0; i < rois.length; i++) overlay.add((Roi) rois[i].clone());
   return overlay;
 }
示例#4
0
 /** @deprecated replaced by ImagePlus.setOverlay(Shape, Color, BasicStroke) */
 public void setDisplayList(Shape shape, Color color, BasicStroke stroke) {
   if (shape == null) {
     setOverlay(null);
     return;
   }
   Roi roi = new ShapeRoi(shape);
   roi.setStrokeColor(color);
   roi.setStroke(stroke);
   Overlay list = new Overlay();
   list.add(roi);
   setOverlay(list);
 }
示例#5
0
 /** @deprecated replaced by ImagePlus.setOverlay(Roi, Color, int, Color) */
 public void setDisplayList(Roi roi, Color color) {
   roi.setStrokeColor(color);
   Overlay list = new Overlay();
   list.add(roi);
   setOverlay(list);
 }