/////////////////////////////////////////////////////////////////////// // Acquire Full Chip Asynchronously /////////////////////////////////////////////////////////////////////// private void AcquireAsync_Click(object sender, RoutedEventArgs e) { // Can we do this? if (!ValidateAcquisition()) { return; } // In case a previous run was not completed make sure we start out not listening experiment_.ExperimentStarted -= exp_AcquisitionStarted; experiment_.ExperimentCompleted -= exp_AcquisitionComplete; acquisitionsCompleted_ = 0; totalAcquisitions_ = 3; frames_ = 1; // We want unique file names for this experiment_.SetValue(ExperimentSettings.FileNameGenerationAttachIncrement, true); // Set number of frames experiment_.SetValue(ExperimentSettings.AcquisitionFramesToStore, frames_); // Connect Completion Event experiment_.ExperimentStarted += exp_AcquisitionStarted; // Begin the acquisition (Note: current exposure, frames, filename etc will be used) experiment_.Acquire(); }
/////////////////////////////////////////////////////////////////////// // Override some typical settings and acquire an spe file with a // specific name. /////////////////////////////////////////////////////////////////////// private void control__Click(object sender, RoutedEventArgs e) { // Are we in a state where we can do this? if (!ValidateAcquisition()) { return; } // Get the experiment object IExperiment experiment = LightFieldApplication.Experiment; if (experiment != null) { // Not All Systems Have an Exposure Setting, if they do get the minimum and set it if (experiment.Exists(CameraSettings.ShutterTimingExposureTime)) { ISettingRange currentRange = experiment.GetCurrentRange(CameraSettings.ShutterTimingExposureTime); experiment.SetValue(CameraSettings.ShutterTimingExposureTime, currentRange.Minimum); } // Don't Attach Date/Time experiment.SetValue(ExperimentSettings.FileNameGenerationAttachDate, false); experiment.SetValue(ExperimentSettings.FileNameGenerationAttachTime, false); // Save file as Specific.Spe to the default directory experiment.SetValue(ExperimentSettings.FileNameGenerationBaseFileName, "Specific"); // Connnect the event handler acquireCompletedEventHandler_ = new EventHandler <ExperimentCompletedEventArgs>(exp_AcquisitionComplete); experiment.ExperimentCompleted += acquireCompletedEventHandler_; // Begin the acquisition experiment.Acquire(); } }
private void testAquire(int index) { // application.Experiment.Acquire(); // Are we in a state where we can do this? // if (!ValidateAcquisition()) // return; // Get the experiment object IExperiment experiment = application.Experiment; if (experiment != null) { // Not All Systems Have an Exposure Setting, if they do get the minimum and set it if (experiment.Exists(CameraSettings.ShutterTimingExposureTime)) { // ISettingRange currentRange = experiment.GetCurrentRange(CameraSettings.ShutterTimingExposureTime); // experiment.SetValue(CameraSettings.ShutterTimingExposureTime, currentRange.Minimum); } // Attach Date/Time to filename experiment.SetValue(ExperimentSettings.FileNameGenerationAttachDate, true); experiment.SetValue(ExperimentSettings.FileNameGenerationAttachTime, true); // Save file as Specific.Spe to the default directory experiment.SetValue(ExperimentSettings.FileNameGenerationBaseFileName, "SpecificZ"); // Connnect the event handler acquireCompletedEventHandler_ = new EventHandler <ExperimentCompletedEventArgs>(exp_AcquisitionComplete); experiment.ExperimentCompleted += acquireCompletedEventHandler_; // Begin the acquisition experiment.Acquire(); } }
/////////////////////////////////////////////////////////////////////// public void startAcquisition(int index) { // Are we in a state where we can do this? if (!ValidateAcquisition()) { return; } currentImageIndex = index; // Get the experiment object IExperiment experiment = LightFieldApplication.Experiment; if (experiment != null) { // Attach Date/Time to filename experiment.SetValue(ExperimentSettings.FileNameGenerationAttachDate, true); experiment.SetValue(ExperimentSettings.FileNameGenerationAttachTime, true); // Save Spe (and tif) to the specified directory if (saveDirectory != null) { //userInterface.printMessage(saveDirectory + "\r\n"); //experiment.SetValue(ExperimentSettings.FileNameGenerationDirectory, "C:\\Users\\Jason\\Code\\dev\\stidatatest\\2017\\9\\30\\" + "data"); experiment.SetValue(ExperimentSettings.FileNameGenerationDirectory, saveDirectory); //string dir = experiment.GetValue(ExperimentSettings.FileNameGenerationDirectory).ToString(); //userInterface.printMessage(dir + "\r\n"); //userInterface.printMessage("Compare: "+ String.Compare(dir, saveDirectory).ToString()); } //Save file as Specific.Spe to the default directory //experiment.SetValue(ExperimentSettings.FileNameGenerationBaseFileName, "Specific2"); // Connnect the event handler acquireCompletedEventHandler_ = new EventHandler <ExperimentCompletedEventArgs>(AcquisitionCompleteHandler); experiment.ExperimentCompleted += acquireCompletedEventHandler_; // Begin the acquisition experiment.Acquire(); } }
/////////////////////////////////////////////////////////////////////// // Synchronous Full Frame Acquire /////////////////////////////////////////////////////////////////////// private void AcquireFullFrameSync(object sender, RoutedEventArgs e) { // Are we in a state we can do this? if (!ValidateAcquisition()) { return; } // Get the experiment object IExperiment experiment = application_.Experiment; // Full Frame experiment.SetFullSensorRegion(); int images = 3; int frames = 1; experiment.SetValue(ExperimentSettings.AcquisitionFramesToStore, frames); for (int i = 1; i <= images; i++) { // Capture 1 Frame IImageDataSet set = experiment.Capture(frames); // Stop processing if we do not have all frames if (set.Frames != frames) { // Clean up the image data set set.Dispose(); throw new ArgumentException("Frames are not equal"); } // Get the data from the current frame Array imageData = set.GetFrame(0, frames - 1).GetData(); // Cache the frame IImageData imageFrame = set.GetFrame(0, frames - 1); PrintData(imageData, imageFrame, i, images); } }
/////////////////////////////////////////////////////////////////////// // Acquire 5 Frames With Stamping On /////////////////////////////////////////////////////////////////////// private void button1_Click(object sender, RoutedEventArgs e) { // Are we in a state where we can acquire? if (!ValidateAcquisition()) { return; } // Get the experiment object IExperiment experiment = app_.Experiment; if (experiment != null) { // Empty the time stamping collection stampCollection_.Clear(); // Turn On Time Stamping experiment.SetValue(CameraSettings.AcquisitionTimeStampingStamps, TimeStamps.ExposureEnded | TimeStamps.ExposureStarted); // Turn On Frame Tracking experiment.SetValue(CameraSettings.AcquisitionFrameTrackingEnabled, true); // Don't Attach Date/Time experiment.SetValue(ExperimentSettings.FileNameGenerationAttachDate, false); experiment.SetValue(ExperimentSettings.FileNameGenerationAttachTime, false); // Save file as Specific.Spe to the default directory experiment.SetValue(ExperimentSettings.FileNameGenerationBaseFileName, "MetaDataSample"); // Set the number of frames to 5 experiment.SetValue(ExperimentSettings.AcquisitionFramesToStore, textBoxFrames.Text); // Connect Completion Event acquireCompletedEventHandler_ = new EventHandler <ExperimentCompletedEventArgs>(experiment_ExperimentCompleted); experiment.ExperimentCompleted += acquireCompletedEventHandler_; // Capture 5 Frames experiment.Acquire(); } }