14#include "ui_QmitkUSNavigationStepZoneMarking.h"
22 m_ZoneDisplacementFilter(
mitk::NodeDisplacementFilter::New()),
23 m_ReferenceSensorIndex(1),
24 m_CurrentlyAddingZone(false),
29 connect( ui->freezeButton, SIGNAL(SignalFreezed(
bool)),
this, SLOT(
OnFreeze(
bool)) );
30 connect( ui->zonesWidget, SIGNAL(ZoneAdded()),
this, SLOT(
OnZoneAdded()) );
31 connect( ui->zonesWidget, SIGNAL(ZoneRemoved()),
this, SLOT(
OnZoneRemoved()) );
32 connect(ui->showStructureList, SIGNAL(stateChanged(
int)),
this, SLOT(
OnShowListClicked(
int)));
33 ui->zonesLabel->setVisible(
false);
34 ui->zonesWidget->setVisible(
false);
39 ui->zonesLabel->setVisible(state);
40 ui->zonesWidget->setVisible(state);
61 ui->zonesWidget->OnResetZones();
65 mitk::DataStorage::Pointer dataStorage = this->
GetDataStorage(
false);
66 if ( dataStorage.IsNotNull() )
69 if ( baseNode.IsNotNull() )
95 ui->freezeButton->Unfreeze();
111 ui->bodyMarkerTrackingStatusLabel->setStyleSheet(
112 "background-color: #8bff8b; margin-right: 1em; margin-left: 1em; border: 1px solid grey");
113 ui->bodyMarkerTrackingStatusLabel->setText(
"Body marker is inside the tracking volume.");
117 ui->bodyMarkerTrackingStatusLabel->setStyleSheet(
118 "background-color: #ff7878; margin-right: 1em; margin-left: 1em; border: 1px solid grey");
119 ui->bodyMarkerTrackingStatusLabel->setText(
"Body marker is not inside the tracking volume.");
122 ui->freezeButton->setEnabled(valid);
127 if ( settingsNode.IsNull() ) {
return; }
129 std::string stateMachineFilename;
130 if ( settingsNode->GetStringProperty(
"settings.interaction-concept", stateMachineFilename) && stateMachineFilename !=
m_StateMachineFilename )
133 ui->zonesWidget->SetStateMachineFilename(stateMachineFilename);
136 std::string referenceSensorName;
137 if ( settingsNode->GetStringProperty(
"settings.reference-name-selected", referenceSensorName) )
147 return "Critical Structures";
159 ui->zoneAddingExplanationLabel->setEnabled(freezed);
164 ui->zonesWidget->OnStartAddingZone();
171 ui->zonesWidget->OnAbortAddingZone();
181 ui->freezeButton->Unfreeze();
183 ui->zoneAddingExplanationLabel->setEnabled(ui->freezeButton->isChecked());
185 mitk::DataStorage::SetOfObjects::ConstPointer zoneNodesSet = ui->zonesWidget->GetZoneNodes();
186 for (mitk::DataStorage::SetOfObjects::ConstIterator it = zoneNodesSet->Begin();
187 it != zoneNodesSet->End(); ++it)
194 it->Value()->GetFloatProperty(
"zone.size", radius);
195 MITK_INFO(
"QmitkUSNavigationStepZoneMarking")(
"QmitkUSAbstractNavigationStep")
196 <<
"Risk zone (" << it->Value()->GetName() <<
") added with center "
197 << it->Value()->GetData()->GetGeometry()->GetOrigin() <<
" and radius " << radius <<
".";
207 mitk::DataStorage::SetOfObjects::ConstPointer zoneNodesSet = ui->zonesWidget->GetZoneNodes();
209 for (
int n =
m_ZoneNodes.size() - 1; n >= 0; --n )
214 for (mitk::DataStorage::SetOfObjects::ConstIterator itSet = zoneNodesSet->Begin();
215 itSet != zoneNodesSet->End(); ++itSet)
217 if (
m_ZoneNodes.at(n) == itSet->Value() ) { found =
true;
break; }
222 MITK_INFO(
"QmitkUSNavigationStepZoneMarking")(
"QmitkUSAbstractNavigationStep")
223 <<
"Risk zone (" <<
m_ZoneNodes.at(n)->GetName() <<
") removed.";
233 mitk::AbstractUltrasoundTrackerDevice::Pointer combinedModality = this->
GetCombinedModality(
false);
234 if (combinedModality.IsNotNull())
255 catch (
const std::exception &e )
257 MITK_WARN(
"QmitkUSAbstractNavigationStep")(
"QmitkUSNavigationStepZoneMarking")
258 <<
"Cannot get index for reference sensor name: " << e.what();
Abstract base class for navigation step widgets.
itk::SmartPointer< mitk::DataStorage > GetDataStorage(bool throwNull=true)
Returns the data storage set for the navigation step.
NavigationStepState GetNavigationStepState()
Get the current state of the navigation step.
void SignalReadyForNextStep()
Signals that all necessary actions where done. The user can proceed with the next stept after this wa...
static const char * DATANAME_BASENODE
itk::SmartPointer< mitk::DataNode > GetNamedDerivedNodeAndCreate(const char *name, const char *sourceName)
Returns node with the given name and the given source node (parent) from the data storage....
itk::SmartPointer< mitk::AbstractUltrasoundTrackerDevice > GetCombinedModality(bool throwNull=true)
Returns the combined modality set for the navigation step.
std::vector< itk::SmartPointer< mitk::NavigationDataToNavigationDataFilter > > FilterVector
static const char * DATANAME_ZONES
Navigation step for marking risk structures. The user can add risk structures by interacting with the...
QString GetTitle() override
Getter for the title of the navigation step. This title should be human readable and can be used to d...
bool m_CurrentlyAddingZone
bool OnFinishStep() override
There is nothing to be done.
void OnZoneRemoved()
Triggered when a risk zone was removed. Removes the zone from a member variable and from the node dis...
itk::SmartPointer< mitk::NavigationDataSource > m_NavigationDataSource
bool OnStopStep() override
Resets widget and filter and removes nodes from the data storage.
std::string m_ReferenceSensorName
void OnSettingsChanged(const itk::SmartPointer< mitk::DataNode > settingsNode) override
itk::SmartPointer< mitk::NodeDisplacementFilter > m_ZoneDisplacementFilter
void OnFreeze(bool freezed)
QmitkUSNavigationStepZoneMarking(QWidget *parent=nullptr)
void OnShowListClicked(int state)
void OnSetCombinedModality() override
Called every time SetCombinedModality() was called. This method may be implemented by a concrete subc...
void OnUpdate() override
Updates just the tracking validity status.
void OnZoneAdded()
Triggered when a risk zone was added. Adds the zone to a member variable and to the node displacement...
bool OnStartStep() override
Initialization of the data storage nodes.
~QmitkUSNavigationStepZoneMarking() override
FilterVector GetFilter() override
bool OnActivateStep() override
Selects input for the node displacement filter and emits "ReadyForNextStep" signal....
std::string m_StateMachineFilename
void UpdateReferenceSensorName()
bool OnDeactivateStep() override
Called when the navigation step gets deactivated (-> state started). This method may be implemented b...
std::vector< itk::SmartPointer< mitk::DataNode > > m_ZoneNodes
unsigned int m_ReferenceSensorIndex