Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkSegmentationsProcessingTool.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
14 #include "mitkProgressBar.h"
15 #include "mitkToolManager.h"
16 
18 {
19 }
20 
22 {
23 }
24 
26 {
27  return "segmentationProcessing";
28 }
29 
31 {
32  Superclass::Activated();
33 
36 }
37 
39 {
40  Superclass::Deactivated();
41 }
42 
44 {
45  m_FailedNodes.clear();
47 
49  ProgressBar::GetInstance()->AddStepsToDo(nodes.size() + 2);
50 
51  // for all selected nodes
52  for (auto nodeiter = nodes.begin(); nodeiter != nodes.end(); ++nodeiter)
53  {
54  DataNode::Pointer node = *nodeiter;
55 
56  if (!ProcessOneWorkingData(node))
57  {
58  std::string nodeName;
59  m_FailedNodes += " '";
60  if (node->GetName(nodeName))
61  {
62  m_FailedNodes += nodeName.c_str();
63  }
64  else
65  {
66  m_FailedNodes += "(no name)";
67  }
68  m_FailedNodes += "'";
69  }
70 
72  }
73 
76 }
77 
79 {
80 }
81 
83 {
84  return true;
85 }
86 
88 {
90 }
91 
93 {
94  if (!m_FailedNodes.empty())
95  {
97  }
98 }
99 
101 {
102  return "Processing of these nodes failed:";
103 }
void Progress(unsigned int steps=1)
Sets the current amount of progress to current progress + steps.
Base class of all tools used by mitk::ToolManager.
Definition: mitkTool.h:86
std::vector< DataNode * > DataVectorType
Message1< std::string > ErrorMessage
To send error messages (to be shown by some GUI)
Definition: mitkTool.h:99
static ProgressBar * GetInstance()
static method to get the GUI dependent ProgressBar-instance so the methods for steps to do and progre...
bool ActivateTool(int id)
virtual void ProcessAllObjects()
Loop over all working data items.
void Activated() override
Called when the tool gets activated.
void Deactivated() override
Called when the tool gets deactivated.
virtual void StartProcessingAllData()
Subclasses should override this method.
virtual std::string GetErrorMessage()
Describes the error (if one occurred during processing).
virtual void SendErrorMessageIfAny()
Sends an error message if there was an error during processing.
void AddStepsToDo(unsigned int steps)
Adds steps to totalSteps.
ToolManager * m_ToolManager
Definition: mitkTool.h:228
const char * GetGroup() const override
Name of a group.
virtual bool ProcessOneWorkingData(DataNode *node)
Subclasses should override this method.
virtual void FinishProcessingAllData()
Subclasses should override this method.
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57
DataVectorType GetWorkingData()