MCPcopy Create free account
hub / github.com/MITK/MITK / OnInitContour

Method OnInitContour

Modules/Segmentation/src/Interactions/mitkEditableContourTool.cpp:107–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107void mitk::EditableContourTool::OnInitContour(StateMachineAction *, InteractionEvent *interactionEvent)
108{
109 auto positionEvent = dynamic_cast<mitk::InteractionPositionEvent *>(interactionEvent);
110 if (nullptr == positionEvent)
111 return;
112
113 auto workingDataNode = this->GetWorkingDataNode();
114
115 if (nullptr != this->GetContour())
116 {
117 this->ConfirmSegmentation(false);
118 }
119
120 if (!IsPositionEventInsideImageRegion(positionEvent, workingDataNode->GetData()))
121 {
122 this->ResetToStartState();
123 return;
124 }
125
126 m_LastEventSender = positionEvent->GetSender();
127 m_LastEventSlice = m_LastEventSender->GetSlice();
128
129 auto contour = this->CreateNewContour();
130 m_ContourNode = mitk::DataNode::New();
131 m_ContourNode->SetData(contour);
132 m_ContourNode->SetName("working contour node");
133 m_ContourNode->SetProperty("layer", IntProperty::New(100));
134 m_ContourNode->AddProperty("fixedLayer", BoolProperty::New(true));
135 m_ContourNode->SetProperty("helper object", mitk::BoolProperty::New(true));
136 m_ContourNode->AddProperty("contour.color", ColorProperty::New(1.0f, 1.0f, 0.0f), nullptr, true);
137 m_ContourNode->AddProperty("contour.points.color", ColorProperty::New(1.0f, 0.0f, 0.1f), nullptr, true);
138 m_ContourNode->AddProperty("contour.controlpoints.show", BoolProperty::New(true), nullptr, true);
139
140 m_PreviewContour = this->CreateNewContour();
141 m_PreviewContourNode = mitk::DataNode::New();
142 m_PreviewContourNode->SetData(m_PreviewContour);
143 m_PreviewContourNode->SetName("active preview node");
144 m_PreviewContourNode->SetProperty("layer", IntProperty::New(101));
145 m_PreviewContourNode->AddProperty("fixedLayer", BoolProperty::New(true));
146 m_PreviewContourNode->SetProperty("helper object", mitk::BoolProperty::New(true));
147 m_PreviewContourNode->AddProperty("contour.color", ColorProperty::New(0.1f, 1.0f, 0.1f), nullptr, true);
148 m_PreviewContourNode->AddProperty("contour.width", mitk::FloatProperty::New(4.0f), nullptr, true);
149
150
151 m_ClosureContour = this->CreateNewContour();
152 m_ClosureContourNode = mitk::DataNode::New();
153 m_ClosureContourNode->SetData(m_ClosureContour);
154 m_ClosureContourNode->SetName("active closure node");
155 m_ClosureContourNode->SetProperty("layer", IntProperty::New(101));
156 m_ClosureContourNode->AddProperty("fixedLayer", BoolProperty::New(true));
157 m_ClosureContourNode->SetProperty("helper object", mitk::BoolProperty::New(true));
158 m_ClosureContourNode->AddProperty("contour.color", ColorProperty::New(0.0f, 1.0f, 0.1f), nullptr, true);
159 m_ClosureContourNode->AddProperty("contour.width", mitk::FloatProperty::New(2.0f), nullptr, true);
160
161 m_CurrentRestrictedArea = this->CreateNewContour();
162
163 auto dataStorage = this->GetToolManager()->GetDataStorage();
164 dataStorage->Add(m_ContourNode, workingDataNode);

Callers

nothing calls this directly

Calls 15

GetContourMethod · 0.95
ConfirmSegmentationMethod · 0.95
CreateNewContourMethod · 0.95
PrepareInitContourMethod · 0.95
GetWorkingDataNodeMethod · 0.80
ResetToStartStateMethod · 0.80
GetSenderMethod · 0.80
GetSlicedGeometryMethod · 0.80
GetPositionInWorldMethod · 0.80
NewFunction · 0.50

Tested by

no test coverage detected