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

Method UnloadTasks

Modules/SegmentationUI/src/QmitkSegmentationTaskListWidget.cpp:788–824  ·  view source on GitHub ↗

Unload all task data nodes but spare the passed image data node. */

Source from the content-addressed store, hash-verified

786/* Unload all task data nodes but spare the passed image data node.
787 */
788void QmitkSegmentationTaskListWidget::UnloadTasks(const mitk::DataNode* skip)
789{
790 this->UnsubscribeFromActiveSegmentation();
791
792 auto prefs = GetSegmentationPreferences();
793 if (prefs != nullptr)
794 {
795 prefs->RemoveOverride("default label naming");
796 prefs->RemoveOverride("external label suggestions");
797 prefs->RemoveOverride("replace standard suggestions");
798 prefs->RemoveOverride("suggest once");
799 }
800
801 m_ImageNode = nullptr;
802 m_SegmentationNode = nullptr;
803
804 if (m_TaskListNode.IsNotNull())
805 {
806 auto notSkip = mitk::NodePredicateFunction::New([skip](const mitk::DataNode* node) {
807 return skip != node;
808 });
809
810 auto taskNodes = m_DataStorage->GetDerivations(m_TaskListNode, notSkip, false);
811
812 m_DataStorage->Remove(taskNodes);
813
814 // Removal is done in a random order instead of traveling upwards from
815 // child nodes to parent nodes. This may result in temporary orphan nodes
816 // hierarchically existing outside of the segmentation task list parent
817 // node. To prevent the detection of unrelated data, which would put this
818 // widget into a warning mode, do a final data storage check after
819 // everything was removed.
820 this->CheckDataStorage();
821 }
822
823 this->SetActiveTaskIndex(std::nullopt);
824}
825
826void QmitkSegmentationTaskListWidget::LoadNextUnfinishedTask()
827{

Callers 2

OnSelectionChangedMethod · 0.95
LoadTaskMethod · 0.95

Calls 9

CheckDataStorageMethod · 0.95
SetActiveTaskIndexMethod · 0.95
IsNotNullMethod · 0.80
GetDerivationsMethod · 0.80
NewFunction · 0.50
RemoveOverrideMethod · 0.45
RemoveMethod · 0.45

Tested by

no test coverage detected