Skip to content

PORT: fix display of durations on the acquisition panel#421

Merged
bls337 merged 3 commits into
micro-manager:mainfrom
bls337:main
Jul 2, 2026
Merged

PORT: fix display of durations on the acquisition panel#421
bls337 merged 3 commits into
micro-manager:mainfrom
bls337:main

Conversation

@bls337

@bls337 bls337 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

The 1.4 diSPIM plugin uses getNumTimepoints() which always returns 1 if time points are enabled, LSM was using acqSettings_.numTimePoints() directly, LSM now matches the behavior of the original plugin in computeActualTimeLapseDuration() => computeTotalTimeDuration().

There was also a GUI display bug in the port of the code where it would only write the seconds in the // between 1 min and 1 hour branch and only write the minutes in the // longer than 1 hour branch. Very clear bug.

There was another place in AcquisitionEngineScape.java that used acqSettings_.numTimePoints() directly when it needed to clamp the value to 1 if time points are not enabled.

The number of time points could be a left over value such as 10 and trigger this code even if not enabled.

TODO: it looks like I missed the ! in the port for item 3, I will add this in one of the next commits.

   // Item 1
   private int getNumTimepoints() {
      if (useTimepointsCB_.isSelected()) {
         return (Integer) numTimepoints_.getValue();
      } else {
         return 1;
      }
   }
   
   private double computeActualTimeLapseDuration() {
      double duration = (getNumTimepoints() - 1) * getTimepointInterval() 
            + computeTimepointDuration()/1000;
      return duration;
   }
   
    // Item 2
    private void updateActualTimeLapseDurationLabel() {
      String s = "";
      double duration = computeActualTimeLapseDuration();
      if (duration < 60) {  // less than 1 min
         s += NumberUtils.doubleToDisplayString(duration) + " s";
      } else if (duration < 60*60) { // between 1 min and 1 hour
         s += NumberUtils.doubleToDisplayString(Math.floor(duration/60)) + " min ";
         s += NumberUtils.doubleToDisplayString(Math.round(duration %  60)) + " s";
      } else { // longer than 1 hour
         s += NumberUtils.doubleToDisplayString(Math.floor(duration/(60*60))) + " hr ";
         s +=  NumberUtils.doubleToDisplayString(Math.round((duration % (60*60))/60)) + " min";
      }
      actualTimeLapseDurationLabel_.setText(s);
   }
   
      // Item 3   
      // make sure we aren't trying to collect timepoints faster than we can
      if (!acqSettings.useMultiPositions && acqSettings.numTimepoints > 1) {
         if (timepointIntervalMs < volumeDuration) {
            MyDialogUtils.showError("Time point interval shorter than" +
                  " the time to collect a single volume.", hideErrors);
            return AcquisitionStatus.FATAL_ERROR;
         }
      }

@bls337 bls337 merged commit 43978ca into micro-manager:main Jul 2, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant