Пример #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
  /* Replaces all sample index in imp with neighbor sample*/
  public static ImagePlus ReplaceSlices(ImagePlus imp, ArrayList<Integer> samples) {
    ImageStack ims = imp.getStack();
    Iterator itr = samples.iterator();
    while (itr.hasNext()) {
      Integer k = (Integer) itr.next();
      if (k == 0) {
        continue;
      }
      ImageProcessor ip_slice = ims.getProcessor(k);
      //            double value_1 = getMeanOfSlice(ims.getProcessor(k-1));
      //            double value_2 = getMeanOfSlice(ims.getProcessor(k));
      //            double value_3 = getMeanOfSlice(ims.getProcessor(k+1));
      //            double value_4 = getMeanOfSlice(ims.getProcessor(k+2));

      // System.out.print("Replacing "+ value_ori+"with " +value_re );
      ims.addSlice("", ip_slice, k);
      ims.deleteSlice(k + 2);
    }
    imp.setStack(ims);
    return imp;
  }