diff --git a/Modules/US/USNavigation/mitkTrackedUltrasound.cpp b/Modules/US/USNavigation/mitkTrackedUltrasound.cpp index 8a04a9d9e1..e972f02a7d 100644 --- a/Modules/US/USNavigation/mitkTrackedUltrasound.cpp +++ b/Modules/US/USNavigation/mitkTrackedUltrasound.cpp @@ -1,73 +1,73 @@ /*=================================================================== 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 "mitkTrackedUltrasound.h" #include "mitkImageReadAccessor.h" #include #include #include "mitkNavigationDataDisplacementFilter.h" #include "mitkTrackingDeviceSource.h" mitk::TrackedUltrasound::TrackedUltrasound( USDevice::Pointer usDevice, NavigationDataSource::Pointer trackingDevice, bool trackedUltrasoundActive ) : AbstractUltrasoundTrackerDevice( usDevice, trackingDevice, trackedUltrasoundActive ) { } mitk::TrackedUltrasound::~TrackedUltrasound() { } void mitk::TrackedUltrasound::GenerateData() { if (m_UltrasoundDevice->GetIsFreezed()) { return; } //if the image is freezed: do nothing //get next image from ultrasound image source - mitk::Image::Pointer image = m_UltrasoundDevice->GetUSImageSource()->GetNextImage(); + mitk::Image::Pointer image = m_UltrasoundDevice->GetUSImageSource()->GetNextImage().at(0); if (image.IsNull() || !image->IsInitialized()) //check the image { MITK_WARN << "Invalid image in USCombinedModality, aborting!"; return; } //get output and initialize it if it wasn't initialized before mitk::Image::Pointer output = this->GetOutput(); if (!output->IsInitialized()) { output->Initialize(image); } //now update image data mitk::ImageReadAccessor inputReadAccessor(image, image->GetSliceData(0, 0, 0)); output->SetSlice(inputReadAccessor.GetData()); //copy image data output->GetGeometry()->SetSpacing(image->GetGeometry()->GetSpacing()); //copy spacing because this might also change //and update calibration (= transformation of the image) std::string calibrationKey = this->GetIdentifierForCurrentCalibration(); if (!calibrationKey.empty()) { std::map::iterator calibrationIterator = m_Calibrations.find(calibrationKey); if (calibrationIterator != m_Calibrations.end()) { // transform image according to callibration if one is set // for current configuration of probe and depth m_DisplacementFilter->SetTransformation(calibrationIterator->second); } } } diff --git a/Plugins/org.mitk.gui.qt.igt.app.echotrack/files.cmake b/Plugins/org.mitk.gui.qt.igt.app.echotrack/files.cmake index 54901bd4e4..1026dafca8 100644 --- a/Plugins/org.mitk.gui.qt.igt.app.echotrack/files.cmake +++ b/Plugins/org.mitk.gui.qt.igt.app.echotrack/files.cmake @@ -1,137 +1,133 @@ set(SRC_CPP_FILES ) set(INTERNAL_CPP_FILES org_mbi_gui_qt_usnavigation_Activator.cpp #USNavigation.cpp //not functional anymore. Delete code? QmitkUltrasoundCalibration.cpp QmitkUSNavigationMarkerPlacement.cpp QmitkUSNavigationPerspective.cpp mitkUSTargetPlacementQualityCalculator.cpp QmitkUSZonesDataModel.cpp QmitkUSNavigationCalibrationsDataModel.cpp QmitkUSZoneManagementColorDialogDelegate.cpp QmitkUSNavigationCalibrationRemoveDelegate.cpp QmitkUSNavigationCalibrationUpdateDepthDelegate.cpp Interactors/mitkUSZonesInteractor.cpp Interactors/mitkUSPointMarkInteractor.cpp Widgets/QmitkUSCombinedModalityCreationWidget.cpp Widgets/QmitkUSCombinedModalityEditWidget.cpp Widgets/QmitkUSNavigationFreezeButton.cpp - Widgets/QmitkUSNavigationProcessWidget.cpp Widgets/QmitkUSNavigationZoneDistancesWidget.cpp Widgets/QmitkUSZoneManagementWidget.cpp Widgets/QmitkZoneProgressBar.cpp NavigationStepWidgets/QmitkUSAbstractNavigationStep.cpp NavigationStepWidgets/QmitkUSNavigationStepCombinedModality.cpp NavigationStepWidgets/QmitkUSNavigationStepTumourSelection.cpp NavigationStepWidgets/QmitkUSNavigationStepZoneMarking.cpp NavigationStepWidgets/QmitkUSNavigationStepPlacementPlanning.cpp NavigationStepWidgets/QmitkUSNavigationStepMarkerIntervention.cpp NavigationStepWidgets/QmitkUSNavigationStepPunctuationIntervention.cpp SettingsWidgets/QmitkUSNavigationCombinedSettingsWidget.cpp SettingsWidgets/QmitkUSNavigationAbstractSettingsWidget.cpp Filter/mitkUSNavigationTargetOcclusionFilter.cpp Filter/mitkUSNavigationTargetUpdateFilter.cpp Filter/mitkUSNavigationTargetIntersectionFilter.cpp IO/mitkUSNavigationCombinedModalityPersistence.cpp IO/mitkUSNavigationLoggingBackend.cpp IO/mitkUSNavigationExperimentLogging.cpp IO/mitkUSNavigationStepTimer.cpp ) set(UI_FILES #src/internal/USNavigationControls.ui //not functional anymore. Delete code? src/internal/QmitkUltrasoundCalibrationControls.ui src/internal/QmitkUSNavigationMarkerPlacement.ui src/internal/Widgets/QmitkUSCombinedModalityCreationWidget.ui src/internal/Widgets/QmitkUSCombinedModalityEditWidget.ui - src/internal/Widgets/QmitkUSNavigationProcessWidget.ui src/internal/Widgets/QmitkUSZoneManagementWidget.ui src/internal/NavigationStepWidgets/QmitkUSAbstractNavigationStep.ui src/internal/NavigationStepWidgets/QmitkUSNavigationStepCombinedModality.ui src/internal/NavigationStepWidgets/QmitkUSNavigationStepTumourSelection.ui src/internal/NavigationStepWidgets/QmitkUSNavigationStepZoneMarking.ui src/internal/NavigationStepWidgets/QmitkUSNavigationStepPlacementPlanning.ui src/internal/NavigationStepWidgets/QmitkUSNavigationStepMarkerIntervention.ui src/internal/NavigationStepWidgets/QmitkUSNavigationStepPunctuationIntervention.ui src/internal/SettingsWidgets/QmitkUSNavigationCombinedSettingsWidget.ui ) set(MOC_H_FILES src/internal/org_mbi_gui_qt_usnavigation_Activator.h - #src/internal/USNavigation.h //not functional anymore. Delete code? src/internal/QmitkUltrasoundCalibration.h src/internal/QmitkUSNavigationMarkerPlacement.h src/internal/QmitkUSZonesDataModel.h src/internal/QmitkUSNavigationCalibrationsDataModel.h src/internal/QmitkUSZoneManagementColorDialogDelegate.h src/internal/QmitkUSNavigationCalibrationRemoveDelegate.h src/internal/QmitkUSNavigationCalibrationUpdateDepthDelegate.h src/internal/QmitkUSNavigationPerspective.h src/internal/Widgets/QmitkUSCombinedModalityCreationWidget.h src/internal/Widgets/QmitkUSCombinedModalityEditWidget.h src/internal/Widgets/QmitkUSNavigationFreezeButton.h - src/internal/Widgets/QmitkUSNavigationProcessWidget.h src/internal/Widgets/QmitkUSNavigationZoneDistancesWidget.h src/internal/Widgets/QmitkUSZoneManagementWidget.h src/internal/Widgets/QmitkZoneProgressBar.h src/internal/NavigationStepWidgets/QmitkUSAbstractNavigationStep.h src/internal/NavigationStepWidgets/QmitkUSNavigationStepCombinedModality.h src/internal/NavigationStepWidgets/QmitkUSNavigationStepTumourSelection.h src/internal/NavigationStepWidgets/QmitkUSNavigationStepZoneMarking.h src/internal/NavigationStepWidgets/QmitkUSNavigationStepPlacementPlanning.h src/internal/NavigationStepWidgets/QmitkUSNavigationStepMarkerIntervention.h src/internal/NavigationStepWidgets/QmitkUSNavigationStepPunctuationIntervention.h src/internal/SettingsWidgets/QmitkUSNavigationCombinedSettingsWidget.h src/internal/SettingsWidgets/QmitkUSNavigationAbstractSettingsWidget.h ) # list of resource files which can be used by the plug-in # system without loading the plug-ins shared library, # for example the icon used in the menu and tabs for the # plug-in views in the workbench set(CACHED_RESOURCE_FILES # resources/icon.xpm //not functional anymore. Delete code? resources/icon2.xpm resources/icon_US_calibration.svg plugin.xml ) # list of Qt .qrc files which contain additional resources # specific to this plugin set(QRC_FILES resources/USNavigation.qrc ) set(CPP_FILES ) foreach(file ${SRC_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/${file}) endforeach(file ${SRC_CPP_FILES}) foreach(file ${INTERNAL_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/internal/${file}) endforeach(file ${INTERNAL_CPP_FILES}) set(RESOURCE_FILES Interactions/USPointMarkInteractions.xml Interactions/USZoneInteractions.xml Interactions/USZoneInteractionsHold.xml ) diff --git a/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/QmitkUSNavigationMarkerPlacement.cpp b/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/QmitkUSNavigationMarkerPlacement.cpp index 3bc3fb6c59..1d283aeb3b 100644 --- a/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/QmitkUSNavigationMarkerPlacement.cpp +++ b/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/QmitkUSNavigationMarkerPlacement.cpp @@ -1,695 +1,690 @@ /*=================================================================== 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 "QmitkUSNavigationMarkerPlacement.h" #include "ui_QmitkUSNavigationMarkerPlacement.h" #include "NavigationStepWidgets/QmitkUSNavigationStepCombinedModality.h" #include "NavigationStepWidgets/QmitkUSNavigationStepMarkerIntervention.h" #include "NavigationStepWidgets/QmitkUSNavigationStepPlacementPlanning.h" #include "NavigationStepWidgets/QmitkUSNavigationStepPunctuationIntervention.h" #include "NavigationStepWidgets/QmitkUSNavigationStepTumourSelection.h" #include "NavigationStepWidgets/QmitkUSNavigationStepZoneMarking.h" #include "SettingsWidgets/QmitkUSNavigationCombinedSettingsWidget.h" #include "mitkIRenderingManager.h" #include "mitkNodeDisplacementFilter.h" #include "mitkAbstractUltrasoundTrackerDevice.h" #include #include "IO/mitkUSNavigationStepTimer.h" #include #include #include #include #include #include #include "QmitkRenderWindow.h" #include "QmitkStdMultiWidget.h" #include "QmitkStdMultiWidgetEditor.h" #include "mitkLayoutAnnotationRenderer.h" #include "mitkCameraController.h" // scene serialization #include #include #include #include #include const std::string QmitkUSNavigationMarkerPlacement::VIEW_ID = "org.mitk.views.usmarkerplacement"; const char *QmitkUSNavigationMarkerPlacement::DATANAME_TUMOUR = "Tumour"; const char *QmitkUSNavigationMarkerPlacement::DATANAME_TARGETSURFACE = "Target Surface"; const char *QmitkUSNavigationMarkerPlacement::DATANAME_ZONES = "Zones"; const char *QmitkUSNavigationMarkerPlacement::DATANAME_TARGETS = "Targets"; const char *QmitkUSNavigationMarkerPlacement::DATANAME_TARGETS_PATHS = "Target Paths"; const char *QmitkUSNavigationMarkerPlacement::DATANAME_REACHED_TARGETS = "Reached Targets"; QmitkUSNavigationMarkerPlacement::QmitkUSNavigationMarkerPlacement() : m_Parent(nullptr), m_UpdateTimer(new QTimer(this)), m_ImageAndNavigationDataLoggingTimer(new QTimer(this)), m_StdMultiWidget(nullptr), m_CombinedModality(nullptr), m_ReinitAlreadyDone(false), m_IsExperimentRunning(false), m_CurrentApplicationName(), m_NavigationStepTimer(mitk::USNavigationStepTimer::New()), m_IconRunning(QPixmap(":/USNavigation/record.png")), m_IconNotRunning(QPixmap(":/USNavigation/record-gray.png")), m_ResultsDirectory(), m_ExperimentName(), m_ExperimentResultsSubDirectory(), m_NavigationStepNames(), m_LoggingBackend(), m_USImageLoggingFilter(mitk::USImageLoggingFilter::New()), m_NavigationDataRecorder(mitk::NavigationDataRecorder::New()), m_TargetNodeDisplacementFilter(nullptr), m_AblationZonesDisplacementFilter(mitk::NodeDisplacementFilter::New()), m_AblationZonesVector(), m_NeedleIndex(0), m_MarkerIndex(1), m_SceneNumber(1), m_WarnOverlay(mitk::TextAnnotation2D::New()), m_NavigationDataSource(nullptr), m_CurrentStorage(nullptr), ui(new Ui::QmitkUSNavigationMarkerPlacement ) { connect(m_UpdateTimer, SIGNAL(timeout()), this, SLOT(OnTimeout())); connect( m_ImageAndNavigationDataLoggingTimer, SIGNAL(timeout()), this, SLOT(OnImageAndNavigationDataLoggingTimeout())); // scale running (and not running) icon the specific height m_IconRunning = m_IconRunning.scaledToHeight(20, Qt::SmoothTransformation); m_IconNotRunning = m_IconNotRunning.scaledToHeight(20, Qt::SmoothTransformation); m_UpdateTimer->start(33); // every 33 Milliseconds = 30 Frames/Second } QmitkUSNavigationMarkerPlacement::~QmitkUSNavigationMarkerPlacement() { delete ui; } void QmitkUSNavigationMarkerPlacement::OnChangeAblationZone(int id, int newSize) { if ((static_cast(m_AblationZonesVector.size()) < id) || (id < 0)) { return; } MITK_INFO << "Ablation Zone " << id << " changed, new size: " << newSize; // create a vtk sphere with given radius vtkSphereSource *vtkData = vtkSphereSource::New(); vtkData->SetRadius(newSize / 2); vtkData->SetCenter(0, 0, 0); vtkData->SetPhiResolution(20); vtkData->SetThetaResolution(20); vtkData->Update(); mitk::Surface::Pointer zoneSurface = dynamic_cast(m_AblationZonesVector.at(id)->GetData()); zoneSurface->SetVtkPolyData(vtkData->GetOutput()); vtkData->Delete(); } void QmitkUSNavigationMarkerPlacement::OnAddAblationZone(int size) { m_AblationZonesDisplacementFilter->SetInitialReferencePose( m_CombinedModality->GetNavigationDataSource()->GetOutput(m_MarkerIndex)); mitk::DataNode::Pointer NewAblationZone = mitk::DataNode::New(); mitk::Point3D origin = m_CombinedModality->GetNavigationDataSource()->GetOutput(m_NeedleIndex)->GetPosition(); MITK_INFO("USNavigationLogging") << "Ablation Zone Added, initial size: " << size << ", origin: " << origin; mitk::Surface::Pointer zone = mitk::Surface::New(); // create a vtk sphere with given radius vtkSphereSource *vtkData = vtkSphereSource::New(); vtkData->SetRadius(size / 2); vtkData->SetCenter(0, 0, 0); vtkData->SetPhiResolution(20); vtkData->SetThetaResolution(20); vtkData->Update(); zone->SetVtkPolyData(vtkData->GetOutput()); vtkData->Delete(); // set vtk sphere and origin to data node (origin must be set // again, because of the new sphere set as data) NewAblationZone->SetData(zone); NewAblationZone->GetData()->GetGeometry()->SetOrigin(origin); mitk::Color SphereColor = mitk::Color(); // default color SphereColor[0] = 102; SphereColor[1] = 0; SphereColor[2] = 204; NewAblationZone->SetColor(SphereColor); NewAblationZone->SetOpacity(0.3); // set name of zone std::stringstream name; name << "Ablation Zone" << m_AblationZonesVector.size(); NewAblationZone->SetName(name.str()); // add zone to filter m_AblationZonesDisplacementFilter->AddNode(NewAblationZone); m_AblationZonesVector.push_back(NewAblationZone); this->GetDataStorage()->Add(NewAblationZone); } void QmitkUSNavigationMarkerPlacement::CreateQtPartControl(QWidget *parent) { m_Parent = parent; ui->setupUi(parent); connect(ui->startExperimentButton, SIGNAL(clicked()), this, SLOT(OnStartExperiment())); connect(ui->finishExperimentButton, SIGNAL(clicked()), this, SLOT(OnFinishExperiment())); connect(ui->m_enableNavigationLayout, SIGNAL(clicked()), this, SLOT(OnChangeLayoutClicked())); connect(ui->m_RenderWindowSelection, SIGNAL(valueChanged(int)), this, SLOT(OnRenderWindowSelection())); connect(ui->m_RefreshView, SIGNAL(clicked()), this, SLOT(OnRefreshView())); - ui->navigationProcessWidget->SetDataStorage(this->GetDataStorage()); + m_BaseNode = this->GetDataStorage()->GetNamedNode(QmitkUSAbstractNavigationStep::DATANAME_BASENODE); + if (m_BaseNode.IsNull()) + { + m_BaseNode = mitk::DataNode::New(); + m_BaseNode->SetName(QmitkUSAbstractNavigationStep::DATANAME_BASENODE); + this->GetDataStorage()->Add(m_BaseNode); + } connect(ui->m_initializeTargetMarking, SIGNAL(clicked()), this, SLOT(OnInitializeTargetMarking())); connect(ui->m_initializeCritStructureMarking, SIGNAL(clicked()), this, SLOT(OnInitializeCriticalStructureMarking())); connect(ui->m_initializeNavigation, SIGNAL(clicked()), this, SLOT(OnInitializeNavigation())); // indicate that no experiment is running at start ui->runningLabel->setPixmap(m_IconNotRunning); connect(ui->m_settingsWidget, SIGNAL(SettingsChanged(itk::SmartPointer)), this, SLOT(OnSettingsChanged(itk::SmartPointer))); - ui->navigationProcessWidget->SetSettingsWidget(new QmitkUSNavigationCombinedSettingsWidget(m_Parent)); } void QmitkUSNavigationMarkerPlacement::OnInitializeTargetMarking() { m_SettingsNode = mitk::DataNode::New(); ui->m_settingsWidget->OnSetSettingsNode(m_SettingsNode, true); InitImageStream(); m_CombinedModality = ui->m_CombinedModalityCreationWidget->GetSelectedCombinedModality(); ui->m_TargetMarkingWidget->SetCombinedModality(m_CombinedModality); ui->m_TargetMarkingWidget->SetDataStorage(this->GetDataStorage()); ui->m_TargetMarkingWidget->OnSettingsChanged(m_SettingsNode); ui->m_TargetMarkingWidget->OnActivateStep(); ui->m_TargetMarkingWidget->OnStartStep(); ui->m_TargetMarkingWidget->Update(); } void QmitkUSNavigationMarkerPlacement::OnInitializeCriticalStructureMarking() { ui->m_CriticalStructuresWidget->SetCombinedModality(m_CombinedModality); ui->m_CriticalStructuresWidget->SetDataStorage(this->GetDataStorage()); ui->m_CriticalStructuresWidget->OnSettingsChanged(m_SettingsNode); ui->m_CriticalStructuresWidget->OnActivateStep(); ui->m_CriticalStructuresWidget->OnStartStep(); ui->m_CriticalStructuresWidget->Update(); } void QmitkUSNavigationMarkerPlacement::OnInitializeNavigation() { ui->m_NavigationWidget->SetCombinedModality(m_CombinedModality); ui->m_NavigationWidget->SetDataStorage(this->GetDataStorage()); ui->m_NavigationWidget->OnSettingsChanged(m_SettingsNode); ui->m_NavigationWidget->OnActivateStep(); ui->m_NavigationWidget->OnStartStep(); ui->m_NavigationWidget->Update(); } void QmitkUSNavigationMarkerPlacement::InitImageStream() { if (m_ImageStreamNode.IsNull()) { m_ImageStreamNode = mitk::DataNode::New(); m_ImageStreamNode->SetName("US Navigation Viewing Stream"); this->GetDataStorage()->Add(m_ImageStreamNode); } } void QmitkUSNavigationMarkerPlacement::OnCombinedModalityPropertyChanged(const std::string &key, const std::string &) { if (key == mitk::USDevice::GetPropertyKeys().US_PROPKEY_BMODE_DEPTH) { m_ReinitAlreadyDone = false; this->ReinitOnImage(); if (m_CombinedModality.IsNotNull() && !m_CombinedModality->GetIsCalibratedForCurrentStatus()) { mitk::LayoutAnnotationRenderer::AddAnnotation( m_WarnOverlay.GetPointer(), "stdmulti.widget1", mitk::LayoutAnnotationRenderer::TopLeft); MITK_WARN << "No calibration available for the selected ultrasound image depth."; } } } void QmitkUSNavigationMarkerPlacement::SetFocus() { this->ReinitOnImage(); } void QmitkUSNavigationMarkerPlacement::OnTimeout() { if (m_CombinedModality.IsNull()) return; m_CombinedModality->Modified(); //shouldn't be nessecary ... fix in abstract ultrasound tracker device! m_CombinedModality->Update(); ui->m_TargetMarkingWidget->Update(); ui->m_CriticalStructuresWidget->Update(); ui->m_NavigationWidget->Update(); mitk::Image::Pointer image = m_CombinedModality->GetOutput(); // make sure that always the current image is set to the data node if (image.IsNotNull() && m_ImageStreamNode->GetData() != image.GetPointer() && image->IsInitialized()) { m_ImageStreamNode->SetData(image); } if (!m_StdMultiWidget) { // try to get the standard multi widget if it couldn't be got before mitk::IRenderWindowPart *renderWindow = this->GetRenderWindowPart(); QmitkStdMultiWidgetEditor *multiWidgetEditor = dynamic_cast(renderWindow); // if there is a standard multi widget now, disable the level window and // change the layout to 2D up and 3d down if (multiWidgetEditor) { m_StdMultiWidget = multiWidgetEditor->GetStdMultiWidget(); SetTwoWindowView(); } this->CreateOverlays(); } if (m_CombinedModality.IsNotNull() && !this->m_CombinedModality->GetUltrasoundDevice()->GetIsFreezed()) // if the combined modality is freezed: do nothing { - ui->navigationProcessWidget->UpdateNavigationProgress(); m_AblationZonesDisplacementFilter->Update(); // update the 3D window only every fourth time to speed up the rendering (at least in 2D) this->RequestRenderWindowUpdate(mitk::RenderingManager::REQUEST_UPDATE_2DWINDOWS); // make sure that a reinit was performed on the image this->ReinitOnImage(); } } void QmitkUSNavigationMarkerPlacement::OnEnableNavigationLayout() { MITK_INFO << "Navigation Layout"; // try to get the standard multi widget if it couldn't be got before mitk::IRenderWindowPart *renderWindow = this->GetRenderWindowPart(); QmitkStdMultiWidgetEditor *multiWidgetEditor = dynamic_cast(renderWindow); // if there is a standard multi widget now, disable the level window and // change the layout to 2D up and 3d down if (multiWidgetEditor) { m_StdMultiWidget = multiWidgetEditor->GetStdMultiWidget(); SetTwoWindowView(); } } void QmitkUSNavigationMarkerPlacement::OnRenderWindowSelection() { SetTwoWindowView(); } void QmitkUSNavigationMarkerPlacement::OnRefreshView() { if (!ui->m_enableNavigationLayout->isChecked()) OnResetStandardLayout(); else { //Reinit the US Image Stream (this might be broken if there was a global reinit somewhere...) try { mitk::RenderingManager::GetInstance()->InitializeViews(//Reinit this->GetDataStorage()//GetDataStorage ->GetNamedNode("US Support Viewing Stream")->GetData()->GetTimeGeometry());//GetNode } catch (...) { MITK_DEBUG << "No reinit possible"; } SetTwoWindowView(); } } void QmitkUSNavigationMarkerPlacement::SetTwoWindowView() { if (m_StdMultiWidget) { m_StdMultiWidget->DisableStandardLevelWindow(); int i, j, k; switch (this->ui->m_RenderWindowSelection->value()) { case 1: mitk::BaseRenderer::GetInstance(mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget4"))->GetCameraController()->SetViewToCaudal(); i = 2; j = 3; //other windows k = 1; break; case 2: mitk::BaseRenderer::GetInstance(mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget4"))->GetCameraController()->SetViewToSinister(); i = 1; j = 3; k = 2; break; case 3: mitk::BaseRenderer::GetInstance(mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget4"))->GetCameraController()->SetViewToAnterior(); i = 2; j = 1; k = 3; break; default: return; } m_StdMultiWidget->changeLayoutTo2DUpAnd3DDown(k); ////Crosshair invisible in 3D view this->GetDataStorage()->GetNamedNode("stdmulti.widget" + std::to_string(i) + ".plane")-> SetBoolProperty("visible", false, mitk::BaseRenderer::GetInstance(mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget4"))); this->GetDataStorage()->GetNamedNode("stdmulti.widget" + std::to_string(j) + ".plane")-> SetBoolProperty("visible", false, mitk::BaseRenderer::GetInstance(mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget4"))); this->GetDataStorage()->GetNamedNode("stdmulti.widget" + std::to_string(k) + ".plane")-> SetBoolProperty("visible", true, mitk::BaseRenderer::GetInstance(mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget4"))); this->GetDataStorage()->GetNamedNode("stdmulti.widget" + std::to_string(i) + ".plane")-> SetIntProperty("Crosshair.Gap Size", 0); this->GetDataStorage()->GetNamedNode("stdmulti.widget" + std::to_string(j) + ".plane")-> SetIntProperty("Crosshair.Gap Size", 0); } } void QmitkUSNavigationMarkerPlacement::OnResetStandardLayout() { //reset render windows mitk::DataNode::Pointer widget1 = this->GetDataStorage()->GetNamedNode("stdmulti.widget1.plane"); if (widget1.IsNotNull()) { widget1->SetVisibility(true); } mitk::DataNode::Pointer widget2 = this->GetDataStorage()->GetNamedNode("stdmulti.widget2.plane"); if (widget2.IsNotNull()) { widget2->SetVisibility(true); } mitk::DataNode::Pointer widget3 = this->GetDataStorage()->GetNamedNode("stdmulti.widget3.plane"); if (widget3.IsNotNull()) { widget3->SetVisibility(true); } m_StdMultiWidget->changeLayoutToDefault(); } void QmitkUSNavigationMarkerPlacement::OnChangeLayoutClicked() { if (ui->m_enableNavigationLayout->isChecked()) OnEnableNavigationLayout(); else OnResetStandardLayout(); } void QmitkUSNavigationMarkerPlacement::OnImageAndNavigationDataLoggingTimeout() { // update filter for logging navigation data and ultrasound images if (m_CombinedModality.IsNotNull()) { m_NavigationDataRecorder->Update(); // get last messages for logging filer and store them std::vector messages = m_LoggingBackend.GetNavigationMessages(); std::string composedMessage = ""; for (std::size_t i = 0; i < messages.size(); i++) { composedMessage += messages.at(i); } m_USImageLoggingFilter->AddMessageToCurrentImage(composedMessage); m_LoggingBackend.ClearNavigationMessages(); // update logging filter m_USImageLoggingFilter->Update(); } } void QmitkUSNavigationMarkerPlacement::OnStartExperiment() { // get name for the experiment by a QInputDialog bool ok; if (m_ExperimentName.isEmpty()) { // default: current date m_ExperimentName = QString::number(QDateTime::currentDateTime().date().year()) + "_" + QString::number(QDateTime::currentDateTime().date().month()) + "_" + QString::number(QDateTime::currentDateTime().date().day()) + "_experiment_" + QString::number(QDateTime::currentDateTime().time().hour()) + "." + QString::number(QDateTime::currentDateTime().time().minute()); } m_ExperimentName = QInputDialog::getText( m_Parent, QString("Experiment Name"), QString("Name of the Experiment"), QLineEdit::Normal, m_ExperimentName, &ok); MITK_INFO("USNavigationLogging") << "Experiment started: " << m_ExperimentName.toStdString(); if (ok && !m_ExperimentName.isEmpty()) { // display error message and call the function recursivly if a directory // with the given name already exists QDir experimentResultsDir(m_ResultsDirectory + QDir::separator() + m_ExperimentName); if (experimentResultsDir.exists()) { QMessageBox::critical( m_Parent, "Results Directory Exists", "The result directory already exists.\nPlease choose an other name."); this->OnStartExperiment(); } else { QDir(m_ResultsDirectory).mkdir(m_ExperimentName); m_ExperimentResultsSubDirectory = m_ResultsDirectory + QDir::separator() + m_ExperimentName; // experiment is running now ui->runningLabel->setPixmap(m_IconRunning); - ui->navigationProcessWidget->EnableInteraction(true); // (re)start timer for navigation step durations m_NavigationStepTimer->Reset(); m_NavigationStepTimer->SetOutputFileName( QString(m_ExperimentResultsSubDirectory + QDir::separator() + QString("durations.cvs")).toStdString()); m_NavigationStepTimer->SetActiveIndex(0, "Initialization"); ui->finishExperimentButton->setEnabled(true); ui->startExperimentButton->setDisabled(true); // initialize and register logging backend QString loggingFilename = m_ExperimentResultsSubDirectory + QDir::separator() + "logging.txt"; m_LoggingBackend.SetOutputFileName(loggingFilename.toStdString()); mbilog::RegisterBackend(&m_LoggingBackend); // initialize and start navigation data recorder form xml recording m_NavigationDataRecorder->StartRecording(); m_IsExperimentRunning = true; m_ImageAndNavigationDataLoggingTimer->start(1000); } } } void QmitkUSNavigationMarkerPlacement::OnFinishExperiment() { this->WaitCursorOn(); MITK_INFO("USNavigationLogging") << "Experiment finished!"; MITK_INFO("USNavigationLogging") << "Position/Orientation of needle tip: " << (dynamic_cast(m_CombinedModality->GetTrackingDeviceDataSource()->GetOutput(0)))->GetPosition(); MITK_INFO("USNavigationLogging") << "Position of target: " << m_TargetNodeDisplacementFilter->GetRawDisplacementNavigationData(0)->GetPosition(); MITK_INFO("USNavigationLogging") << "Total duration: " << m_NavigationStepTimer->GetTotalDuration(); - ui->navigationProcessWidget->FinishCurrentNavigationStep(); m_ImageAndNavigationDataLoggingTimer->stop(); ui->runningLabel->setPixmap(m_IconNotRunning); - ui->navigationProcessWidget->EnableInteraction(false); m_NavigationStepTimer->Stop(); - // make sure that the navigation process will be start from beginning at the - // next experiment - ui->navigationProcessWidget->ResetNavigationProcess(); ui->finishExperimentButton->setDisabled(true); ui->startExperimentButton->setEnabled(true); MITK_INFO("USNavigationLogging") << "Writing logging data to " << m_ExperimentResultsSubDirectory.toStdString(); // save ultrasound images to the file system QDir(m_ExperimentResultsSubDirectory).mkdir("ImageStream"); m_USImageLoggingFilter->Update(); m_USImageLoggingFilter->SetImageFilesExtension(".jpg"); m_USImageLoggingFilter->SaveImages( QString(m_ExperimentResultsSubDirectory + QDir::separator() + "ImageStream" + QDir::separator()).toStdString()); m_USImageLoggingFilter = mitk::USImageLoggingFilter::New(); m_NavigationDataRecorder->StopRecording(); // Write data to csv and xml file mitk::IOUtil::Save( m_NavigationDataRecorder->GetNavigationDataSet(), (QString(m_ExperimentResultsSubDirectory + QDir::separator() + "navigation-data.xml").toStdString().c_str())); mitk::IOUtil::Save( m_NavigationDataRecorder->GetNavigationDataSet(), (QString(m_ExperimentResultsSubDirectory + QDir::separator() + "navigation-data.csv").toStdString().c_str())); // write logged navigation data messages to separate file std::stringstream csvNavigationMessagesFilename; csvNavigationMessagesFilename << m_ExperimentResultsSubDirectory.toStdString() << QDir::separator().toLatin1() << "CSVNavigationMessagesLogFile.csv"; MITK_INFO("USNavigationLogging") << "Writing logged navigation messages to separate csv file: " << csvNavigationMessagesFilename.str(); m_LoggingBackend.WriteCSVFileWithNavigationMessages(csvNavigationMessagesFilename.str()); mbilog::UnregisterBackend(&m_LoggingBackend); m_IsExperimentRunning = false; m_ImageAndNavigationDataLoggingTimer->stop(); m_CombinedModality = nullptr; // reset scene number for next experiment m_SceneNumber = 1; this->WaitCursorOff(); MITK_INFO("USNavigationLogging") << "Finished!"; } void QmitkUSNavigationMarkerPlacement::OnSettingsChanged(itk::SmartPointer settings) { // initialize gui according to the experiment mode setting bool experimentMode = false; settings->GetBoolProperty("settings.experiment-mode", experimentMode); ui->startExperimentButton->setVisible(experimentMode); ui->finishExperimentButton->setVisible(experimentMode); ui->runningLabel->setVisible(experimentMode); if (experimentMode && !m_IsExperimentRunning) { - ui->navigationProcessWidget->ResetNavigationProcess(); - ui->navigationProcessWidget->EnableInteraction(false); ui->runningLabel->setPixmap(m_IconNotRunning); } else if (!experimentMode) { if (m_IsExperimentRunning) { this->OnFinishExperiment(); } - ui->navigationProcessWidget->EnableInteraction(true); } // get the results directory from the settings and use home directory if // there is no results directory configured std::string resultsDirectory; if (settings->GetStringProperty("settings.experiment-results-directory", resultsDirectory)) { m_ResultsDirectory = QString::fromStdString(resultsDirectory); } else { m_ResultsDirectory = QDir::homePath(); } // make sure that the results directory exists QDir resultsDirectoryQDir = QDir(m_ResultsDirectory); if (!resultsDirectoryQDir.exists()) { resultsDirectoryQDir.mkpath(m_ResultsDirectory); } MITK_INFO("USNavigation") << "Results Directory: " << m_ResultsDirectory.toStdString(); } void QmitkUSNavigationMarkerPlacement::ReinitOnImage() { if (!m_ReinitAlreadyDone && m_CombinedModality.IsNotNull()) { // make sure that the output is already calibrated correctly // (if the zoom level was changed recently) m_CombinedModality->Modified(); m_CombinedModality->Update(); mitk::Image::Pointer image = m_CombinedModality->GetOutput(); if (image.IsNotNull() && image->IsInitialized()) { // make a reinit on the ultrasound image mitk::IRenderWindowPart *renderWindow = this->GetRenderWindowPart(); if (renderWindow != NULL && image->GetTimeGeometry()->IsValid()) { renderWindow->GetRenderingManager()->InitializeViews( image->GetTimeGeometry(), mitk::RenderingManager::REQUEST_UPDATE_ALL, true); renderWindow->GetRenderingManager()->RequestUpdateAll(); } this->RequestRenderWindowUpdate(); m_ReinitAlreadyDone = true; } } } void QmitkUSNavigationMarkerPlacement::Convert2DImagesTo3D(mitk::DataStorage::SetOfObjects::ConstPointer nodes) { for (mitk::DataStorage::SetOfObjects::ConstIterator it = nodes->Begin(); it != nodes->End(); ++it) { if (it->Value()->GetData() && strcmp(it->Value()->GetData()->GetNameOfClass(), "Image") == 0) { // convert image to 3d image if it is 2d at the moment mitk::Image::Pointer image = dynamic_cast(it->Value()->GetData()); if (image.IsNotNull() && image->GetDimension() == 2 && !image->GetGeometry()->Is2DConvertable()) { mitk::Convert2Dto3DImageFilter::Pointer convert2DTo3DImageFilter = mitk::Convert2Dto3DImageFilter::New(); convert2DTo3DImageFilter->SetInput(image); convert2DTo3DImageFilter->Update(); it->Value()->SetData(convert2DTo3DImageFilter->GetOutput()); } } } } void QmitkUSNavigationMarkerPlacement::CreateOverlays() { // initialize warning overlay (and do not display it, yet) m_WarnOverlay->SetText("Warning: No calibration available for current depth."); // set position and font size for the text overlay // (nonesense postition as a layouter is used, but it ignored // the overlay without setting a position here) mitk::Point2D overlayPosition; overlayPosition.SetElement(0, -50.0f); overlayPosition.SetElement(1, -50.0f); m_WarnOverlay->SetPosition2D(overlayPosition); m_WarnOverlay->SetFontSize(22); m_WarnOverlay->SetColor(1, 0, 0); // overlay should be red } void QmitkUSNavigationMarkerPlacement::UpdateToolStorage() { if (m_NavigationDataSource.IsNull()) { m_NavigationDataSource = m_CombinedModality->GetNavigationDataSource(); } if (m_NavigationDataSource.IsNull()) { MITK_WARN << "Found an invalid navigation data source object!"; } us::ModuleContext* context = us::GetModuleContext(); std::string id = m_NavigationDataSource->US_PROPKEY_ID; std::string filter = "(" + mitk::NavigationToolStorage::US_PROPKEY_SOURCE_ID + "=" + id + ")"; // Get Storage std::vector > refs = context->GetServiceReferences(); m_CurrentStorage = context->GetService(refs.front()); if (m_CurrentStorage.IsNull()) { MITK_WARN << "Found an invalid storage object!"; } else if (m_CurrentStorage->GetToolCount() != m_NavigationDataSource->GetNumberOfOutputs()) //there is something wrong with the storage { MITK_WARN << "Found a tool storage, but it has not the same number of tools like the NavigationDataSource. This storage won't be used because it isn't the right one."; m_CurrentStorage = NULL; } } diff --git a/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/QmitkUSNavigationMarkerPlacement.h b/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/QmitkUSNavigationMarkerPlacement.h index 847eb45cfc..416c97632b 100644 --- a/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/QmitkUSNavigationMarkerPlacement.h +++ b/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/QmitkUSNavigationMarkerPlacement.h @@ -1,205 +1,205 @@ /*=================================================================== 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 QmitkUSNAVIGATIONMARKERPLACEMENT_H #define QmitkUSNAVIGATIONMARKERPLACEMENT_H #include #include "IO/mitkUSNavigationLoggingBackend.h" -#include "Widgets/QmitkUSNavigationProcessWidget.h" #include "mitkNavigationDataRecorder.h" #include "mitkNodeDisplacementFilter.h" #include "mitkUSImageLoggingFilter.h" #include #include #include #include namespace itk { template class SmartPointer; } namespace mitk { class USNavigationStepTimer; } namespace Ui { class QmitkUSNavigationMarkerPlacement; } class QmitkUSAbstractNavigationStep; class QmitkUSNavigationStepPunctuationIntervention; class QmitkStdMultiWidget; class QTimer; class QSignalMapper; /** * \brief View for navigated marker placement using the combined modality. * This view utilizes the QmitkUSNavigationProcessWidget to do the navigation * process. It can be switched between widgets for marker placement and widgets * for punctuation. * * An experiment mode allows for logging results, durations and the ultrasound * images. */ class QmitkUSNavigationMarkerPlacement : public QmitkAbstractView { Q_OBJECT protected slots: void OnInitializeTargetMarking(); void OnInitializeCriticalStructureMarking(); void OnInitializeNavigation(); /** * \brief Called periodically to update the rendering. * The standard multi widget is changed to fit the navigation process once it * is available and a reinit on the ultrasound image is done for a new image * node. */ void OnTimeout(); /** * \brief Called periodically during an experiment for logging the ultrasound images. */ void OnImageAndNavigationDataLoggingTimeout(); /** * \brief Initializes anything neccessary for an experiment. * The user is asked for a directory for storing the results and the logging * is started. */ void OnStartExperiment(); /** * \brief Stops logging and saves everything to the file system. */ void OnFinishExperiment(); /** * \brief Switches the navigation step widgets if the navigation application was changed. */ void OnSettingsChanged(itk::SmartPointer); void OnAddAblationZone(int size); void OnEnableNavigationLayout(); void OnResetStandardLayout(); void OnChangeLayoutClicked(); void OnChangeAblationZone(int id, int newSize); void OnRenderWindowSelection(); void OnRefreshView(); public: static const char *DATANAME_TUMOUR; static const char *DATANAME_TARGETSURFACE; static const char *DATANAME_ZONES; static const char *DATANAME_TARGETS; static const char *DATANAME_TARGETS_PATHS; static const char *DATANAME_REACHED_TARGETS; explicit QmitkUSNavigationMarkerPlacement(); ~QmitkUSNavigationMarkerPlacement(); virtual void CreateQtPartControl(QWidget *parent); static const std::string VIEW_ID; void OnCombinedModalityPropertyChanged(const std::string &, const std::string &); protected: /** * \brief A reinit on the ultrasound image is performed every time the view gets the focus. */ virtual void SetFocus(); /** * \brief Helper function which performs a reinit on the ultrasound image. */ void ReinitOnImage(); /** * \brief Sets the multiwidget to two windows, axial on top and 3D render window on the bottom. */ virtual void SetTwoWindowView(); /** * \brief Helper function for being able to serialize the 2d ultrasound image. */ void Convert2DImagesTo3D(mitk::DataStorage::SetOfObjects::ConstPointer nodes); void UpdateToolStorage(); void CreateOverlays(); void InitImageStream(); QWidget *m_Parent; QTimer *m_UpdateTimer; QTimer *m_ImageAndNavigationDataLoggingTimer; QmitkStdMultiWidget *m_StdMultiWidget; itk::SmartPointer m_CombinedModality; itk::SmartPointer m_SettingsNode; bool m_ReinitAlreadyDone; bool m_IsExperimentRunning; std::string m_CurrentApplicationName; itk::SmartPointer m_NavigationStepTimer; QPixmap m_IconRunning; QPixmap m_IconNotRunning; QString m_ResultsDirectory; QString m_ExperimentName; QString m_ExperimentResultsSubDirectory; std::vector m_NavigationStepNames; // stores the names of the navigation steps which are currently used (for logging purposes) mitk::USNavigationLoggingBackend m_LoggingBackend; mitk::USImageLoggingFilter::Pointer m_USImageLoggingFilter; mitk::NavigationDataRecorder::Pointer m_NavigationDataRecorder; // records navigation data files mitk::NodeDisplacementFilter::Pointer m_TargetNodeDisplacementFilter; mitk::NodeDisplacementFilter::Pointer m_AblationZonesDisplacementFilter; std::vector m_AblationZonesVector; int m_NeedleIndex; int m_MarkerIndex; int m_SceneNumber; itk::SmartPointer m_WarnOverlay; //To get tool storage mitk::NavigationDataSource::Pointer m_NavigationDataSource; mitk::NavigationToolStorage::Pointer m_CurrentStorage; + itk::SmartPointer m_BaseNode; itk::SmartPointer m_ImageStreamNode; private: Ui::QmitkUSNavigationMarkerPlacement *ui; }; #endif // USNAVIGATIONMARKERPLACEMENT_H diff --git a/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/QmitkUSNavigationMarkerPlacement.ui b/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/QmitkUSNavigationMarkerPlacement.ui index 4b111a6fed..953bcaad53 100644 --- a/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/QmitkUSNavigationMarkerPlacement.ui +++ b/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/QmitkUSNavigationMarkerPlacement.ui @@ -1,270 +1,251 @@ QmitkUSNavigationMarkerPlacement 0 0 562 446 Form true 0 Initialization Navigation Control 0 0 0 - 512 - 86 + 93 + 57 Target Initialize 0 0 - 115 - 67 + 93 + 57 Critical Structures Initialize 0 0 - 512 - 86 + 93 + 57 Needle Insertion Initialize Settings + + + + Qt::Horizontal + + + + + + + + + Enable Navigation Render Window Layout with RenderWindow + + + true + + + + + + + 1 + + + 3 + + + + + + + Refresh view + + + + + + + + + Qt::Horizontal + + + + + + + false + + + Finish Experiment + + + + + + + Start New Experiment + + + 20 20 - - - - Qt::Horizontal - - - - - - - - - Enable Navigation Render Window Layout with RenderWindow - - - true - - - - - - - 1 - - - 3 - - - - - - - Refresh view - - - - - - - - - false - - - Finish Experiment - - - - - - - Start New Experiment - - - - - - - 1 - - - - - - 10 - 20 - 512 - 237 - - - - - - - - - QmitkUSNavigationProcessWidget - QWidget -
src/internal/Widgets/QmitkUSNavigationProcessWidget.h
- 1 -
QmitkUSNavigationStepCombinedModality QWidget
src/internal/NavigationStepWidgets/QmitkUSNavigationStepCombinedModality.h
1
QmitkUSNavigationStepTumourSelection QWidget
src/internal/NavigationStepWidgets/QmitkUSNavigationStepTumourSelection.h
1
QmitkUSNavigationStepZoneMarking QWidget
src/internal/NavigationStepWidgets/QmitkUSNavigationStepZoneMarking.h
1
QmitkUSNavigationStepPunctuationIntervention QWidget
src/internal/NavigationStepWidgets/QmitkUSNavigationStepPunctuationIntervention.h
1
QmitkUSNavigationCombinedSettingsWidget QWidget
src/internal/SettingsWidgets/QmitkUSNavigationCombinedSettingsWidget.h
1
OnStartExperiment() OnFinishExperiment()
diff --git a/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/Widgets/QmitkUSNavigationProcessWidget.cpp b/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/Widgets/QmitkUSNavigationProcessWidget.cpp deleted file mode 100644 index e38511fa7e..0000000000 --- a/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/Widgets/QmitkUSNavigationProcessWidget.cpp +++ /dev/null @@ -1,564 +0,0 @@ -/*=================================================================== - -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 "QmitkUSNavigationProcessWidget.h" -#include "ui_QmitkUSNavigationProcessWidget.h" - -#include "../NavigationStepWidgets/QmitkUSAbstractNavigationStep.h" -#include "../SettingsWidgets/QmitkUSNavigationAbstractSettingsWidget.h" - -#include "mitkDataNode.h" -#include "mitkNavigationDataToNavigationDataFilter.h" - -#include -#include -#include - -QmitkUSNavigationProcessWidget::QmitkUSNavigationProcessWidget(QWidget* parent) : - QWidget(parent), - m_SettingsWidget(0), - m_BaseNode(mitk::DataNode::New()), m_CurrentTabIndex(0), m_CurrentMaxStep(0), - m_ImageAlreadySetToNode(false), - m_ReadySignalMapper(new QSignalMapper(this)), m_NoLongerReadySignalMapper(new QSignalMapper(this)), - m_StdMultiWidget(0), - m_UsePlanningStepWidget(false), - ui(new Ui::QmitkUSNavigationProcessWidget) -{ - m_Parent = parent; - - ui->setupUi(this); - - // remove the default page - ui->stepsToolBox->setCurrentIndex(1);// ->removeItem(0); - - //set shortcuts - QShortcut *nextShortcut = new QShortcut(QKeySequence("F10"), parent); - QShortcut *prevShortcut = new QShortcut(QKeySequence("F11"), parent); - connect(nextShortcut, SIGNAL(activated()), this, SLOT(OnNextButtonClicked())); - connect(prevShortcut, SIGNAL(activated()), this, SLOT(OnPreviousButtonClicked())); - - //connect other slots - connect( ui->restartStepButton, SIGNAL(clicked()), this, SLOT(OnRestartStepButtonClicked()) ); - connect( ui->previousButton, SIGNAL(clicked()), this, SLOT(OnPreviousButtonClicked()) ); - connect( ui->nextButton, SIGNAL(clicked()), this, SLOT(OnNextButtonClicked()) ); - connect( ui->stepsToolBox, SIGNAL(currentChanged(int)), this, SLOT(OnTabChanged(int)) ); - connect (ui->settingsButton, SIGNAL(clicked()), this, SLOT(OnSettingsButtonClicked()) ); - connect( m_ReadySignalMapper, SIGNAL(mapped(int)), this, SLOT(OnStepReady(int)) ); - connect( m_NoLongerReadySignalMapper, SIGNAL(mapped(int)), this, SLOT(OnStepNoLongerReady(int)) ); - - ui->settingsFrameWidget->setHidden(true); -} - -itk::SmartPointer QmitkUSNavigationProcessWidget::GetSettingsNode() -{ - return m_SettingsNode; -} - -QmitkUSNavigationProcessWidget::~QmitkUSNavigationProcessWidget() -{ - ui->stepsToolBox->blockSignals(true); - - for ( NavigationStepVector::iterator it = m_NavigationSteps.begin(); - it != m_NavigationSteps.end(); ++it ) - { - if ( (*it)->GetNavigationStepState() > QmitkUSAbstractNavigationStep::State_Stopped ) { (*it)->StopStep(); } - delete *it; - } - m_NavigationSteps.clear(); - - if ( m_SettingsNode.IsNotNull() && m_DataStorage.IsNotNull() ) - { - m_DataStorage->Remove(m_SettingsNode); - } - - delete ui; -} - -void QmitkUSNavigationProcessWidget::EnableInteraction(bool enable) -{ - if (enable) - { - ui->restartStepButton->setEnabled(true); - ui->previousButton->setEnabled(true); - ui->nextButton->setEnabled(true); - ui->stepsToolBox->setEnabled(true); - } - else - { - ui->restartStepButton->setEnabled(false); - ui->previousButton->setEnabled(false); - ui->nextButton->setEnabled(false); - ui->stepsToolBox->setEnabled(false); - } -} - -void QmitkUSNavigationProcessWidget::SetDataStorage(itk::SmartPointer dataStorage) -{ - m_DataStorage = dataStorage; - - if ( dataStorage.IsNull() ) - { - mitkThrow() << "Data Storage must not be null for QmitkUSNavigationProcessWidget."; - } - - // test if base node is already in the data storage and add it if not - m_BaseNode = dataStorage->GetNamedNode(QmitkUSAbstractNavigationStep::DATANAME_BASENODE); - if ( m_BaseNode.IsNull() ) - { - m_BaseNode = mitk::DataNode::New(); - m_BaseNode->SetName(QmitkUSAbstractNavigationStep::DATANAME_BASENODE); - dataStorage->Add(m_BaseNode); - } - - // base node and image stream node may be the same node - if ( strcmp(QmitkUSAbstractNavigationStep::DATANAME_BASENODE, QmitkUSAbstractNavigationStep::DATANAME_IMAGESTREAM) != 0) - { - m_ImageStreamNode = dataStorage->GetNamedNode(QmitkUSAbstractNavigationStep::DATANAME_IMAGESTREAM); - if (m_ImageStreamNode.IsNull()) - { - // Create Node for US Stream - m_ImageStreamNode = mitk::DataNode::New(); - m_ImageStreamNode->SetName(QmitkUSAbstractNavigationStep::DATANAME_IMAGESTREAM); - dataStorage->Add(m_ImageStreamNode); - } - } - else - { - m_ImageStreamNode = m_BaseNode; - } - - - m_SettingsNode = - dataStorage->GetNamedDerivedNode(QmitkUSAbstractNavigationStep::DATANAME_SETTINGS, m_BaseNode); - - if ( m_SettingsNode.IsNull() ) - { - m_SettingsNode = mitk::DataNode::New(); - m_SettingsNode->SetName(QmitkUSAbstractNavigationStep::DATANAME_SETTINGS); - dataStorage->Add(m_SettingsNode, m_BaseNode); - } - - if (m_SettingsWidget) { m_SettingsWidget->SetSettingsNode(m_SettingsNode); } - -} - -void QmitkUSNavigationProcessWidget::SetSettingsWidget(QmitkUSNavigationAbstractSettingsWidget* settingsWidget) -{ - // disconnect slots to settings widget if there was a widget before - if ( m_SettingsWidget ) - { - disconnect( ui->settingsSaveButton, SIGNAL(clicked()), m_SettingsWidget, SLOT(OnSave()) ); - disconnect( ui->settingsCancelButton, SIGNAL(clicked()), m_SettingsWidget, SLOT(OnCancel()) ); - - disconnect (m_SettingsWidget, SIGNAL(Saved()), this, SLOT(OnSettingsWidgetReturned()) ); - disconnect (m_SettingsWidget, SIGNAL(Canceled()), this, SLOT(OnSettingsWidgetReturned()) ); - disconnect (m_SettingsWidget, SIGNAL(SettingsChanged(itk::SmartPointer)), this, SLOT(OnSettingsChanged(itk::SmartPointer)) ); - - ui->settingsWidget->removeWidget(m_SettingsWidget); - } - - m_SettingsWidget = settingsWidget; - if ( m_SettingsWidget ) - { - m_SettingsWidget->LoadSettings(); - - connect( ui->settingsSaveButton, SIGNAL(clicked()), m_SettingsWidget, SLOT(OnSave()) ); - connect( ui->settingsCancelButton, SIGNAL(clicked()), m_SettingsWidget, SLOT(OnCancel()) ); - - connect (m_SettingsWidget, SIGNAL(Saved()), this, SLOT(OnSettingsWidgetReturned()) ); - connect (m_SettingsWidget, SIGNAL(Canceled()), this, SLOT(OnSettingsWidgetReturned()) ); - connect (m_SettingsWidget, SIGNAL(SettingsChanged(itk::SmartPointer)), this, SLOT(OnSettingsChanged(itk::SmartPointer)) ); - - if ( m_SettingsNode.IsNotNull() ) { m_SettingsWidget->SetSettingsNode(m_SettingsNode, true); } - - ui->settingsWidget->addWidget(m_SettingsWidget); - } - ui->settingsButton->setEnabled(m_SettingsWidget != 0); -} - -void QmitkUSNavigationProcessWidget::SetNavigationSteps(NavigationStepVector navigationSteps) -{ - disconnect( this, SLOT(OnTabChanged(int)) ); - - for ( int n = ui->stepsToolBox->count()-1; n >= 0; --n ) - { - //ui->stepsToolBox->removeItem(n); - } - - connect( ui->stepsToolBox, SIGNAL(currentChanged(int)), this, SLOT(OnTabChanged(int)) ); - - m_NavigationSteps.clear(); - - m_NavigationSteps = navigationSteps; - - this->InitializeNavigationStepWidgets(); - - // notify all navigation step widgets about the current settings - for (NavigationStepIterator it = m_NavigationSteps.begin(); it != m_NavigationSteps.end(); ++it) - { - (*it)->OnSettingsChanged(m_SettingsNode); - } -} - -void QmitkUSNavigationProcessWidget::ResetNavigationProcess() -{ - MITK_INFO("QmitkUSNavigationProcessWidget") << "Resetting navigation process."; - - ui->stepsToolBox->blockSignals(true); - for ( int n = 0; n <= m_CurrentMaxStep; ++n ) - { - m_NavigationSteps.at(n)->StopStep(); - //if ( n > 0 ) { ui->stepsToolBox->setItemEnabled(n, false); } - } - ui->stepsToolBox->blockSignals(false); - - m_CurrentMaxStep = 0; - - ui->stepsToolBox->setCurrentIndex(0); - - if ( m_NavigationSteps.size() > 0 ) - { - m_NavigationSteps.at(0)->ActivateStep(); - } - - this->UpdatePrevNextButtons(); -} - -void QmitkUSNavigationProcessWidget::UpdateNavigationProgress() -{ - if ( m_CombinedModality.IsNotNull() && !m_CombinedModality->GetUltrasoundDevice()->GetIsFreezed() ) - { - m_CombinedModality->Modified(); - m_CombinedModality->Update(); - - if ( m_LastNavigationDataFilter.IsNotNull() ) { m_LastNavigationDataFilter->Update(); } - - mitk::Image::Pointer image = m_CombinedModality->GetOutput(); - // make sure that always the current image is set to the data node - if ( image.IsNotNull() && m_ImageStreamNode->GetData() != image.GetPointer() && image->IsInitialized() ) - { - m_ImageStreamNode->SetData(image); - m_ImageAlreadySetToNode = true; - } - } - - if ( m_CurrentTabIndex > 0 && static_cast(m_CurrentTabIndex) < m_NavigationSteps.size() ) - { - m_NavigationSteps.at(m_CurrentTabIndex)->Update(); - } -} - -void QmitkUSNavigationProcessWidget::OnNextButtonClicked() -{ - emit SignalNextButtonClicked(); - if (m_CombinedModality.IsNotNull() && m_CombinedModality->GetUltrasoundDevice()->GetIsFreezed()) {return;} //no moving through steps when the modality is nullptr or frozen - - int currentIndex = ui->stepsToolBox->currentIndex(); - if (currentIndex >= m_CurrentMaxStep) - { - MITK_WARN << "Next button clicked though no next tab widget is available."; - return; - } - - ui->stepsToolBox->setCurrentIndex(++currentIndex); - - this->UpdatePrevNextButtons(); - -} - -void QmitkUSNavigationProcessWidget::OnPreviousButtonClicked() -{ - if (m_CombinedModality.IsNotNull() && m_CombinedModality->GetUltrasoundDevice()->GetIsFreezed()) {return;} //no moving through steps when the modality is nullptr or frozen - - int currentIndex = ui->stepsToolBox->currentIndex(); - if (currentIndex <= 0) - { - MITK_WARN << "Previous button clicked though no previous tab widget is available."; - return; - } - - ui->stepsToolBox->setCurrentIndex(--currentIndex); - - this->UpdatePrevNextButtons(); -} - -void QmitkUSNavigationProcessWidget::OnRestartStepButtonClicked() -{ - MITK_DEBUG("QmitkUSNavigationProcessWidget") << "Restarting step " - << m_CurrentTabIndex << " (" << m_NavigationSteps.at(m_CurrentTabIndex)->GetTitle().toStdString() << ")."; - - m_NavigationSteps.at(ui->stepsToolBox->currentIndex())->RestartStep(); - m_NavigationSteps.at(ui->stepsToolBox->currentIndex())->ActivateStep(); -} - -void QmitkUSNavigationProcessWidget::OnTabChanged(int index) -{ - emit SignalActiveNavigationStepChangeRequested(index); - if ( index < 0 || index >= static_cast(m_NavigationSteps.size()) ) - { - return; - } - else if ( m_CurrentTabIndex == index ) - { - // just activate the step if it is the same step againg - m_NavigationSteps.at(index)->ActivateStep(); - return; - } - - MITK_DEBUG("QmitkUSNavigationProcessWidget") << "Activating navigation step " - << index << " (" << m_NavigationSteps.at(index)->GetTitle().toStdString() <<")."; - - if (index > m_CurrentTabIndex) - { - this->UpdateFilterPipeline(); - - // finish all previous steps to make sure that all data is valid - for (int n = m_CurrentTabIndex; n < index; ++n) - { - m_NavigationSteps.at(n)->FinishStep(); - } - } - - // deactivate the previously active step - if ( m_CurrentTabIndex > 0 && m_NavigationSteps.size() > static_cast(m_CurrentTabIndex) ) - { - m_NavigationSteps.at(m_CurrentTabIndex)->DeactivateStep(); - } - - // start step of the current tab if it wasn't started before - if ( m_NavigationSteps.at(index)->GetNavigationStepState() == QmitkUSAbstractNavigationStep::State_Stopped ) - { - m_NavigationSteps.at(index)->StartStep(); - } - - m_NavigationSteps.at(index)->ActivateStep(); - - if (static_cast(index) < m_NavigationSteps.size()) - ui->restartStepButton->setEnabled(m_NavigationSteps.at(index)->GetIsRestartable()); - - this->UpdatePrevNextButtons(); - - m_CurrentTabIndex = index; - emit SignalActiveNavigationStepChanged(index); -} - -void QmitkUSNavigationProcessWidget::OnSettingsButtonClicked() -{ - this->SetSettingsWidgetVisible(true); -} - -void QmitkUSNavigationProcessWidget::OnSettingsWidgetReturned() -{ - this->SetSettingsWidgetVisible(false); -} - -void QmitkUSNavigationProcessWidget::OnSettingsNodeChanged(itk::SmartPointer dataNode) -{ - if ( m_SettingsWidget ) m_SettingsWidget->SetSettingsNode(dataNode); -} - -void QmitkUSNavigationProcessWidget::OnStepReady(int index) -{ - if (m_CurrentMaxStep <= index) - { - m_CurrentMaxStep = index + 1; - this->UpdatePrevNextButtons(); - for (int n = 0; n <= m_CurrentMaxStep; ++n) - { - //ui->stepsToolBox->setItemEnabled(n, true); - } - } - - emit SignalNavigationStepFinished(index, true); -} - -void QmitkUSNavigationProcessWidget::OnStepNoLongerReady(int index) -{ - if (m_CurrentMaxStep > index) - { - m_CurrentMaxStep = index; - this->UpdatePrevNextButtons(); - this->UpdateFilterPipeline(); - for (int n = m_CurrentMaxStep+1; n < ui->stepsToolBox->count(); ++n) - { - //ui->stepsToolBox->setItemEnabled(n, false); - m_NavigationSteps.at(n)->StopStep(); - } - } - - emit SignalNavigationStepFinished(index, false); -} - -void QmitkUSNavigationProcessWidget::OnCombinedModalityChanged(itk::SmartPointer combinedModality) -{ - m_CombinedModality = combinedModality; - m_ImageAlreadySetToNode = false; - - if ( combinedModality.IsNotNull() ) - { - if ( combinedModality->GetNavigationDataSource().IsNull() ) - { - MITK_WARN << "There is no navigation data source set for the given combined modality."; - return; - } - - this->UpdateFilterPipeline(); - } - - for (NavigationStepIterator it = m_NavigationSteps.begin(); it != m_NavigationSteps.end(); ++it) - { - (*it)->SetCombinedModality(combinedModality); - } - - emit SignalCombinedModalityChanged(combinedModality); -} - -void QmitkUSNavigationProcessWidget::OnSettingsChanged(const mitk::DataNode::Pointer dataNode) -{ - static bool methodEntered = false; - if ( methodEntered ) - { - MITK_WARN("QmitkUSNavigationProcessWidget") << "Ignoring recursive call to 'OnSettingsChanged()'. " - << "Make sure to no emit 'SignalSettingsNodeChanged' in an 'OnSettingsChanged()' method."; - return; - } - methodEntered = true; - - std::string application; - if ( dataNode->GetStringProperty("settings.application", application) ) - { - QString applicationQString = QString::fromStdString(application); - if ( applicationQString != ui->titleLabel->text() ) - { - ui->titleLabel->setText(applicationQString); - } - } - - // notify all navigation step widgets about the changed settings - for (NavigationStepIterator it = m_NavigationSteps.begin(); it != m_NavigationSteps.end(); ++it) - { - (*it)->OnSettingsChanged(dataNode); - } - - emit SignalSettingsChanged(dataNode); - - methodEntered = false; -} - -void QmitkUSNavigationProcessWidget::InitializeNavigationStepWidgets() -{ - // do not listen for steps tool box signal during insertion of items into tool box - disconnect( ui->stepsToolBox, SIGNAL(currentChanged(int)), this, SLOT(OnTabChanged(int)) ); - - m_CurrentMaxStep = 0; - - mitk::DataStorage::Pointer dataStorage = m_DataStorage; - - for (unsigned int n = 0; n < m_NavigationSteps.size(); ++n) - { - QmitkUSAbstractNavigationStep* curNavigationStep = m_NavigationSteps.at(n); - - curNavigationStep->SetDataStorage(dataStorage); - - connect( curNavigationStep, SIGNAL(SignalReadyForNextStep()), m_ReadySignalMapper, SLOT(map())); - connect( curNavigationStep, SIGNAL(SignalNoLongerReadyForNextStep()), m_NoLongerReadySignalMapper, SLOT(map()) ); - connect( curNavigationStep, SIGNAL(SignalCombinedModalityChanged(itk::SmartPointer)), this, SLOT(OnCombinedModalityChanged(itk::SmartPointer)) ); - connect( curNavigationStep, SIGNAL(SignalIntermediateResult(const itk::SmartPointer)), this, SIGNAL(SignalIntermediateResult(const itk::SmartPointer)) ); - connect( curNavigationStep, SIGNAL(SignalSettingsNodeChanged(itk::SmartPointer)), this, SLOT(OnSettingsNodeChanged(itk::SmartPointer)) ); - - m_ReadySignalMapper->setMapping(curNavigationStep, n); - m_NoLongerReadySignalMapper->setMapping(curNavigationStep, n); - - ui->stepsToolBox->insertWidget(n, curNavigationStep); - //if ( n > 0 ) { ui->stepsToolBox->get(n, false); } - } - - ui->restartStepButton->setEnabled(m_NavigationSteps.at(0)->GetIsRestartable()); - ui->stepsToolBox->setCurrentIndex(0); - - // activate the first navigation step widgets - if ( ! m_NavigationSteps.empty() ) { m_NavigationSteps.at(0)->ActivateStep(); } - - // after filling the steps tool box the signal is interesting again - connect( ui->stepsToolBox, SIGNAL(currentChanged(int)), this, SLOT(OnTabChanged(int)) ); - - this->UpdateFilterPipeline(); -} - -void QmitkUSNavigationProcessWidget::UpdatePrevNextButtons() -{ - int currentIndex = ui->stepsToolBox->currentIndex(); - - ui->previousButton->setEnabled(currentIndex > 0); - ui->nextButton->setEnabled(currentIndex < m_CurrentMaxStep); -} - -void QmitkUSNavigationProcessWidget::UpdateFilterPipeline() -{ - if ( m_CombinedModality.IsNull() ) { return; } - - std::vector filterList; - - mitk::NavigationDataSource::Pointer navigationDataSource = m_CombinedModality->GetNavigationDataSource(); - - for (unsigned int n = 0; n <= static_cast(m_CurrentMaxStep) && n < m_NavigationSteps.size(); ++n) - { - QmitkUSAbstractNavigationStep::FilterVector filter = m_NavigationSteps.at(n)->GetFilter(); - if ( ! filter.empty() ) { filterList.insert(filterList.end(), filter.begin(), filter.end()); } - } - - if ( ! filterList.empty() ) - { - for (unsigned int n = 0; n < navigationDataSource->GetNumberOfOutputs(); ++n) - { - filterList.at(0)->SetInput(n, navigationDataSource->GetOutput(n)); - } - - for (std::vector::iterator it = filterList.begin()+1; - it != filterList.end(); ++it) - { - std::vector::iterator prevIt = it-1; - - for (unsigned int n = 0; n < (*prevIt)->GetNumberOfOutputs(); ++n) - { - (*it)->SetInput(n, (*prevIt)->GetOutput(n)); - } - } - - m_LastNavigationDataFilter = filterList.at(filterList.size()-1); - } - else - { - m_LastNavigationDataFilter = navigationDataSource.GetPointer(); - } -} - -void QmitkUSNavigationProcessWidget::SetSettingsWidgetVisible(bool visible) -{ - ui->settingsFrameWidget->setVisible(visible); - ui->stepsToolBox->setHidden(visible); - ui->settingsButton->setHidden(visible); - ui->restartStepButton->setHidden(visible); - ui->previousButton->setHidden(visible); - ui->nextButton->setHidden(visible); -} - -void QmitkUSNavigationProcessWidget::FinishCurrentNavigationStep() -{ - int currentIndex = ui->stepsToolBox->currentIndex(); - QmitkUSAbstractNavigationStep* curNavigationStep = m_NavigationSteps.at(currentIndex); - curNavigationStep->FinishStep(); -} diff --git a/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/Widgets/QmitkUSNavigationProcessWidget.h b/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/Widgets/QmitkUSNavigationProcessWidget.h deleted file mode 100644 index 8c33a14002..0000000000 --- a/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/Widgets/QmitkUSNavigationProcessWidget.h +++ /dev/null @@ -1,183 +0,0 @@ -/*=================================================================== - -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 USNAVIGATIONPROCESSWIDGET_H -#define USNAVIGATIONPROCESSWIDGET_H - -#include - -#include -#include -#include - -namespace itk { -template class SmartPointer; -} - -namespace mitk { -class NodeDisplacementFilter; -} - -namespace Ui { -class QmitkUSNavigationProcessWidget; -} - -class QmitkUSAbstractNavigationStep; -class QmitkUSNavigationAbstractSettingsWidget; -class QmitkUSNavigationStepCombinedModality; - -class QmitkStdMultiWidget; - -class QTimer; -class QSignalMapper; - -/** - * \brief Widget for handling navigation steps. - * The navigation steps (subclasses of QmitkUSAbstractNavigationStep) can be set - * in a vector. The coordination of this steps is done by this widget then. - */ -class QmitkUSNavigationProcessWidget : public QWidget -{ - Q_OBJECT - -signals: - /** - * \brief Signals a replacement of the combined modality by one of the navigation steps. - */ - void SignalCombinedModalityChanged(itk::SmartPointer); - - /** - * \brief Signals a change of the navigation settings. - */ - void SignalSettingsChanged(itk::SmartPointer); - - /** - * \brief Signals if a change of the currently active navigation step is requested. Gives the index of the new step. - */ - void SignalActiveNavigationStepChangeRequested(int); - - /** - * \brief Signals a change of the currently active navigation step after the step was changed. - */ - void SignalActiveNavigationStepChanged(int); - - /** - * \brief Signals that the navigation step with the given id was finished. - */ - void SignalNavigationStepFinished(int, bool); - - void SignalNextButtonClicked(); - - /** - * \brief Signals the creation of an intermediate result. - * The result data is given as properties of the data node. - */ - void SignalIntermediateResult(const itk::SmartPointer); - -protected slots: - void OnNextButtonClicked(); - void OnPreviousButtonClicked(); - void OnRestartStepButtonClicked(); - void OnTabChanged(int index); - void OnSettingsButtonClicked(); - void OnSettingsWidgetReturned(); - void OnSettingsNodeChanged(itk::SmartPointer); - - void OnStepReady(int); - void OnStepNoLongerReady(int); - - void OnCombinedModalityChanged(itk::SmartPointer); - void OnSettingsChanged(const itk::SmartPointer); - -public: - typedef std::vector NavigationStepVector; - typedef NavigationStepVector::iterator NavigationStepIterator; - - explicit QmitkUSNavigationProcessWidget(QWidget* parent = 0); - ~QmitkUSNavigationProcessWidget(); - - itk::SmartPointer GetSettingsNode(); - - /** - * \brief Setter for the data storage used for storing the navigation progress. - */ - void SetDataStorage(itk::SmartPointer dataStorage); - - void SetSettingsWidget(QmitkUSNavigationAbstractSettingsWidget*); - - /** - * \brief Setter for a vector of navigation step widgets. - * These widgets are used for the navigation process in the order of their - * appearance in this vector. - */ - void SetNavigationSteps(NavigationStepVector navigationSteps); - - /** - * \brief Forget the current progress of the navigation process. - * The process will then start again at the beginning. - */ - void ResetNavigationProcess(); - - /** Enables/disables the (navigation step) interaction with this widget. - * The settings button is not affected by this flag. - */ - void EnableInteraction(bool enable); - - /** Finishes the current navigation step. */ - void FinishCurrentNavigationStep(); - - /** Updates the navigation process widget, which includes updating the - * navigation pipeline. Has to be called from outside this class with - * a given update rate. So no additional internal timer is needed. - */ - void UpdateNavigationProgress(); - -protected: - void InitializeNavigationStepWidgets(); - void UpdatePrevNextButtons(); - void UpdateFilterPipeline(); - void SetSettingsWidgetVisible(bool visible); - - itk::SmartPointer m_DataStorage; - NavigationStepVector m_NavigationSteps; - QmitkUSNavigationAbstractSettingsWidget* m_SettingsWidget; - - itk::SmartPointer m_BaseNode; - itk::SmartPointer m_SettingsNode; - - int m_CurrentTabIndex; - int m_CurrentMaxStep; - - itk::SmartPointer m_ImageStreamNode; - bool m_ImageAlreadySetToNode; - - itk::SmartPointer m_CombinedModality; - - itk::SmartPointer m_LastNavigationDataFilter; - - QWidget* m_Parent; - QSignalMapper* m_ReadySignalMapper; - QSignalMapper* m_NoLongerReadySignalMapper; - - QmitkStdMultiWidget* m_StdMultiWidget; - - bool m_UsePlanningStepWidget; - -private: - Ui::QmitkUSNavigationProcessWidget *ui; -}; - -#endif // USNAVIGATIONPROCESSWIDGET_H diff --git a/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/Widgets/QmitkUSNavigationProcessWidget.ui b/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/Widgets/QmitkUSNavigationProcessWidget.ui deleted file mode 100644 index 5526f413c9..0000000000 --- a/Plugins/org.mitk.gui.qt.igt.app.echotrack/src/internal/Widgets/QmitkUSNavigationProcessWidget.ui +++ /dev/null @@ -1,203 +0,0 @@ - - - QmitkUSNavigationProcessWidget - - - - 0 - 0 - 465 - 757 - - - - Form - - - - - - - font-size: 10pt; - font-weight: bold; - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - 0 - - - - - - - - - - - - - false - - - Open Preferences - - - Preferences - - - - :/USNavigation/preferences.png:/USNavigation/preferences.png - - - - - - - false - - - false - - - Restart the Current Step - - - &Restart Step - - - - :/USNavigation/restart.png:/USNavigation/restart.png - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - false - - - Go to Previous Step - - - &Prev - - - - :/USNavigation/go-previous.png:/USNavigation/go-previous.png - - - - - - - false - - - Go to Next Step - - - &Next - - - - :/USNavigation/go-next.png:/USNavigation/go-next.png - - - - - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600;">Settings</span></p></body></html> - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Save - - - - :/USNavigation/document-save.png:/USNavigation/document-save.png - - - - - - - Cancel - - - - :/USNavigation/restart.png:/USNavigation/restart.png - - - - - - - - - - - - - - - - OnNextButtonClicked() - OnPreviousButtonClicked() - OnRestartStepButtonClicked() - OnTabChanged(int) - -