diff --git a/Modules/PhotoacousticsHardware/mitkOphirPyro.cpp b/Modules/PhotoacousticsHardware/mitkOphirPyro.cpp index 9d4b39c74f..7228e33115 100644 --- a/Modules/PhotoacousticsHardware/mitkOphirPyro.cpp +++ b/Modules/PhotoacousticsHardware/mitkOphirPyro.cpp @@ -1,57 +1,131 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkOphirPyro.h" #include #include -#include "gclibo.h" - mitk::OphirPyro::OphirPyro() : -m_CurrentWavelength(0) +m_CurrentWavelength(0), +m_DeviceHandle(0), +m_Connected(false), +m_SerialNumber(nullptr) { + m_PulseEnergy.clear(); + m_PulseTime.clear(); + m_PulseStatus.clear(); } mitk::OphirPyro::~OphirPyro() { this->CloseConnection(); MITK_INFO << "[OphirPyro Debug] destroyed that Pyro"; } -bool mitk::OphirPyro::AcquireData() +bool mitk::OphirPyro::StartDataAcquisition() { + return ophirAPI.StartStream(m_DeviceHandle); +} - return false; +bool mitk::OphirPyro::StopDataAcquisition() +{ + return ophirAPI.StopStream(m_DeviceHandle); +} + +unsigned int mitk::OphirPyro::GetDataFromSensor() +{ + std::vector newEnergy; + std::vector newTimestamp; + std::vector newStatus; + unsigned int noPackages = ophirAPI.GetData(m_DeviceHandle, &newEnergy, &newTimestamp, &newStatus); + //newEnergy.resize(noPackages); + //newTimestamp.resize(noPackages); + //newStatus.resize(noPackages); + + MITK_INFO << "[Pyro Debug] -- nop:" << noPackages; + MITK_INFO << "[Pyro Debug] -- newEnergy:" << newEnergy.size(); + if (newEnergy.size() != 0) + m_PulseEnergy.insert(m_PulseEnergy.end(), newEnergy.begin(), newEnergy.end()); + if (newTimestamp.size() != 0) + newTimestamp.insert(m_PulseTime.end(), newTimestamp.begin(), newTimestamp.end()); + if (newStatus.size() != 0) + m_PulseStatus.insert(m_PulseStatus.end(), newStatus.begin(), newStatus.end()); + MITK_INFO << "[Pyro Debug] --"; + return 0;//noPackages; +} + +double mitk::OphirPyro::LookupCurrentPulseEnergy() +{ + if (!m_PulseEnergy.empty()) + return m_PulseEnergy.back(); + else + return 0; } double mitk::OphirPyro::GetNextPulseEnergy() { + double out = m_PulseEnergy.front(); + m_PulseEnergy.erase(m_PulseEnergy.begin()); + m_PulseTime.erase(m_PulseTime.begin()); + m_PulseStatus.erase(m_PulseStatus.begin()); + return out; +} + +double mitk::OphirPyro::LookupCurrentPulseEnergy(double* timestamp, int* status) +{ + *timestamp = m_PulseTime.back(); + *status = m_PulseStatus.back(); + return m_PulseEnergy.back(); +} - return 0; +double mitk::OphirPyro::GetNextPulseEnergy(double* timestamp, int* status) +{ + double out = m_PulseEnergy.front(); + *timestamp = m_PulseTime.front(); + *status = m_PulseStatus.front(); + m_PulseEnergy.erase(m_PulseEnergy.begin()); + m_PulseTime.erase(m_PulseTime.begin()); + m_PulseStatus.erase(m_PulseStatus.begin()); + return out; } bool mitk::OphirPyro::OpenConnection() { - //todo - + if (!m_Connected) + { + char* m_SerialNumber = ophirAPI.ScanUSB(); + if (m_SerialNumber != 0) + { + m_DeviceHandle = ophirAPI.OpenDevice(m_SerialNumber); + if (m_DeviceHandle != 0) + { + m_Connected = true; + return true; + } + } + } return false; } bool mitk::OphirPyro::CloseConnection() { + if (m_Connected) + { + return ophirAPI.CloseDevice(m_DeviceHandle); + } return false; } \ No newline at end of file diff --git a/Modules/PhotoacousticsHardware/mitkOphirPyro.h b/Modules/PhotoacousticsHardware/mitkOphirPyro.h index 5bc0bed51b..323a2ecd2f 100644 --- a/Modules/PhotoacousticsHardware/mitkOphirPyro.h +++ b/Modules/PhotoacousticsHardware/mitkOphirPyro.h @@ -1,59 +1,68 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKOPHIRPYRO_H_HEADER_INCLUDED #define MITKOPHIRPYRO_H_HEADER_INCLUDED #include "itkObject.h" #include "mitkCommon.h" #include "vector" #include "MitkPhotoacousticsHardwareExports.h" #include "OphirPyroWrapper.h" #include #include #include #include #include namespace mitk { class MITKPHOTOACOUSTICSHARDWARE_EXPORT OphirPyro : public itk::Object { public: mitkClassMacroItkParent(mitk::OphirPyro, itk::Object); itkFactorylessNewMacro(Self); virtual bool OpenConnection(); virtual bool CloseConnection(); - virtual bool AcquireData(); + virtual bool StartDataAcquisition(); + virtual bool StopDataAcquisition(); + unsigned int GetDataFromSensor(); + virtual double LookupCurrentPulseEnergy(); virtual double GetNextPulseEnergy(); + virtual double LookupCurrentPulseEnergy(double* timestamp, int* status); + virtual double GetNextPulseEnergy(double* timestamp, int* status); protected: OphirPyro(); virtual ~OphirPyro(); + OphirPyroWrapper ophirAPI; + char* m_SerialNumber; + int m_DeviceHandle; + bool m_Connected; std::vector m_PulseEnergy; std::vector m_PulseTime; std::vector m_PulseStatus; double m_CurrentWavelength; double m_CurrentEnergyRange; }; } // namespace mitk #endif /* MITKOPHIRPYRO_H_HEADER_INCLUDED */ diff --git a/Plugins/org.mitk.gui.qt.lasercontrol/CMakeLists.txt b/Plugins/org.mitk.gui.qt.lasercontrol/CMakeLists.txt index 77d7c8f8c3..5ad010bac3 100644 --- a/Plugins/org.mitk.gui.qt.lasercontrol/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.lasercontrol/CMakeLists.txt @@ -1,17 +1,20 @@ project(org_mitk_gui_qt_lasercontrol) IF(WIN32) configure_file( ${MITK_GALIL_API_PATH}/dll/x64/gclib.dll ${MITK_BINARY_DIR}/bin/Debug/ COPYONLY ) configure_file( ${MITK_GALIL_API_PATH}/dll/x64/gclibo.dll ${MITK_BINARY_DIR}/bin/Debug/ COPYONLY ) configure_file( ${MITK_GALIL_API_PATH}/dll/x64/gclib.dll ${MITK_BINARY_DIR}/bin/Release/ COPYONLY ) configure_file( ${MITK_GALIL_API_PATH}/dll/x64/gclibo.dll ${MITK_BINARY_DIR}/bin/Release/ COPYONLY ) - configure_file( ${MITK_OPHIR_API_PATH}/OphirPyroWrapper.dll ${MITK_BINARY_DIR}/bin/Debug/ COPYONLY ) configure_file( ${MITK_OPHIR_API_PATH}/OphirPyroWrapper.dll ${MITK_BINARY_DIR}/bin/Release/ COPYONLY ) + configure_file( ${MITK_OPHIR_API_PATH}/OphirLMMeasurement.dll ${MITK_BINARY_DIR}/bin/Debug/ COPYONLY ) + configure_file( ${MITK_OPHIR_API_PATH}/OphirLMMeasurement.dll ${MITK_BINARY_DIR}/bin/Release/ COPYONLY ) + configure_file( ${MITK_OPHIR_API_PATH}/Interop.OphirLMMeasurementLib.dll ${MITK_BINARY_DIR}/bin/Debug/ COPYONLY ) + configure_file( ${MITK_OPHIR_API_PATH}/Interop.OphirLMMeasurementLib.dll ${MITK_BINARY_DIR}/bin/Release/ COPYONLY ) ENDIF(WIN32) mitk_create_plugin( EXPORT_DIRECTIVE LASERCONTROL_EXPORT EXPORTED_INCLUDE_SUFFIXES src MODULE_DEPENDS MitkQtWidgetsExt MitkPhotoacousticsHardware ) diff --git a/Plugins/org.mitk.gui.qt.lasercontrol/src/internal/QmitkLaserControl.cpp b/Plugins/org.mitk.gui.qt.lasercontrol/src/internal/QmitkLaserControl.cpp index d9ddd7fd5d..837e38dcb8 100644 --- a/Plugins/org.mitk.gui.qt.lasercontrol/src/internal/QmitkLaserControl.cpp +++ b/Plugins/org.mitk.gui.qt.lasercontrol/src/internal/QmitkLaserControl.cpp @@ -1,314 +1,361 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ // Blueberry #include #include // Qmitk #include "QmitkLaserControl.h" // Qt #include #include -//mitk -#include - const std::string OPOLaserControl::VIEW_ID = "org.mitk.views.lasercontrol"; void OPOLaserControl::SetFocus() { } void OPOLaserControl::CreateQtPartControl(QWidget *parent) { // create GUI widgets from the Qt Designer's .ui file m_Controls.setupUi(parent); connect(m_Controls.buttonInitLaser, SIGNAL(clicked()), this, SLOT(InitLaser())); connect(m_Controls.buttonTune, SIGNAL(clicked()), this, SLOT(TuneWavelength())); connect(m_Controls.buttonFastTuning, SIGNAL(clicked()), this, SLOT(StartFastTuning())); connect(m_Controls.buttonFlashlamp, SIGNAL(clicked()), this, SLOT(ToggleFlashlamp())); connect(m_Controls.buttonQSwitch, SIGNAL(clicked()), this, SLOT(ToggleQSwitch())); connect(m_Controls.sliderWavelength, SIGNAL(valueChanged(int)), this, SLOT(SyncWavelengthSetBySlider())); connect(m_Controls.spinBoxWavelength, SIGNAL(valueChanged(double)), this, SLOT(SyncWavelengthSetBySpinBox())); - connect(&m_Watcher, SIGNAL(finished()), this, SLOT(EnableLaser())); + connect(&m_ShutterWatcher, SIGNAL(finished()), this, SLOT(EnableLaser())); m_SyncFromSpinBox = true; m_SyncFromSlider = true; m_PumpLaserConnected = false; m_OPOConnected = false; + m_PyroConnected = false; } void OPOLaserControl::EnableLaser() { m_Controls.buttonQSwitch->setEnabled(true); m_Controls.buttonQSwitch->setText("Start Laser"); this->GetState(); } void OPOLaserControl::SyncWavelengthSetBySlider() { if (m_SyncFromSlider) { m_SyncFromSpinBox = false; m_Controls.spinBoxWavelength->setValue(m_Controls.sliderWavelength->value() / 10); } else m_SyncFromSlider = true; } void OPOLaserControl::SyncWavelengthSetBySpinBox() { if (m_SyncFromSpinBox) { m_SyncFromSlider = false; m_Controls.sliderWavelength->setValue(m_Controls.spinBoxWavelength->value() * 10); } else m_SyncFromSpinBox = true; } void OPOLaserControl::InitLaser() { m_Controls.buttonInitLaser->setEnabled(false); m_Controls.buttonInitLaser->setText("working ..."); if (!m_PumpLaserConnected) { m_PumpLaserController = mitk::OpotekPumpLaserController::New(); if (m_PumpLaserController->OpenConnection("OpotekPhocusMobile")) { m_Controls.buttonFlashlamp->setEnabled(true); m_Controls.buttonQSwitch->setEnabled(false); m_Controls.buttonInitLaser->setText("Reset and Release Laser"); - std::string command("TRIG EE"); // set both Triggers external std::string answer(""); + std::string triggerCommand("TRIG "); + if (m_Controls.checkBoxTriggerExternally->isChecked()) + { + triggerCommand.append("EE"); // set both Triggers external + m_PumpLaserController->SendAndReceiveLine(&triggerCommand, &answer); + MITK_INFO << answer; + } + else + { + triggerCommand.append("II"); // set both Triggers internal + m_PumpLaserController->SendAndReceiveLine(&triggerCommand, &answer); + MITK_INFO << answer; + std::string energyCommand("QDLY 30"); + m_PumpLaserController->SendAndReceiveLine(&energyCommand, &answer); + MITK_INFO << answer; + } - m_PumpLaserController->SendAndReceiveLine(&command, &answer); - MITK_INFO << answer; m_PumpLaserConnected = true; this->GetState(); } else { - MITK_ERROR << "Opotek Pump Laser Initialization Failed."; + QMessageBox::warning(NULL, "Laser Control", "Opotek Pump Laser Initialization Failed."); m_Controls.buttonInitLaser->setText("Init Laser"); + m_Controls.buttonInitLaser->setEnabled(true); return; } } else { // destroy and free if (m_PumpLaserController->CloseConnection()) { m_Controls.buttonFlashlamp->setEnabled(false); m_Controls.buttonQSwitch->setEnabled(false); m_Controls.buttonInitLaser->setText("Init Laser"); m_PumpLaserConnected = false; } else { - MITK_ERROR << "Opotek Pump Laser Release failed."; + QMessageBox::warning(NULL, "Laser Control", "Opotek Pump Laser Release Failed."); m_Controls.buttonInitLaser->setText("Reset and Release Laser"); } } if (!m_OPOConnected) { m_OPOMotor = mitk::GalilMotor::New(); if (m_OPOMotor->OpenConnection("OpotekPhocusMobile")) { m_Controls.buttonTune->setEnabled(true); m_Controls.buttonFastTuning->setEnabled(true); m_Controls.sliderWavelength->setMinimum(m_OPOMotor->GetMinWavelength() * 10); m_Controls.sliderWavelength->setMaximum(m_OPOMotor->GetMaxWavelength() * 10); m_Controls.spinBoxWavelength->setMinimum(m_OPOMotor->GetMinWavelength()); m_Controls.spinBoxWavelength->setMaximum(m_OPOMotor->GetMaxWavelength()); m_Controls.sliderWavelength->setValue(m_OPOMotor->GetCurrentWavelength() * 10); m_Controls.spinBoxWavelength->setValue(m_OPOMotor->GetCurrentWavelength()); m_OPOConnected = true; // not always right FIXME } else { - MITK_ERROR << "OPO Initialization Failed."; + QMessageBox::warning(NULL, "Laser Control", "OPO Initialization Failed."); m_Controls.buttonInitLaser->setText("Init Laser"); } } else { // destroy and free if (m_OPOMotor->CloseConnection()) { m_Controls.buttonTune->setEnabled(false); m_Controls.buttonFastTuning->setEnabled(false); m_Controls.buttonInitLaser->setText("Init Laser"); m_OPOConnected = false; } else { - MITK_ERROR << "OPO release failed."; + QMessageBox::warning(NULL, "Laser Control", "OPO Release Failed."); m_Controls.buttonInitLaser->setText("Reset and Release Laser"); } } m_Controls.buttonInitLaser->setEnabled(true); this->GetState(); + if (!m_PyroConnected) + { + m_Pyro = mitk::OphirPyro::New(); + MITK_INFO << "[Pyro Debug] OpenConnection: " << m_Pyro->OpenConnection(); + MITK_INFO << "[Pyro Debug] StartDataAcquisition: " << m_Pyro->StartDataAcquisition(); + m_CurrentPulseEnergy = 0; + m_PyroConnected = true; + //QFuture future = QtConcurrent::run(this, &OPOLaserControl::ShowEnergy); + MITK_INFO << "[Pyro Debug] 1"; + //m_EnergyWatcher.setFuture(future); + MITK_INFO << "[Pyro Debug] 12"; + std::this_thread::sleep_for(std::chrono::milliseconds(2000)); + unsigned int drg = m_Pyro->GetDataFromSensor(); + MITK_INFO << "[Pyro Debug] 13"; + } + else + { + MITK_INFO << "[Pyro Debug] StopDataAcquisition: " << m_Pyro->StopDataAcquisition(); + MITK_INFO << "[Pyro Debug] CloseConnection: " << m_Pyro->CloseConnection(); + + m_CurrentPulseEnergy = 0; + m_PyroConnected = false; + } } void OPOLaserControl::TuneWavelength() { if (m_Controls.checkBoxCalibration->isChecked()) { m_OPOMotor->TuneToWavelength(m_Controls.spinBoxPosition->value(), true); } else { m_OPOMotor->TuneToWavelength(m_Controls.spinBoxWavelength->value(), false); } QString wavelengthText = QString::number(m_OPOMotor->GetCurrentWavelength()); wavelengthText.append("nm"); m_Controls.labelWavelength->setText(wavelengthText); } void OPOLaserControl::StartFastTuning() { std::vector listOfWavelengths; double tmpWavelength = 0; int currentRow = 0; bool success = false; do { if (currentRow != 0) listOfWavelengths.push_back(tmpWavelength); if (m_Controls.tableFastTuningWavelengths->item(0, currentRow)) { QString test = m_Controls.tableFastTuningWavelengths->item(0, currentRow)->text(); tmpWavelength = test.toDouble(&success); currentRow++; } else tmpWavelength = 0; if (success == 0) tmpWavelength = 0; } while (tmpWavelength<950.1 && tmpWavelength>689.9); m_OPOMotor->FastTuneWavelengths(listOfWavelengths); } void OPOLaserControl::ShutterCountDown() { m_Controls.buttonFlashlamp->setText("Stop Lamp"); m_Controls.buttonQSwitch->setEnabled(false); m_Controls.buttonQSwitch->setText("10s ..."); std::this_thread::sleep_for(std::chrono::seconds(1)); m_Controls.buttonQSwitch->setText("9s ..."); std::this_thread::sleep_for(std::chrono::seconds(1)); m_Controls.buttonQSwitch->setText("8s ..."); std::this_thread::sleep_for(std::chrono::seconds(1)); m_Controls.buttonQSwitch->setText("7s ..."); std::this_thread::sleep_for(std::chrono::seconds(1)); m_Controls.buttonQSwitch->setText("6s ..."); std::this_thread::sleep_for(std::chrono::seconds(1)); m_Controls.buttonQSwitch->setText("5s ..."); std::this_thread::sleep_for(std::chrono::seconds(1)); m_Controls.buttonQSwitch->setText("4s ..."); std::this_thread::sleep_for(std::chrono::seconds(1)); m_Controls.buttonQSwitch->setText("3s ..."); std::this_thread::sleep_for(std::chrono::seconds(1)); m_Controls.buttonQSwitch->setText("2s ..."); std::this_thread::sleep_for(std::chrono::seconds(1)); m_Controls.buttonQSwitch->setText("1s ..."); std::this_thread::sleep_for(std::chrono::seconds(1)); - //m_Controls.buttonQSwitch->setEnabled(true); - //m_Controls.buttonQSwitch->setText("Start Laser"); +} + +void OPOLaserControl::ShowEnergy() +{ + while(m_PyroConnected) + { + MITK_INFO << "[Pyro Debug] 2"; + std::this_thread::sleep_for(std::chrono::milliseconds(2000)); + //m_Pyro->GetDataFromSensor(); + MITK_INFO << "[Pyro Debug] 2"; + //m_CurrentPulseEnergy = 60000 * m_Pyro->LookupCurrentPulseEnergy(); + MITK_INFO << "[Pyro Debug] 22"; + //m_Controls.labelEnergy->setText(std::to_string(m_CurrentPulseEnergy).append(" mJ").c_str()); + } } void OPOLaserControl::ToggleFlashlamp() { m_Controls.buttonFlashlamp->setText("..."); if (!m_PumpLaserController->IsFlashing()) { if (m_PumpLaserController->StartFlashing()) { QFuture future = QtConcurrent::run(this, &OPOLaserControl::ShutterCountDown); - m_Watcher.setFuture(future); + m_ShutterWatcher.setFuture(future); } else m_Controls.buttonFlashlamp->setText("Start Lamp"); } else { if (m_PumpLaserController->StopFlashing()) { m_Controls.buttonFlashlamp->setText("Start Lamp"); m_Controls.buttonQSwitch->setText("Start Laser"); m_Controls.buttonQSwitch->setEnabled(false); } else m_Controls.buttonFlashlamp->setText("Stop Lamp"); } this->GetState(); } void OPOLaserControl::ToggleQSwitch() { m_Controls.buttonQSwitch->setText("..."); if (!m_PumpLaserController->IsEmitting()) { if (m_PumpLaserController->StartQswitching()) m_Controls.buttonQSwitch->setText("Stop Laser"); else m_Controls.buttonQSwitch->setText("Start Laser"); } else { if (m_PumpLaserController->StopQswitching()) m_Controls.buttonQSwitch->setText("Start Laser"); else m_Controls.buttonQSwitch->setText("Stop Laser"); } this->GetState(); } void OPOLaserControl::OnSelectionChanged(berry::IWorkbenchPart::Pointer /*source*/, const QList& nodes) { } void OPOLaserControl::GetState() { mitk::OpotekPumpLaserController::PumpLaserState pumpLaserState = m_PumpLaserController->GetState(); if (pumpLaserState == mitk::OpotekPumpLaserController::STATE0) m_Controls.labelStatus->setText("PL0: Boot Fault."); else if (pumpLaserState == mitk::OpotekPumpLaserController::STATE1) m_Controls.labelStatus->setText("PL1: Warm Up."); else if (pumpLaserState == mitk::OpotekPumpLaserController::STATE2) m_Controls.labelStatus->setText("PL2: Laser Ready."); else if (pumpLaserState == mitk::OpotekPumpLaserController::STATE3) m_Controls.labelStatus->setText("PL3: Flashing. Pulse Disabled."); else if (pumpLaserState == mitk::OpotekPumpLaserController::STATE4) m_Controls.labelStatus->setText("PL4: Flashing. Shutter Closed."); else if (pumpLaserState == mitk::OpotekPumpLaserController::STATE5) m_Controls.labelStatus->setText("PL5: Flashing. Shutter Open."); else if (pumpLaserState == mitk::OpotekPumpLaserController::STATE6) m_Controls.labelStatus->setText("PL6: Flashing. Pulse Enabled."); else if (pumpLaserState == mitk::OpotekPumpLaserController::UNCONNECTED) m_Controls.labelStatus->setText("PL Not Connected."); } \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.lasercontrol/src/internal/QmitkLaserControl.h b/Plugins/org.mitk.gui.qt.lasercontrol/src/internal/QmitkLaserControl.h index 761c431b16..036b0c1480 100644 --- a/Plugins/org.mitk.gui.qt.lasercontrol/src/internal/QmitkLaserControl.h +++ b/Plugins/org.mitk.gui.qt.lasercontrol/src/internal/QmitkLaserControl.h @@ -1,92 +1,100 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef OPOLaserControl_h #define OPOLaserControl_h #include #include #include "ui_QmitkLaserControlControls.h" #include #include + +// Photoacoustics Hardware #include #include +#include #include /** \brief OPOLaserControl \warning This class is not yet documented. Use "git blame" and ask the author why he is a lazy fuck. \sa QmitkAbstractView \ingroup ${plugin_target}_internal */ class OPOLaserControl : public QmitkAbstractView { // this is needed for all Qt objects that should have a Qt meta-object // (everything that derives from QObject and wants to have signal/slots) Q_OBJECT public: static const std::string VIEW_ID; protected slots: /// \brief Called when the user clicks the GUI button void GetState(); void InitLaser(); void TuneWavelength(); void StartFastTuning(); void ShutterCountDown(); void EnableLaser(); + void ShowEnergy(); void ToggleFlashlamp(); void ToggleQSwitch(); void SyncWavelengthSetBySlider(); void SyncWavelengthSetBySpinBox(); protected: virtual void CreateQtPartControl(QWidget *parent) override; virtual void SetFocus() override; /// \brief called by QmitkFunctionality when DataManager's selection has changed virtual void OnSelectionChanged( berry::IWorkbenchPart::Pointer source, const QList& nodes ) override; Ui::OPOLaserControlControls m_Controls; bool m_PumpLaserConnected; bool m_OPOConnected; + bool m_PyroConnected; bool m_SyncFromSpinBox; bool m_SyncFromSlider; + double m_CurrentPulseEnergy; - QFutureWatcher m_Watcher; + QFutureWatcher m_ShutterWatcher; + QFutureWatcher m_EnergyWatcher; mitk::OpotekPumpLaserController::Pointer m_PumpLaserController; mitk::GalilMotor::Pointer m_OPOMotor; + mitk::OphirPyro::Pointer m_Pyro; }; #endif // OPOLaserControl_h diff --git a/Plugins/org.mitk.gui.qt.lasercontrol/src/internal/QmitkLaserControlControls.ui b/Plugins/org.mitk.gui.qt.lasercontrol/src/internal/QmitkLaserControlControls.ui index 687e686840..377a164b54 100644 --- a/Plugins/org.mitk.gui.qt.lasercontrol/src/internal/QmitkLaserControlControls.ui +++ b/Plugins/org.mitk.gui.qt.lasercontrol/src/internal/QmitkLaserControlControls.ui @@ -1,329 +1,372 @@ OPOLaserControlControls 0 0 246 - 351 + 433 0 0 QmitkTemplate OPOTEK Phocus Control 10 20 206 - 271 + 332 + + + + true + + + Trigger Externally + + + true + + + Init Laser false Start Lamp false Start Laser 9 75 true Laser Status Current Wavelength 9 75 true PreferDefault true 750.0 nm Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + Pulse Energy + + + + + + + + 9 + 75 + true + PreferDefault + true + + + + 0 mJ + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + 6900 9500 5 100 7500 Qt::Horizontal QSlider::NoTicks 10000 1 690.000000000000000 950.000000000000000 0.500000000000000 750.000000000000000 nm false Tune 8 50 false Fast Tuning Wavelengths true Qt::SolidLine 42 50 20 20 λ/nm 1 2 3 4 6 6 7 8 10 700.0 750.0 false Start Fast Tuning 10 - 290 + 350 191 31 calibrate OPO 50000 25000