/////////////////////////////////////////////////////////////////////// // Acquire Completed Handler // This just fires a message saying that the data is acquired. /////////////////////////////////////////////////////////////////////// void exp_AcquisitionComplete(object sender, ExperimentCompletedEventArgs e) { // We can not call acquire in the completed handler, it must be deferred because // the current acquisition will not be considered complete until this handler has // returned. Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action)(() => { acquisitionsCompleted_++; ShowImageDataFromLastAcquire(); // Disconnect from the completed as the start event will reconnect experiment_.ExperimentCompleted -= exp_AcquisitionComplete; // Start the next one if (acquisitionsCompleted_ < totalAcquisitions_) { experiment_.Acquire(); } // Or no starts and disconnect starting as the next button click // will reconnect started. else { experiment_.ExperimentStarted -= exp_AcquisitionStarted; } })); }
/////////////////////////////////////////////////////////////////////// // Acquire Completed Handler /////////////////////////////////////////////////////////////////////// void experiment_ExperimentCompleted(object sender, ExperimentCompletedEventArgs e) { ((IExperiment)sender).ExperimentCompleted -= acquireCompletedEventHandler_; IFileManager fileManager = LightFieldApplication.FileManager; if (fileManager != null) { // 2.) Find the image ---------------------------------------------------------- //------------------------------------------------------------------------------ // Get the recently acquired file list IList <string> files = fileManager.GetRecentlyAcquiredFileNames(); if (files.Count != 0) { double[] waveLengths; double[] errors; // 3.) Get the xml out of the image and from that pull the calibration/error--- //----------------------------------------------------------------------------- // Get the image dataset IImageDataSet dataSet = fileManager.OpenFile(files[0], System.IO.FileAccess.Read); GetCalibrationAndError(dataSet, out waveLengths, out errors); // 4.) Create a new file of user data //------------------------------------------------------------------------------ ' CreateCalibratedFile(waveLengths, errors); } } }
/////////////////////////////////////////////////////////////////////// // Acquire Completed Handler // Returns the saved filenames (spe, tif) to the device and signal the device to stop. /////////////////////////////////////////////////////////////////////// public void AcquisitionCompleteHandler(object sender, ExperimentCompletedEventArgs e) { ((IExperiment)sender).ExperimentCompleted -= acquireCompletedEventHandler_; string spe_filename = getRecentFilename(); wrapper.setSavedSPEFilename(currentImageIndex, spe_filename); Export_Tiff(spe_filename); string tif_filename = Path.ChangeExtension(spe_filename, ".tif"); wrapper.setSavedImageFilename(currentImageIndex, tif_filename); wrapper.stopWaiting(currentImageIndex); }
/////////////////////////////////////////////////////////////////////// // Acquire Completed Handler /////////////////////////////////////////////////////////////////////// void experiment_ExperimentCompleted(object sender, ExperimentCompletedEventArgs e) { ((IExperiment)sender).ExperimentCompleted -= acquireCompletedEventHandler_; IFileManager fileManager = app_.FileManager; if (fileManager != null) { // Get the recently acquired file list IList <string> files = fileManager.GetRecentlyAcquiredFileNames(); // Open the last one if there is one if (files.Count != 0) { // We can't update our observable collection here it must be done on this dispatcher not // from within this callback Dispatcher.Invoke( System.Windows.Threading.DispatcherPriority.Background, new Action(delegate() { // Get the image dataset IImageDataSet dataSet = fileManager.OpenFile(files[0], System.IO.FileAccess.Read); // show the origin origin.Text = dataSet.TimeStampOrigin.ToString(); // Display the Meta Data for each frame for (int i = 0; i < dataSet.Frames; i++) { Metadata md = dataSet.GetFrameMetaData(i); // by adding the meta data to the observable collection it appears in the listview stampCollection_.Add(new StampData { ExposureStart = md.ExposureStarted, ExposureEnd = md.ExposureEnded, Frame = md.FrameTrackingNumber, GateTrackingDelay = md.GateTrackingDelay, GateTrackingWidth = md.GateTrackingWidth, TrackingPhase = md.ModulationTrackingPhase }); } })); } } }
/////////////////////////////////////////////////////////////////////// // Acquire Completed Handler // This just fires a message saying that the data is acquired. /////////////////////////////////////////////////////////////////////// void exp_AcquisitionComplete(object sender, ExperimentCompletedEventArgs e) { ((IExperiment)sender).ExperimentCompleted -= acquireCompletedEventHandler_; MessageBox.Show("Acquire Completed"); }
void exp_AcquisitionComplete(object sender, ExperimentCompletedEventArgs e) { ((IExperiment)sender).ExperimentCompleted -= acquireCompletedEventHandler_; }