Example #1
0
  public void integrateStackDone(IntegrateExp integrator) {
    // Store background if this integrator is responsible for calculating it
    if (updateBG) {
      double stableMedianOutside = calcStableMedian(0.4, 0.6, curBgOutside);
      double stableMedianInside = calcStableMedian(0.4, 0.6, curBgInside);
      /*
      int medianOutside=EvListUtil.findPercentileInt(curBgOutside.elements(), 0.5, curBgOutside.size());
      int medianInside=EvListUtil.findPercentileInt(curBgInside.elements(), 0.5, curBgInside.size());
      double avg=(double)curBgInt/curBgVol;

      double thisBG=EvMathUtil.minAll(medianOutside,medianInside,avg);
      */

      double thisBG = Math.min(stableMedianOutside, stableMedianInside);

      // int thisBG=EvMathUtil.minAll(medianOutside,medianInside);   //average decreased value in a
      // bad value for one recording!!! I think
      bg.put(integrator.frame, thisBG);
      // bg.put(integrator.frame, (double)median/curBg.size());
      // bg.put(integrator.frame, curBgInt/curBgVol);
    }

    // Store pattern in lineage
    for (int i = 0; i < numSubDiv; i++) {
      // double avg = (double) sliceExp[i]/(double) sliceVol[i];
      double avg = (double) sliceExp[i] / (double) sliceVol[i] - bg.get(integrator.frame);
      //	avg /= integrator.expTime;

      Lineage.Particle nuc = lin.getCreateParticle("_slice" + i);
      LineageExp exp = nuc.getCreateExp(integrator.expName);
      exp.level.put(integrator.frame, avg);

      if (Double.isInfinite(avg) || Double.isNaN(avg))
        System.out.println(
            "Slice inf or nan, frame: "
                + integrator.frame
                + "    "
                + getClass().getSimpleName()
                + "   vol: "
                + sliceVol[i]
                + "    bg: "
                + bg.get(integrator.frame)
                + "    slice: "
                + i);
      //			System.out.println(" "+avg);
    }
    //		System.out.println();

  }
Example #2
0
  public Lineage done(
      IntegrateExp integrator, TreeMap<EvDecimal, Tuple<Double, Double>> correctedExposure) {
    // Set override start and end times
    for (int i = 0; i < numSubDiv; i++) {
      Lineage.Particle nuc = lin.getCreateParticle("_slice" + i);
      nuc.overrideStart = integrator.ch.getFirstFrame();
      nuc.overrideEnd = integrator.ch.getLastFrame();
    }

    // For AP: calculate how to correct exposure
    if (correctedExposure == null)
      correctedExposure =
          ExpUtil.calculateCorrectExposureChange20100709(
              integrator.imset,
              integrator.ch,
              lin,
              integrator.expName,
              new TreeSet<EvDecimal>(integrator.ch.getFrames()),
              bg);
    this.correctedExposure = correctedExposure;

    // Correct for exposure changes
    ExpUtil.correctExposureChange(this.correctedExposure, lin, integrator.expName);

    /*
    		System.out.println();
    		System.out.println("After exp correct: "+lin.getCreateNuc("_slice0").exp.get(integrator.expName).level);
    */

    // This is only for the eye
    double sigMax = ExpUtil.getSignalMax(lin, integrator.expName);
    double sigMin = ExpUtil.getSignalMin(lin, integrator.expName);
    //	System.out.println("-----------old signal min: "+numSubDiv+"   "+ExpUtil.getSignalMin(lin,
    // integrator.expName));
    ExpUtil.normalizeSignal(lin, integrator.expName, sigMax, sigMin, 1);
    //	System.out.println("-----------new signal min: "+numSubDiv+"   "+ExpUtil.getSignalMin(lin,
    // integrator.expName));

    /*
    		System.out.println();
    		System.out.println("final exp: "+lin.getCreateNuc("_slice0").exp.get(integrator.expName).level.values());
    */
    return lin;
  }