public void SetEnergyType(LINAC_ENERGY_TYPE_VALUE value) { int energy = (int)Enum.ToObject(typeof(LINAC_ENERGY_TYPE_VALUE), value); base.UpdatePLCTagValue(_OpcTags.LINAC_ENERGY_TYPE.Name, energy); }
public string CreatePXEFile(LINAC_ENERGY_TYPE_VALUE energy, PulseWidth pulseWidth, List <DataInfo> ObjectLines) { lock (_writeLock) { string pxeFile = Path.Combine(AppConfiguration.HostTempFileLocation, DateTime.Now.ToString(_dateFormat) + _pxeExtension); _pxeWriteAccess.CreatePXE(pxeFile); try { List <Pixel[]> highEnergyLines = new List <Pixel[]>(); List <Pixel[]> lowEnergyLines = new List <Pixel[]>(); XRayInfoIDStruct highEnergyInfo = default(XRayInfoIDStruct); XRayInfoIDStruct lowEnergyInfo = default(XRayInfoIDStruct); if (energy == LINAC_ENERGY_TYPE_VALUE.Dual) { if (ObjectLines[0].XRayInfo.Energy == XRayEnergyEnum.HighEnergy) { ObjectLines.RemoveAt(0); } } //store object line data foreach (DataInfo dataLine in ObjectLines) { if (dataLine.XRayInfo.Energy == XRayEnergyEnum.HighEnergy) { highEnergyLines.Add(dataLine.LineData); highEnergyInfo = dataLine.XRayInfo; } else //low energy { lowEnergyLines.Add(dataLine.LineData); lowEnergyInfo = dataLine.XRayInfo; } } int maxLength = Math.Min(lowEnergyLines.Count, highEnergyLines.Count); if (maxLength == 0) { maxLength = Math.Max(lowEnergyLines.Count, highEnergyLines.Count); } if (maxLength > AppConfiguration.MaxPXEWidth) { maxLength = AppConfiguration.MaxPXEWidth; } if (energy != LINAC_ENERGY_TYPE_VALUE.Low && highEnergyLines.Count > 0) { int bufferSize = maxLength * highEnergyLines[0].Length; if (bufferSize > 0) { float[] buffer = new float[bufferSize]; Parallel.For(highEnergyLines.Count - maxLength, maxLength, index => { float[] pixelArray = PixelConverter.Convert(highEnergyLines[index]); int length = Buffer.ByteLength(pixelArray); Buffer.BlockCopy(pixelArray, 0, buffer, index * length, length); }); if (energy == LINAC_ENERGY_TYPE_VALUE.Dual) { _pxeWriteAccess.CreateHiPXEHeader((uint)maxLength, (uint)highEnergyLines[0].Length); _pxeWriteAccess.WriteHiDataLines(buffer, (uint)maxLength); _pxeWriteAccess.WriteHighEngDarkSample(PixelConverter.Convert(_calibration.GetDarkData(highEnergyInfo))); _pxeWriteAccess.WriteHighEngAirSample(PixelConverter.Convert(_calibration.GetAirData(highEnergyInfo))); if (AppConfiguration.StoreReferenceCorrection) { _pxeWriteAccess.WriteHiRef(_calibration.GetReferenceCorrections(highEnergyInfo)); } if (AppConfiguration.StoreScaleFactor) { _pxeWriteAccess.WriteHiScaleFactor(_calibration.GetScaleFactor(highEnergyInfo)); } if (AppConfiguration.StoreAirDarkSamples) { _pxeWriteAccess.WriteHiFullAirData(PixelConverter.Convert(_calibration.GetAirDataCollection(highEnergyInfo)), Convert.ToUInt32(AppConfiguration.CalibrationDataLines)); _pxeWriteAccess.WriteHiFullDarkData(PixelConverter.Convert(_calibration.GetDarkDataCollection(highEnergyInfo)), Convert.ToUInt32(AppConfiguration.CalibrationDataLines)); } } else { _pxeWriteAccess.CreateHiPXEHeader((uint)maxLength, (uint)highEnergyLines[0].Length); _pxeWriteAccess.WriteHiDataLines(buffer, (uint)maxLength); _pxeWriteAccess.WriteHighEngDarkSample(PixelConverter.Convert(_calibration.GetDarkData(highEnergyInfo))); _pxeWriteAccess.WriteHighEngAirSample(PixelConverter.Convert(_calibration.GetAirData(highEnergyInfo))); if (AppConfiguration.StoreReferenceCorrection) { _pxeWriteAccess.WriteHiRef(_calibration.GetReferenceCorrections(highEnergyInfo)); } if (AppConfiguration.StoreScaleFactor) { _pxeWriteAccess.WriteHiScaleFactor(_calibration.GetScaleFactor(highEnergyInfo)); } if (AppConfiguration.StoreAirDarkSamples) { _pxeWriteAccess.WriteHiFullAirData(PixelConverter.Convert(_calibration.GetAirDataCollection(highEnergyInfo)), Convert.ToUInt32(AppConfiguration.CalibrationDataLines)); _pxeWriteAccess.WriteHiFullDarkData(PixelConverter.Convert(_calibration.GetDarkDataCollection(highEnergyInfo)), Convert.ToUInt32(AppConfiguration.CalibrationDataLines)); } } } highEnergyLines.Clear(); } if (energy != LINAC_ENERGY_TYPE_VALUE.High && lowEnergyLines.Count > 0) { int bufferSize = maxLength * lowEnergyLines[0].Length; if (bufferSize > 0) { float[] buffer = new float[bufferSize]; Parallel.For(0, maxLength, index => { float[] pixelArray = PixelConverter.Convert(lowEnergyLines[index]); int length = Buffer.ByteLength(pixelArray); Buffer.BlockCopy(pixelArray, 0, buffer, index * length, length); }); if (energy == LINAC_ENERGY_TYPE_VALUE.Dual) { _pxeWriteAccess.CreateLoPXEHeader((uint)maxLength, (uint)lowEnergyLines[0].Length); _pxeWriteAccess.WriteLoDataLines(buffer, (uint)maxLength); _pxeWriteAccess.WriteLowEngDarkSample(PixelConverter.Convert(_calibration.GetDarkData(lowEnergyInfo))); _pxeWriteAccess.WriteLowEngAirSample(PixelConverter.Convert(_calibration.GetAirData(lowEnergyInfo))); if (AppConfiguration.StoreReferenceCorrection) { _pxeWriteAccess.WriteLoRef(_calibration.GetReferenceCorrections(lowEnergyInfo)); } if (AppConfiguration.StoreScaleFactor) { _pxeWriteAccess.WriteLoScaleFactor(_calibration.GetScaleFactor(lowEnergyInfo)); } if (AppConfiguration.StoreAirDarkSamples) { _pxeWriteAccess.WriteLoFullAirData(PixelConverter.Convert(_calibration.GetAirDataCollection(lowEnergyInfo)), Convert.ToUInt32(AppConfiguration.CalibrationDataLines)); _pxeWriteAccess.WriteLoFullDarkData(PixelConverter.Convert(_calibration.GetDarkDataCollection(lowEnergyInfo)), Convert.ToUInt32(AppConfiguration.CalibrationDataLines)); } } else { _pxeWriteAccess.CreateLoPXEHeader((uint)maxLength, (uint)lowEnergyLines[0].Length); _pxeWriteAccess.WriteLoDataLines(buffer, (uint)maxLength); _pxeWriteAccess.WriteLowEngDarkSample(PixelConverter.Convert(_calibration.GetDarkData(lowEnergyInfo))); _pxeWriteAccess.WriteLowEngAirSample(PixelConverter.Convert(_calibration.GetAirData(lowEnergyInfo))); if (AppConfiguration.StoreReferenceCorrection) { _pxeWriteAccess.WriteLoRef(_calibration.GetReferenceCorrections(lowEnergyInfo)); } if (AppConfiguration.StoreScaleFactor) { _pxeWriteAccess.WriteLoScaleFactor(_calibration.GetScaleFactor(lowEnergyInfo)); } if (AppConfiguration.StoreAirDarkSamples) { _pxeWriteAccess.WriteLoFullAirData(PixelConverter.Convert(_calibration.GetAirDataCollection(lowEnergyInfo)), Convert.ToUInt32(AppConfiguration.CalibrationDataLines)); _pxeWriteAccess.WriteLoFullDarkData(PixelConverter.Convert(_calibration.GetDarkDataCollection(lowEnergyInfo)), Convert.ToUInt32(AppConfiguration.CalibrationDataLines)); } } } lowEnergyLines.Clear(); } } catch { } try { _pxeWriteAccess.ClosePXEWrite(); } catch (Exception e) { _log.LogError("Exception closing PXEWrite."); _log.LogError(e.GetType().ToString() + ": " + e.Message); _log.LogError(e.StackTrace); } return(pxeFile); } }
public string CreatePXEFile(LINAC_ENERGY_TYPE_VALUE energy, PulseWidth pulseWidth, List<DataInfo> ObjectLines) { lock (_writeLock) { string pxeFile = Path.Combine(AppConfiguration.HostTempFileLocation, DateTime.Now.ToString(_dateFormat) + _pxeExtension); _pxeWriteAccess.CreatePXE(pxeFile); try { List<Pixel[]> highEnergyLines = new List<Pixel[]>(); List<Pixel[]> lowEnergyLines = new List<Pixel[]>(); XRayInfoIDStruct highEnergyInfo = default(XRayInfoIDStruct); XRayInfoIDStruct lowEnergyInfo = default(XRayInfoIDStruct); if (energy == LINAC_ENERGY_TYPE_VALUE.Dual) { if (ObjectLines[0].XRayInfo.Energy == XRayEnergyEnum.HighEnergy) ObjectLines.RemoveAt(0); } //store object line data foreach (DataInfo dataLine in ObjectLines) { if (dataLine.XRayInfo.Energy == XRayEnergyEnum.HighEnergy) { highEnergyLines.Add(dataLine.LineData); highEnergyInfo = dataLine.XRayInfo; } else //low energy { lowEnergyLines.Add(dataLine.LineData); lowEnergyInfo = dataLine.XRayInfo; } } int maxLength = Math.Min(lowEnergyLines.Count, highEnergyLines.Count); if (maxLength == 0) { maxLength = Math.Max(lowEnergyLines.Count, highEnergyLines.Count); } if (maxLength > AppConfiguration.MaxPXEWidth) { maxLength = AppConfiguration.MaxPXEWidth; } if (energy != LINAC_ENERGY_TYPE_VALUE.Low && highEnergyLines.Count > 0) { int bufferSize = maxLength * highEnergyLines[0].Length; if (bufferSize > 0) { float[] buffer = new float[bufferSize]; Parallel.For(highEnergyLines.Count - maxLength, maxLength, index => { float[] pixelArray = PixelConverter.Convert(highEnergyLines[index]); int length = Buffer.ByteLength(pixelArray); Buffer.BlockCopy(pixelArray, 0, buffer, index * length, length); }); if (energy == LINAC_ENERGY_TYPE_VALUE.Dual) { _pxeWriteAccess.CreateHiPXEHeader((uint)maxLength, (uint)highEnergyLines[0].Length); _pxeWriteAccess.WriteHiDataLines(buffer, (uint)maxLength); _pxeWriteAccess.WriteHighEngDarkSample(PixelConverter.Convert(_calibration.GetDarkData(highEnergyInfo))); _pxeWriteAccess.WriteHighEngAirSample(PixelConverter.Convert(_calibration.GetAirData(highEnergyInfo))); if (AppConfiguration.StoreReferenceCorrection) { _pxeWriteAccess.WriteHiRef(_calibration.GetReferenceCorrections(highEnergyInfo)); } if (AppConfiguration.StoreScaleFactor) { _pxeWriteAccess.WriteHiScaleFactor(_calibration.GetScaleFactor(highEnergyInfo)); } if (AppConfiguration.StoreAirDarkSamples) { _pxeWriteAccess.WriteHiFullAirData(PixelConverter.Convert(_calibration.GetAirDataCollection(highEnergyInfo)), Convert.ToUInt32(AppConfiguration.CalibrationDataLines)); _pxeWriteAccess.WriteHiFullDarkData(PixelConverter.Convert(_calibration.GetDarkDataCollection(highEnergyInfo)), Convert.ToUInt32(AppConfiguration.CalibrationDataLines)); } } else { _pxeWriteAccess.CreateHiPXEHeader((uint)maxLength, (uint)highEnergyLines[0].Length); _pxeWriteAccess.WriteHiDataLines(buffer, (uint)maxLength); _pxeWriteAccess.WriteHighEngDarkSample(PixelConverter.Convert(_calibration.GetDarkData(highEnergyInfo))); _pxeWriteAccess.WriteHighEngAirSample(PixelConverter.Convert(_calibration.GetAirData(highEnergyInfo))); if (AppConfiguration.StoreReferenceCorrection) { _pxeWriteAccess.WriteHiRef(_calibration.GetReferenceCorrections(highEnergyInfo)); } if (AppConfiguration.StoreScaleFactor) { _pxeWriteAccess.WriteHiScaleFactor(_calibration.GetScaleFactor(highEnergyInfo)); } if (AppConfiguration.StoreAirDarkSamples) { _pxeWriteAccess.WriteHiFullAirData(PixelConverter.Convert(_calibration.GetAirDataCollection(highEnergyInfo)), Convert.ToUInt32(AppConfiguration.CalibrationDataLines)); _pxeWriteAccess.WriteHiFullDarkData(PixelConverter.Convert(_calibration.GetDarkDataCollection(highEnergyInfo)), Convert.ToUInt32(AppConfiguration.CalibrationDataLines)); } } } highEnergyLines.Clear(); } if (energy != LINAC_ENERGY_TYPE_VALUE.High && lowEnergyLines.Count > 0) { int bufferSize = maxLength * lowEnergyLines[0].Length; if (bufferSize > 0) { float[] buffer = new float[bufferSize]; Parallel.For(0, maxLength, index => { float[] pixelArray = PixelConverter.Convert(lowEnergyLines[index]); int length = Buffer.ByteLength(pixelArray); Buffer.BlockCopy(pixelArray, 0, buffer, index * length, length); }); if (energy == LINAC_ENERGY_TYPE_VALUE.Dual) { _pxeWriteAccess.CreateLoPXEHeader((uint)maxLength, (uint)lowEnergyLines[0].Length); _pxeWriteAccess.WriteLoDataLines(buffer, (uint)maxLength); _pxeWriteAccess.WriteLowEngDarkSample(PixelConverter.Convert(_calibration.GetDarkData(lowEnergyInfo))); _pxeWriteAccess.WriteLowEngAirSample(PixelConverter.Convert(_calibration.GetAirData(lowEnergyInfo))); if (AppConfiguration.StoreReferenceCorrection) { _pxeWriteAccess.WriteLoRef(_calibration.GetReferenceCorrections(lowEnergyInfo)); } if (AppConfiguration.StoreScaleFactor) { _pxeWriteAccess.WriteLoScaleFactor(_calibration.GetScaleFactor(lowEnergyInfo)); } if (AppConfiguration.StoreAirDarkSamples) { _pxeWriteAccess.WriteLoFullAirData(PixelConverter.Convert(_calibration.GetAirDataCollection(lowEnergyInfo)), Convert.ToUInt32(AppConfiguration.CalibrationDataLines)); _pxeWriteAccess.WriteLoFullDarkData(PixelConverter.Convert(_calibration.GetDarkDataCollection(lowEnergyInfo)), Convert.ToUInt32(AppConfiguration.CalibrationDataLines)); } } else { _pxeWriteAccess.CreateLoPXEHeader((uint)maxLength, (uint)lowEnergyLines[0].Length); _pxeWriteAccess.WriteLoDataLines(buffer, (uint)maxLength); _pxeWriteAccess.WriteLowEngDarkSample(PixelConverter.Convert(_calibration.GetDarkData(lowEnergyInfo))); _pxeWriteAccess.WriteLowEngAirSample(PixelConverter.Convert(_calibration.GetAirData(lowEnergyInfo))); if (AppConfiguration.StoreReferenceCorrection) { _pxeWriteAccess.WriteLoRef(_calibration.GetReferenceCorrections(lowEnergyInfo)); } if (AppConfiguration.StoreScaleFactor) { _pxeWriteAccess.WriteLoScaleFactor(_calibration.GetScaleFactor(lowEnergyInfo)); } if (AppConfiguration.StoreAirDarkSamples) { _pxeWriteAccess.WriteLoFullAirData(PixelConverter.Convert(_calibration.GetAirDataCollection(lowEnergyInfo)), Convert.ToUInt32(AppConfiguration.CalibrationDataLines)); _pxeWriteAccess.WriteLoFullDarkData(PixelConverter.Convert(_calibration.GetDarkDataCollection(lowEnergyInfo)), Convert.ToUInt32(AppConfiguration.CalibrationDataLines)); } } } lowEnergyLines.Clear(); } } catch { } try { _pxeWriteAccess.ClosePXEWrite(); } catch (Exception e) { _log.LogError("Exception closing PXEWrite."); _log.LogError(e.GetType().ToString() + ": " + e.Message); _log.LogError(e.StackTrace); } return pxeFile; } }
private void DetectorsDataAccess_TagUpdate(string name, int value) { if (name == _OpcTags.LINAC_ENERGY_TYPE_STATE.Name) { LINAC_ENERGY_TYPE_VALUE energyValue = (LINAC_ENERGY_TYPE_VALUE)Enum.ToObject(typeof(LINAC_ENERGY_TYPE_VALUE), value); if (energyValue == LINAC_ENERGY_TYPE_VALUE.Dual) { if (_realTimeViewer != null) { _realTimeViewer.IsDualEnergy = true; } if (_apcsAccess.Connected) { try { _apcsAccess.SetScanEnergyMode(ScanEnergyMode.Dual, true); _apcsAccess.SetStaticPulseFrequency((OperatingMode)AppConfiguration.APCSOperatingMode, AppConfiguration.DualPulseFrequency); _apcsAccess.SetCurrentPulseWidth(PulseWidth.PulseWidth1, true); } catch { } } } else if (energyValue == LINAC_ENERGY_TYPE_VALUE.High) { if (_realTimeViewer != null) { _realTimeViewer.IsDualEnergy = false; } if (_apcsAccess.Connected) { try { _apcsAccess.SetScanEnergyMode(ScanEnergyMode.High, true); _apcsAccess.SetStaticPulseFrequency((OperatingMode)AppConfiguration.APCSOperatingMode, AppConfiguration.HighPulseFrequency); _apcsAccess.SetCurrentPulseWidth(PulseWidth.PulseWidth2, true); } catch { } } } else if (energyValue == LINAC_ENERGY_TYPE_VALUE.Low) { if (_realTimeViewer != null) { _realTimeViewer.IsDualEnergy = false; } if (_apcsAccess.Connected) { try { _apcsAccess.SetScanEnergyMode(ScanEnergyMode.Low, true); _apcsAccess.SetStaticPulseFrequency((OperatingMode)AppConfiguration.APCSOperatingMode, AppConfiguration.LowPulseFrequency); _apcsAccess.SetCurrentPulseWidth(PulseWidth.PulseWidth3, true); } catch { } } } #if LinacLowDose else if (energyValue == LINAC_ENERGY_TYPE_VALUE.LowDose) { _realTimeViewer.IsDualEnergy = false; if (_apcsAccess.Connected) { try { _apcsAccess.SetScanEnergyMode(ScanEnergyMode.LowDose, true); _apcsAccess.SetStaticPulseFrequency((OperatingMode)AppConfiguration.APCSOperatingMode, AppConfiguration.LowPulseFrequency, true); _apcsAccess.SetCurrentPulseWidth(PulseWidth.PulseWidth3, true); } catch { } } } #endif } }
private void SetLinacEnergyMode(LINAC_ENERGY_TYPE_VALUE energyType) { _linacEnergyTagUpdated.Reset(); if (_dataAccess.OpcTags.LINAC_ENERGY_TYPE_STATE.Value != energyType) { _dataAccess.SetEnergyType(energyType); if (!_linacEnergyTagUpdated.WaitOne(_defaultTimerTimeout, false)) { FailedCalibration("Linac Energy Type unable to be set."); } else { _linacEnergyTagUpdated.Reset(); } } }
private void SetNextConfiguration() { if (_dataAccess.OpcTags.LINAC_ENERGY_TYPE_STATE.Value == LINAC_ENERGY_TYPE_VALUE.Dual) { _setLinacEnergyType = LINAC_ENERGY_TYPE_VALUE.High; _setApcsEnergyMode = ScanEnergyMode.High; _setPulseWidth = PulseWidth.PulseWidth2; } else if (_dataAccess.OpcTags.LINAC_ENERGY_TYPE_STATE.Value == LINAC_ENERGY_TYPE_VALUE.High) { _setLinacEnergyType = LINAC_ENERGY_TYPE_VALUE.Low; _setApcsEnergyMode = ScanEnergyMode.Low; _setPulseWidth = PulseWidth.PulseWidth3; } #if LinacLowDose else if (_dataAccess.OpcTags.LINAC_ENERGY_TYPE_STATE.Value == LINAC_ENERGY_TYPE_VALUE.Low) { _setLinacEnergyType = LINAC_ENERGY_TYPE_VALUE.LowDose; _setApcsEnergyMode = ScanEnergyMode.LowDose; _setPulseWidth = PulseWidth.PulseWidth3; } #endif else { SaveDataToPXE(); _dataAccess.SetCalibrationState(CALIBRATION_STATE_VALUE.Completed); _calibrationLoaded = true; _logger.LogInfo("**** Stopping Calibration"); StopCalibration(); } }
private void SetupAgent() { _setApcsEnergyMode = ScanEnergyMode.Dual; _setLinacEnergyType = LINAC_ENERGY_TYPE_VALUE.Dual; _setPulseWidth = PulseWidth.PulseWidth1; _logger.LogInfo("Getting APCS status"); //GetApcsStatus(); _startingApcsEnergyMode = _currentApcsEnergyMode; _startingLinacEnergyType = _dataAccess.OpcTags.LINAC_ENERGY_TYPE_STATE.Value; _startingPulseWidth = _currentPulseWidth; _rawDataColl = new BlockingCollection<DataInfo>(); if (_dataAccess.OpcTags.LINAC_STATE.Value == LINAC_STATE_VALUE.XRaysOn) { _logger.LogInfo("Setting x-rays off"); SetXrayOn(false); } else { _logger.LogInfo("Start Collecting Data"); //if(AppConfiguration.CalibrationMode != AppConfiguration.CalibrationModeEnum.Persistent) StartDataCollection(false); } }
private CalibrationDataCollection GetCalibrationCollection(LINAC_ENERGY_TYPE_VALUE energyConfig, PulseWidth pulseWidth) { switch (energyConfig) { case LINAC_ENERGY_TYPE_VALUE.Dual: return _DualDataCollection[PulseWidth.PulseWidth1]; case LINAC_ENERGY_TYPE_VALUE.High: return _HighDataCollection[PulseWidth.PulseWidth2]; case LINAC_ENERGY_TYPE_VALUE.Low: return _LowDataCollection[PulseWidth.PulseWidth3]; #if LinacLowDose case LINAC_ENERGY_TYPE_VALUE.LowDose: return _LowDoseDataCollection[PulseWidth.PulseWidth3]; #endif default: return _DualDataCollection[PulseWidth.PulseWidth1]; } //return (energyConfig == LINAC_ENERGY_TYPE_VALUE.Dual) ? _DualDataCollection[PulseWidth.PulseWidth1] : // (energyConfig == LINAC_ENERGY_TYPE_VALUE.High) ? _HighDataCollection[PulseWidth.PulseWidth2] : _LowDataCollection[PulseWidth.PulseWidth3]; }
private void ReadStoredEnergyData(PxeWriteAccess pxeWriteAccess, LINAC_ENERGY_TYPE_VALUE energy, PulseWidth pulseWidth) { long bufferSize = _dataAccess.Detectors.PixelsPerColumn; CalibrationDataCollection collection = GetCalibrationCollection(energy, pulseWidth); if (energy == LINAC_ENERGY_TYPE_VALUE.High) { float[] airHighDataBuffer = new float[bufferSize]; float[] darkHighDataBuffer = new float[bufferSize]; float[] normScaleHighDataBuffer = new float[bufferSize]; if (pxeWriteAccess.ReadHighEngDarkSample(darkHighDataBuffer)) { collection.AddDarkData(XRayEnergyEnum.HighEnergy, PixelConverter.Convert(darkHighDataBuffer)); } if (pxeWriteAccess.ReadHighEngAirSample(airHighDataBuffer)) { collection.AddAirData(XRayEnergyEnum.HighEnergy, PixelConverter.Convert(airHighDataBuffer)); } } if (energy == LINAC_ENERGY_TYPE_VALUE.Low) { float[] airLowDataBuffer = new float[bufferSize]; float[] normScaleLowDataBuffer = new float[bufferSize]; float[] darkLowDataBuffer = new float[bufferSize]; if (pxeWriteAccess.ReadLowEngDarkSample(darkLowDataBuffer)) { collection.AddDarkData(XRayEnergyEnum.LowEnergy, PixelConverter.Convert(darkLowDataBuffer)); } if (pxeWriteAccess.ReadLowEngAirSample(airLowDataBuffer)) { collection.AddAirData(XRayEnergyEnum.LowEnergy, PixelConverter.Convert(airLowDataBuffer)); } } if (energy == LINAC_ENERGY_TYPE_VALUE.Dual) { float[] airHighDataBuffer = new float[bufferSize]; float[] darkHighDataBuffer = new float[bufferSize]; float[] normScaleHighDataBuffer = new float[bufferSize]; float[] airLowDataBuffer = new float[bufferSize]; float[] normScaleLowDataBuffer = new float[bufferSize]; float[] darkLowDataBuffer = new float[bufferSize]; if (pxeWriteAccess.ReadHighEngDarkSample(darkHighDataBuffer)) { collection.AddDarkData(XRayEnergyEnum.HighEnergy, PixelConverter.Convert(darkHighDataBuffer)); } if (pxeWriteAccess.ReadHighEngAirSample(airHighDataBuffer)) { collection.AddAirData(XRayEnergyEnum.HighEnergy, PixelConverter.Convert(airHighDataBuffer)); } if (pxeWriteAccess.ReadLowEngDarkSample(darkLowDataBuffer)) { collection.AddDarkData(XRayEnergyEnum.LowEnergy, PixelConverter.Convert(darkLowDataBuffer)); } if (pxeWriteAccess.ReadLowEngAirSample(airLowDataBuffer)) { collection.AddAirData(XRayEnergyEnum.LowEnergy, PixelConverter.Convert(airLowDataBuffer)); } } }