diff --git a/Modules/US/USControlInterfaces/mitkUSDiPhASDeviceCustomControls.cpp b/Modules/US/USControlInterfaces/mitkUSDiPhASDeviceCustomControls.cpp index 3456a872ac..6c52e225f5 100644 --- a/Modules/US/USControlInterfaces/mitkUSDiPhASDeviceCustomControls.cpp +++ b/Modules/US/USControlInterfaces/mitkUSDiPhASDeviceCustomControls.cpp @@ -1,36 +1,45 @@ /*=================================================================== 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 "mitkUSDiPhASDeviceCustomControls.h" mitk::USDiPhASDeviceCustomControls::USDiPhASDeviceCustomControls(itk::SmartPointer device) : mitk::USAbstractControlInterface(device.GetPointer()), m_IsActive(false) { } mitk::USDiPhASDeviceCustomControls::~USDiPhASDeviceCustomControls() { } void mitk::USDiPhASDeviceCustomControls::SetIsActive(bool isActive) { m_IsActive = isActive; } bool mitk::USDiPhASDeviceCustomControls::GetIsActive() { return m_IsActive; +} + +void mitk::USDiPhASDeviceCustomControls::SetSoundOfSpeed(int speed) +{ + this->OnSetSoundOfSpeed(speed); +} + +void mitk::USDiPhASDeviceCustomControls::OnSetSoundOfSpeed(int speed) +{ } \ No newline at end of file diff --git a/Modules/US/USControlInterfaces/mitkUSDiPhASDeviceCustomControls.h b/Modules/US/USControlInterfaces/mitkUSDiPhASDeviceCustomControls.h index 072f20a9e5..1289ea0cef 100644 --- a/Modules/US/USControlInterfaces/mitkUSDiPhASDeviceCustomControls.h +++ b/Modules/US/USControlInterfaces/mitkUSDiPhASDeviceCustomControls.h @@ -1,59 +1,65 @@ /*=================================================================== 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 MITKUSDiPhASDeviceCustomControls_H_HEADER_INCLUDED_ #define MITKUSDiPhASDeviceCustomControls_H_HEADER_INCLUDED_ #include "mitkUSAbstractControlInterface.h" #include "mitkUSImageVideoSource.h" #include "mitkUSDevice.h" #include namespace mitk { /** * \brief Custom controls for mitk::USDiPhASDevice. */ class MITKUS_EXPORT USDiPhASDeviceCustomControls : public USAbstractControlInterface { public: mitkClassMacro(USDiPhASDeviceCustomControls, USAbstractControlInterface); mitkNewMacro1Param(Self, itk::SmartPointer); /** * Activate or deactivate the custom controls. This is just for handling * widget visibility in a GUI for example. */ virtual void SetIsActive( bool isActive ) override; /** * \return if this custom controls are currently activated */ virtual bool GetIsActive( ) override; + virtual void SetSoundOfSpeed(int speed); + protected: /** * Class needs an mitk::USDevice object for beeing constructed. */ USDiPhASDeviceCustomControls( itk::SmartPointer device ); virtual ~USDiPhASDeviceCustomControls( ); bool m_IsActive; USImageVideoSource::Pointer m_ImageSource; + + + virtual void OnSetSoundOfSpeed(int speed); + }; } // namespace mitk #endif // MITKUSDiPhASDeviceCustomControls_H_HEADER_INCLUDED_ \ No newline at end of file diff --git a/Modules/US/USHardwareDiPhAS/mitkUSDiPhASCustomControls.cpp b/Modules/US/USHardwareDiPhAS/mitkUSDiPhASCustomControls.cpp index bdc5e7fe34..204482e8e5 100644 --- a/Modules/US/USHardwareDiPhAS/mitkUSDiPhASCustomControls.cpp +++ b/Modules/US/USHardwareDiPhAS/mitkUSDiPhASCustomControls.cpp @@ -1,36 +1,42 @@ /*=================================================================== 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 "mitkUSDiPhASCustomControls.h" mitk::USDiPhASCustomControls::USDiPhASCustomControls(USDiPhASDevice* device) - : mitk::USDiPhASDeviceCustomControls(device), m_IsActive(false) + : mitk::USDiPhASDeviceCustomControls(device), m_IsActive(false), m_device(device) { } mitk::USDiPhASCustomControls::~USDiPhASCustomControls() { } void mitk::USDiPhASCustomControls::SetIsActive(bool isActive) { m_IsActive = isActive; } bool mitk::USDiPhASCustomControls::GetIsActive() { return m_IsActive; +} + +void mitk::USDiPhASCustomControls::OnSetSoundOfSpeed(int speed) +{ + m_device->GetScanMode().averageSpeedOfSound = speed; + m_device->UpdateScanmode(); } \ No newline at end of file diff --git a/Modules/US/USHardwareDiPhAS/mitkUSDiPhASCustomControls.h b/Modules/US/USHardwareDiPhAS/mitkUSDiPhASCustomControls.h index c7905de010..bab84c139f 100644 --- a/Modules/US/USHardwareDiPhAS/mitkUSDiPhASCustomControls.h +++ b/Modules/US/USHardwareDiPhAS/mitkUSDiPhASCustomControls.h @@ -1,61 +1,64 @@ /*=================================================================== 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 MITKUSDiPhASCustomControls_H_HEADER_INCLUDED_ #define MITKUSDiPhASCustomControls_H_HEADER_INCLUDED_ #include "mitkUSDevice.h" #include "mitkUSDiPhASDeviceCustomControls.h" #include "mitkUSDiPhASDevice.h" #include namespace mitk { /** * \brief Custom controls for mitk::USDiPhASDevice. */ class USDiPhASDevice; class USDiPhASCustomControls : public USDiPhASDeviceCustomControls { public: mitkClassMacro(USDiPhASCustomControls, USAbstractControlInterface); mitkNewMacro1Param(Self, mitk::USDiPhASDevice*); /** * Activate or deactivate the custom controls. This is just for handling * widget visibility in a GUI for example. */ virtual void SetIsActive( bool isActive ) override; /** * \return if this custom controls are currently activated */ virtual bool GetIsActive( ) override; protected: /** * Class needs an mitk::USDiPhASDevice object for beeing constructed. * This object's ScanMode will be manipulated by the custom controls methods. */ USDiPhASCustomControls(USDiPhASDevice* device); virtual ~USDiPhASCustomControls( ); bool m_IsActive; USImageVideoSource::Pointer m_ImageSource; + USDiPhASDevice* m_device; + + virtual void OnSetSoundOfSpeed(int speed) override; }; } // namespace mitk #endif // MITKUSDiPhASCustomControls_H_HEADER_INCLUDED_ \ No newline at end of file diff --git a/Modules/US/USHardwareDiPhAS/mitkUSDiPhASDevice.cpp b/Modules/US/USHardwareDiPhAS/mitkUSDiPhASDevice.cpp index 38d4d75c4b..999c06b092 100644 --- a/Modules/US/USHardwareDiPhAS/mitkUSDiPhASDevice.cpp +++ b/Modules/US/USHardwareDiPhAS/mitkUSDiPhASDevice.cpp @@ -1,216 +1,224 @@ /*=================================================================== 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 "mitkUSDiPhASDevice.h" #include "mitkUSDiPhASCustomControls.h" mitk::USDiPhASDevice::USDiPhASDevice(std::string manufacturer, std::string model) : mitk::USDevice(manufacturer, model), m_ControlsProbes(mitk::USDiPhASProbesControls::New(this)), m_ImageSource(mitk::USDiPhASImageSource::New(this)), m_ControlInterfaceCustom(mitk::USDiPhASCustomControls::New(this)), m_IsRunning(false) { SetNumberOfOutputs(1); SetNthOutput(0, this->MakeOutput(0)); } mitk::USDiPhASDevice::~USDiPhASDevice() { } std::string mitk::USDiPhASDevice::GetDeviceClass() { return "org.mitk.modules.us.USDiPhASDevice"; } mitk::USControlInterfaceProbes::Pointer mitk::USDiPhASDevice::GetControlInterfaceProbes() { return m_ControlsProbes.GetPointer(); }; mitk::USAbstractControlInterface::Pointer mitk::USDiPhASDevice::GetControlInterfaceCustom() { return m_ControlInterfaceCustom.GetPointer(); } mitk::USImageSource::Pointer mitk::USDiPhASDevice::GetUSImageSource() { return m_ImageSource.GetPointer(); } ScanModeNative& mitk::USDiPhASDevice::GetScanMode() { return m_ScanMode; } // Setup and Cleanup bool mitk::USDiPhASDevice::OnInitialization() { return true; } //---------------------------------------------------------------------------------------------------------------------------- /* ugly wrapper stuff - find better solution so it isn't necessary to create a global pointer to USDiPhASDevice... * passing a lambda function would be nicer - sadly something goes wrong when passing the adress of a lambda function: * the API produces access violations. Passing the Lambda function itself would be preferable, but that's not possible */ mitk::USDiPhASDevice* w_device; mitk::USDiPhASImageSource* w_ISource; void WrapperMessageCallback(const char* message) { w_device->MessageCallback(message); } void WrapperImageDataCallback( short* rfDataChannelData, int channelDatalinesPerDataset, int channelDataSamplesPerChannel, int channelDataTotalDatasets, short* rfDataArrayBeamformed, int beamformedLines, int beamformedSamples, int beamformedTotalDatasets, unsigned char* imageData, int imageWidth, int imageHeight, int imagePixelFormat, int imageSetsTotal, double timeStamp) { w_ISource->ImageDataCallback( rfDataChannelData, channelDatalinesPerDataset, channelDatalinesPerDataset, channelDataTotalDatasets, rfDataArrayBeamformed, beamformedLines, beamformedSamples, beamformedTotalDatasets, imageData, imageWidth, imageHeight, imagePixelFormat, imageSetsTotal, timeStamp); } //---------------------------------------------------------------------------------------------------------------------------- bool mitk::USDiPhASDevice::OnConnection() { w_device = this; w_ISource = m_ImageSource; // Need those pointers for the forwarders to call member functions; createBeamformer expects non-member function pointers. createBeamformer((StringMessageCallback)&WrapperMessageCallback, (NewDataCallback)&WrapperImageDataCallback); initBeamformer(); this->InitializeScanMode(); // pass the new scanmode to the device: setupScan(this->m_ScanMode); return true; } bool mitk::USDiPhASDevice::OnDisconnection() { //close the beamformer so hardware is disconnected closeBeamformer(); return true; } bool mitk::USDiPhASDevice::OnActivation() { // probe controls are available now m_ControlsProbes->SetIsActive(true); if (m_ControlsProbes->GetProbesCount() < 1) { MITK_WARN("USDevice")("USDiPhASDevice") << "No probe found."; return false; } m_ControlsProbes->SelectProbe(0); // toggle the beamformer of the API if(!m_IsRunning) m_IsRunning=toggleFreeze(); return true; } bool mitk::USDiPhASDevice::OnDeactivation() { if(m_IsRunning) m_IsRunning=toggleFreeze(); return true; } void mitk::USDiPhASDevice::OnFreeze(bool freeze) { if(m_IsRunning==freeze) m_IsRunning=toggleFreeze(); // toggleFreeze() returns true if it starts running the beamformer, otherwise false } +void mitk::USDiPhASDevice::UpdateScanmode() +{ + toggleFreeze(); + setupScan(this->m_ScanMode); + m_ImageSource->UpdateImageGeometry(); + toggleFreeze(); +} + void mitk::USDiPhASDevice::InitializeScanMode() { m_ScanMode.scanModeName = "UltrasoundMode"; // configure a linear transducer m_ScanMode.transducerName = "L2-7 "; m_ScanMode.transducerCurvedRadiusMeter = 0; m_ScanMode.transducerElementCount = 128; m_ScanMode.transducerFrequencyHz = 5000000; m_ScanMode.transducerPitchMeter = 0.0003f; m_ScanMode.transducerType = 1; // configure the transmit sequence(s): int numChannels = 128; m_ScanMode.transmitEventsCount = 1; m_ScanMode.BurstHalfwaveClockCountAllChannels = 11; // 120 MHz / (2 * (predefinedBurstHalfwaveClockCount + 1)) --> 5 MHz m_ScanMode.transmitPhaseLengthSeconds = 1e-6f; m_ScanMode.voltageV = 70; // configure the receive paramters: m_ScanMode.receivePhaseLengthSeconds = 65e-6f; // 5 cm imaging depth m_ScanMode.tgcdB = new unsigned char[8]; for (int tgc = 0; tgc < 8; ++tgc) m_ScanMode.tgcdB[tgc] = tgc * 2 + 10; m_ScanMode.accumulation = 1; m_ScanMode.bandpassApply = false; m_ScanMode.averagingCount = 1; // configure general processing: m_ScanMode.transferChannelData = false; // configure reconstruction processing: m_ScanMode.averageSpeedOfSound = 1540; m_ScanMode.computeBeamforming = true; m_ScanMode.beamformingAlgorithm = (int)Beamforming::PlaneWaveCompound; // setup beamforming parameters: BeamformingParametersPlaneWaveCompound parametersPW; parametersPW.SpeedOfSoundMeterPerSecond = 1540; parametersPW.angleSkipFactor = 1; m_ScanMode.beamformingAlgorithmParameters = (void*)¶metersPW; m_ScanMode.reconstructedLinePitchMmOrAngleDegree = 0.3f; m_ScanMode.reconstructionLines = 128; m_ScanMode.reconstructionSamplesPerLine = 2048; m_ScanMode.transferBeamformedData = false; // configure bandpass: m_ScanMode.bandpassApply = false; m_ScanMode.bandpassFrequencyLowHz = 1e6f; m_ScanMode.bandpassFrequencyHighHz = 20e6f; // configure image generation: m_ScanMode.imageWidth = 512; m_ScanMode.imageHeight = 512; m_ScanMode.imageMultiplier = 1; m_ScanMode.imageLeveling = 0; m_ScanMode.transferImageData = true; } // callback for the DiPhAS API void mitk::USDiPhASDevice::MessageCallback(const char* message) { MITK_INFO << "DiPhAS API: " << message << '\n'; } diff --git a/Modules/US/USHardwareDiPhAS/mitkUSDiPhASDevice.h b/Modules/US/USHardwareDiPhAS/mitkUSDiPhASDevice.h index 011579fea9..ec8fda44d4 100644 --- a/Modules/US/USHardwareDiPhAS/mitkUSDiPhASDevice.h +++ b/Modules/US/USHardwareDiPhAS/mitkUSDiPhASDevice.h @@ -1,158 +1,162 @@ /*=================================================================== 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 MITKUSDiPhASDevice_H_HEADER_INCLUDED_ #define MITKUSDiPhASDevice_H_HEADER_INCLUDED_ #include #include "mitkUSDevice.h" #include "mitkUSDiPhASImageSource.h" #include "mitkUSDiPhASProbesControls.h" #include "mitkUSDiPhASCustomControls.h" #include "Framework.IBMT.US.CWrapper.h" #include #include #include #include #include #include namespace mitk { /** * \brief Implementation of mitk::USDevice for DiPhAS API devices. * Connects to a DiPhAS API device through its COM library interface. * * This class handles all API communications and creates interfaces for * b mode, doppler and probes controls. * Images given by the device are put into an object of * mitk::USDiPhASImageSource. */ class USDiPhASDevice : public USDevice { public: mitkClassMacro(USDiPhASDevice, mitk::USDevice); mitkNewMacro2Param(Self, std::string, std::string); /** * \brief Returns the class of the device. */ virtual std::string GetDeviceClass(); virtual USControlInterfaceProbes::Pointer GetControlInterfaceProbes(); virtual itk::SmartPointer GetControlInterfaceCustom(); /** * \brief Is called during the initialization process. * There is nothing done on the initialization of a mik::USDiPhASDevive object. * * \return always true */ virtual bool OnInitialization(); /** * \brief Is called during the connection process. * Connect to the DiPhAS API. * * \return true if successfull, false if no device is connected to the pc * \throws mitk::Exception if something goes wrong at the API calls */ virtual bool OnConnection(); /** * \brief Is called during the disconnection process. * Deactivate and remove all DiPhAS API controls. A disconnect from the * DiPhAS API is not possible for which reason the hardware stays in connected * state even after calling this method. * * \return always true * \throws mitk::Exception if something goes wrong at the API calls */ virtual bool OnDisconnection(); /** * \brief Is called during the activation process. * After this method is finished, the device is generating images in b mode. * Changing scanning mode is possible afterwards by using the appropriate * control interfaces. * * \return always true * \throws mitk::Exception if something goes wrong at the API calls */ virtual bool OnActivation(); /** * \brief Is called during the deactivation process. * After a call to this method the device is connected, but not producing images anymore. * * \return always true * \throws mitk::Exception if something goes wrong at the API calls */ virtual bool OnDeactivation(); /** * \brief Changes scan state of the device if freeze is toggeled in mitk::USDevice. */ virtual void OnFreeze(bool freeze); /** @return Returns the current image source of this device. */ USImageSource::Pointer GetUSImageSource( ); /** @return Returns the currently used scanmode of this device*/ ScanModeNative& GetScanMode(); + /** Updates the Scanmode + */ + void UpdateScanmode(); + void MessageCallback(const char* message); protected: /** * Constructs a mitk::USDiPhASDevice object by given manufacturer * and model string. These strings are just for labeling the device * in the micro service. * * Control interfaces and image source are available directly after * construction. Registration at the micro service happens not before * initialization method was called. */ USDiPhASDevice(std::string manufacturer, std::string model); virtual ~USDiPhASDevice(); /** * The DiPhAS API expects callback functions to pass * both status messages and the processed images to the user. * The message callback is here, the data itself is given directly to the image source. */ /** * This method sets up the scanmode at the begining */ void InitializeScanMode(); USDiPhASProbesControls::Pointer m_ControlsProbes; itk::SmartPointer m_ControlInterfaceCustom; USDiPhASImageSource::Pointer m_ImageSource; bool m_IsRunning; ScanModeNative m_ScanMode; }; } // namespace mitk #endif // MITKUSDiPhASDevice_H_HEADER_INCLUDED_ \ No newline at end of file diff --git a/Modules/US/USHardwareDiPhAS/mitkUSDiPhASImageSource.h b/Modules/US/USHardwareDiPhAS/mitkUSDiPhASImageSource.h index 63068bcb86..d749d93cd2 100644 --- a/Modules/US/USHardwareDiPhAS/mitkUSDiPhASImageSource.h +++ b/Modules/US/USHardwareDiPhAS/mitkUSDiPhASImageSource.h @@ -1,90 +1,91 @@ /*=================================================================== 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 MITKUSDiPhASImageSource_H_HEADER_INCLUDED_ #define MITKUSDiPhASImageSource_H_HEADER_INCLUDED_ #include "mitkUSImageSource.h" #include "Framework.IBMT.US.CWrapper.h" #include "mitkImageReadAccessor.h" #include "itkFastMutexLock.h" namespace mitk { class USDiPhASDevice; /** * \brief Implementation of mitk::USImageSource for DiPhAS API devices. * The method mitk::USImageSource::GetNextRawImage() is implemented for * getting images from the DiPhAS API. * * The image data is given to this class from the DiPhAS API by calling * a callback method that writes the image data to an mitk::image */ class USDiPhASImageSource : public USImageSource { public: mitkClassMacro(USDiPhASImageSource, USImageSource); mitkNewMacro1Param(Self, mitk::USDiPhASDevice*); itkCloneMacro(Self); /** * Implementation of the superclass method. Returns the pointer * to the mitk::Image filled by DiPhAS API callback. */ virtual void GetNextRawImage( mitk::Image::Pointer& ); /** * The API calls this function to pass the image data to the * user; here the m_Image is updated */ -void mitk::USDiPhASImageSource::ImageDataCallback( + void mitk::USDiPhASImageSource::ImageDataCallback( short* rfDataChannelData, int& channelDataChannelsPerDataset, int& channelDataSamplesPerChannel, int& channelDataTotalDatasets, short* rfDataArrayBeamformed, int& beamformedLines, int& beamformedSamples, int& beamformedTotalDatasets, unsigned char* imageData, int& imageWidth, int& imageHeight, - int& imagePixelFormat, + int& imagePixelFormat, int& imageSetsTotal, double& timeStamp); + void UpdateImageGeometry(); + protected: USDiPhASImageSource(mitk::USDiPhASDevice* device); virtual ~USDiPhASImageSource( ); /** * Sets the spacing used in the image based on the informations of the ScanMode in USDiPhAS Device */ - void UpdateImageGeometry(); - + mitk::Image::Pointer m_Image; itk::FastMutexLock::Pointer m_ImageMutex; mitk::USDiPhASDevice* m_device; }; } // namespace mitk #endif // MITKUSDiPhASImageSource_H diff --git a/Modules/USUI/Qmitk/QmitkUSControlsCustomDiPhASDeviceWidget.cpp b/Modules/USUI/Qmitk/QmitkUSControlsCustomDiPhASDeviceWidget.cpp index 5b9c81eb00..88b8a7d813 100644 --- a/Modules/USUI/Qmitk/QmitkUSControlsCustomDiPhASDeviceWidget.cpp +++ b/Modules/USUI/Qmitk/QmitkUSControlsCustomDiPhASDeviceWidget.cpp @@ -1,64 +1,76 @@ /*=================================================================== 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 "QmitkUSControlsCustomDiPhASDeviceWidget.h" #include "ui_QmitkUSControlsCustomDiPhASDeviceWidget.h" #include #include QmitkUSControlsCustomDiPhASDeviceWidget::QmitkUSControlsCustomDiPhASDeviceWidget(QWidget *parent) : QmitkUSAbstractCustomWidget(parent), ui(new Ui::QmitkUSControlsCustomDiPhASDeviceWidget) { } QmitkUSControlsCustomDiPhASDeviceWidget::~QmitkUSControlsCustomDiPhASDeviceWidget() { delete ui; } std::string QmitkUSControlsCustomDiPhASDeviceWidget::GetDeviceClass() const { return "org.mitk.modules.us.USDiPhASDevice"; } QmitkUSAbstractCustomWidget* QmitkUSControlsCustomDiPhASDeviceWidget::Clone(QWidget* parent) const { QmitkUSAbstractCustomWidget* clonedWidget = new QmitkUSControlsCustomDiPhASDeviceWidget(parent); clonedWidget->SetDevice(this->GetDevice()); return clonedWidget; } void QmitkUSControlsCustomDiPhASDeviceWidget::OnDeviceSet() { m_ControlInterface = dynamic_cast (this->GetDevice()->GetControlInterfaceCustom().GetPointer()); if ( m_ControlInterface.IsNotNull() ) { + //ui->SpeedOfSound->setValue(cropping.left); } else { MITK_WARN("QmitkUSAbstractCustomWidget")("QmitkUSControlsCustomDiPhASDeviceWidget") << "Did not get a custom video device control interface."; } + ui->SpeedOfSound->setEnabled(m_ControlInterface.IsNotNull()); } void QmitkUSControlsCustomDiPhASDeviceWidget::Initialize() { ui->setupUi(this); -} \ No newline at end of file + + connect(ui->SpeedOfSound, SIGNAL(valueChanged(int)), this, SLOT(OnSpeedOfSoundChanged())); +} + +void QmitkUSControlsCustomDiPhASDeviceWidget::OnSpeedOfSoundChanged() +{ + if (m_ControlInterface.IsNull()) { return; } + m_ControlInterface->SetSoundOfSpeed(ui->SpeedOfSound->value()); + + MITK_INFO << "wrks"; +} diff --git a/Modules/USUI/Qmitk/QmitkUSControlsCustomDiPhASDeviceWidget.h b/Modules/USUI/Qmitk/QmitkUSControlsCustomDiPhASDeviceWidget.h index 0e5929f0f0..6a36c116d8 100644 --- a/Modules/USUI/Qmitk/QmitkUSControlsCustomDiPhASDeviceWidget.h +++ b/Modules/USUI/Qmitk/QmitkUSControlsCustomDiPhASDeviceWidget.h @@ -1,83 +1,83 @@ /*=================================================================== 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 QmitkUSControlsCustomDiPhASDeviceWidget_H #define QmitkUSControlsCustomDiPhASDeviceWidget_H #include "QmitkUSAbstractCustomWidget.h" #include "mitkUSDiPhASDeviceCustomControls.h" #include "mitkUSDevice.h" #include namespace Ui { class QmitkUSControlsCustomDiPhASDeviceWidget; } /** \brief Widget for custom controls of mitk::USDiPhASDevice. * This class handles the itk::USDiPhASDeviceCustomControls of video device * objects. */ class QmitkUSControlsCustomDiPhASDeviceWidget : public QmitkUSAbstractCustomWidget { Q_OBJECT private slots: + virtual void OnSpeedOfSoundChanged(); public: /** * Constructs widget object. All gui control elements will be disabled until * QmitkUSAbstractCustomWidget::SetDevice() was called. */ explicit QmitkUSControlsCustomDiPhASDeviceWidget(QWidget *parent = 0); ~QmitkUSControlsCustomDiPhASDeviceWidget(); /** * Getter for the device class of mitk:USDiPhASDevice. */ virtual std::string GetDeviceClass() const override; /** * Creates new QmitkUSAbstractCustomWidget with the same mitk::USDiPhASDevice * and the same mitk::USDiPhASDeviceCustomControls which were set on the * original object. * * This method is just for being calles by the factory. Use * QmitkUSAbstractCustomWidget::CloneForQt() instead, if you want a clone of * an object. */ virtual QmitkUSAbstractCustomWidget* Clone(QWidget* parent = 0) const override; /** * Gets control interface from the device which was currently set. Control * elements are according to current crop area of the device. If custom * control interface is null, the control elements stay disabled. */ virtual void OnDeviceSet() override; virtual void Initialize() override; protected: void BlockSignalAndSetValue(QSpinBox* target, int value); private: Ui::QmitkUSControlsCustomDiPhASDeviceWidget* ui; - mitk::USDiPhASDeviceCustomControls::Pointer m_ControlInterface; }; #endif // QmitkUSControlsCustomDiPhASDeviceWidget_H \ No newline at end of file diff --git a/Modules/USUI/Qmitk/QmitkUSControlsCustomDiPhASDeviceWidget.ui b/Modules/USUI/Qmitk/QmitkUSControlsCustomDiPhASDeviceWidget.ui index 48f56548e4..026812c4ac 100644 --- a/Modules/USUI/Qmitk/QmitkUSControlsCustomDiPhASDeviceWidget.ui +++ b/Modules/USUI/Qmitk/QmitkUSControlsCustomDiPhASDeviceWidget.ui @@ -1,190 +1,175 @@ QmitkUSControlsCustomDiPhASDeviceWidget 0 0 - 449 - 246 + 579 + 317 Form - + <html><head/><body><p><span style=" font-weight:600;">Beamforming Parameters</span></p></body></html> - + - - - - - 0.100000000000000 - - - - - - - - - Pitch of Transducer - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - - - - - mm - - - Qt::AlignCenter - - - - - - - - - Qt::Vertical - - - - - - - - - 4096 - - - 256 - - - - - - - - - Reconstructed Samples per Line - - - Qt::AlignCenter - - - - - - - - + + + 4096 + + + 256 + + + 2048 + + + + + + + Pitch of Transducer [mm] + + + + + + + Reconstructed Samples per Line + + - - - - - - - 1000000 - - - - - - - - - Speed of Sound - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - - - - - m/s - - - Qt::AlignCenter - - - - - - - - - - - Qt::Vertical - - - - - - - - - 1024 - - - 128 - - - - - - - - - Reconstructed Lines - - - Qt::AlignCenter - - - - - - - - + + + 0.100000000000000 + + + 0.300000000000000 + + + + + + + Speed of Sound [m/s] + + + + + + + 1000000 + + + 1540 + + + + + + + 1024 + + + 128 + + + 128 + + + + + + + Reconstructed Lines + + + + + + + + + <html><head/><body><p><span style=" font-weight:600;">Receive Parameters</span></p></body></html> + + + + + + + + + Scan Depth [mm] + + + + + + + 1000 + + + 5 + + + + + + + 1 + + + 10000 + + + 1 + + + + + + + Averaging Count + + + + + + + + + <html><head/><body><p><span style=" font-weight:600;">Transmit Parameters</span></p></body></html> + + + + + + + + + + + + Transmit Phase Length [ms] + +