@@ -352,7 +352,11 @@ boolean run() {
352352 // never wait on an Acquisition that was not finished: the wait is unbounded
353353 return false ;
354354 }
355+ tracker_ .show (new RunProgress .Source (progressShape (settings , cameraNames ), 0 , 0L ,
356+ tracker_ ::imagesInDataset , runSchedule (settings , currentAcquisition_ )));
355357 currentAcquisition_ .waitForCompletion ();
358+ // the dataset is complete, so its count is final
359+ tracker_ .freeze ();
356360 return true ;
357361 }
358362
@@ -368,6 +372,31 @@ private static boolean isSeparatingTimePoints(final ScapeAcquisitionSettings set
368372 return settings .isUsingTimePoints () && settings .isUsingSeparateTimePoints ();
369373 }
370374
375+ /**
376+ * The size of the run the status line counts against, as the events are built.
377+ */
378+ private RunProgress .Shape progressShape (final ScapeAcquisitionSettings settings ,
379+ final String [] cameraNames ) {
380+ final int numPositions = settings .isUsingMultiplePositions ()
381+ ? positionList_ .getNumberOfPositions () : 1 ;
382+ return new RunProgress .Shape (numTimePointsToAcquire (settings ), numPositions ,
383+ settings .volume ().slicesPerView () * settings .channels ().count ()
384+ * cameraNames .length );
385+ }
386+
387+ /**
388+ * When each time point of a run in one dataset is due, on AcqEngJ's schedule. Under hardware
389+ * time points the controller paces them and nothing waits.
390+ */
391+ private static RunProgress .Schedule runSchedule (final ScapeAcquisitionSettings settings ,
392+ final Acquisition acquisition ) {
393+ if (settings .isUsingHardwareTimePoints ()) {
394+ return RunProgress .Schedule .NONE ;
395+ }
396+ return RunProgress .fromAcquisitionStart (acquisition ::getStartTimeMs ,
397+ settings .timePointIntervalSec () * 1000.0 , System ::currentTimeMillis );
398+ }
399+
371400 /**
372401 * Resolves the camera device names the events are addressed to.
373402 *
@@ -972,6 +1001,10 @@ private boolean runSeparateTimePoints(final ScapeAcquisitionSettings settings,
9721001 }
9731002
9741003 final long seriesStartNs = System .nanoTime ();
1004+ // the status line: the run's size, on the clock the wait below uses
1005+ final RunProgressTracker .Series status = tracker_ .series (
1006+ progressShape (settings , cameraNames ),
1007+ RunProgress .fromSeriesStart (seriesStartNs , intervalMs , System ::nanoTime ));
9751008 // directory names of the completed datasets
9761009 final List <String > datasetNames = new ArrayList <>();
9771010 // the time points that failed, reported together when the series ends
@@ -984,6 +1017,9 @@ private boolean runSeparateTimePoints(final ScapeAcquisitionSettings settings,
9841017 int inFlightIndex = -1 ;
9851018 try {
9861019 for (int timeIndex = 0 ; timeIndex < numTimePoints ; timeIndex ++) {
1020+ if (timeIndex > 0 ) {
1021+ status .awaiting (timeIndex );
1022+ }
9871023 if (!awaitTimePointSlot (seriesStartNs , timeIndex , intervalMs )) {
9881024 break ; // stop requested during the wait
9891025 }
@@ -998,12 +1034,14 @@ private boolean runSeparateTimePoints(final ScapeAcquisitionSettings settings,
9981034 timeIndex )) {
9991035 break ; // nothing started, so nothing to wait for
10001036 }
1037+ status .acquiring (timeIndex );
10011038 if (previousStore != null ) {
10021039 closeDisplaysOnInterfaceThread (previousStore , timeIndex - 1 );
10031040 previousStore = null ;
10041041 }
10051042 // returns once the store is frozen, so the dataset is complete on disk
10061043 currentAcquisition_ .waitForCompletion ();
1044+ status .datasetComplete ();
10071045
10081046 final String datasetDir = datastore_ .getSavePath ();
10091047 previousStore = datastore_ ;
@@ -1015,6 +1053,8 @@ private boolean runSeparateTimePoints(final ScapeAcquisitionSettings settings,
10151053 }
10161054 }
10171055 } finally {
1056+ // where the series stopped, not where the countdown is once the cleanup ends
1057+ tracker_ .freeze ();
10181058 // no save path means no directory was created, so there is nothing to mark
10191059 final String inFlightDir = datastore_ == null ? null : datastore_ .getSavePath ();
10201060 if (inFlightIndex >= 0 && inFlightDir != null ) {
0 commit comments