34 #include <itkObjectFactory.h>
49 m_PredicateImageColorful(
NodePredicateAnd::
New(m_PredicateNotBinary, m_PredicateNotSegmentation)),
50 m_PredicateImageColorfulNotHelper(
NodePredicateAnd::
New(m_PredicateImageColorful, m_PredicateNotHelper)),
51 m_PredicateReference(
NodePredicateAnd::
New(m_PredicateImage3D, m_PredicateImageColorfulNotHelper)),
52 m_IsSegmentationPredicate(
54 m_InteractorType(type),
55 m_DisplayInteractorConfigs(),
56 m_EventConfig(
"DisplayConfigMITK.xml")
71 if (m_InteractorType.empty())
74 m_InteractorType +=
".xml";
81 catch (
const std::exception &e)
83 MITK_ERROR <<
"Could not load statemachine pattern " << m_InteractorType <<
" with exception: " << e.what();
93 this->HandleEvent(interactionEvent,
nullptr);
113 m_ToolManager = manager;
122 m_DisplayInteractorConfigs.clear();
123 std::vector<us::ServiceReference<InteractionEventObserver>> listEventObserver =
126 it != listEventObserver.end();
131 if (displayInteractor !=
nullptr)
134 m_DisplayInteractorConfigs.insert(std::make_pair(*it, displayInteractor->
GetEventConfig()));
145 for (std::map<us::ServiceReferenceU, EventConfig>::iterator it = m_DisplayInteractorConfigs.begin();
146 it != m_DisplayInteractorConfigs.end();
153 if (displayInteractor !=
nullptr)
160 m_DisplayInteractorConfigs.clear();
167 std::string classname = this->GetNameOfClass();
168 std::string guiClassname = toolkitPrefix + classname + toolkitPostfix;
170 std::list<itk::LightObject::Pointer> allGUIs = itk::ObjectFactoryBase::CreateAllInstance(guiClassname.c_str());
171 for (std::list<itk::LightObject::Pointer>::iterator iter = allGUIs.begin(); iter != allGUIs.end(); ++iter)
175 object =
dynamic_cast<itk::Object *
>(iter->GetPointer());
179 MITK_ERROR <<
"There is more than one GUI for " << classname <<
" (several factories claim ability to produce a "
180 << guiClassname <<
" ) " << std::endl;
190 return m_PredicateReference.GetPointer();
195 return m_IsSegmentationPredicate.GetPointer();
199 const std::string &organName,
207 PixelType pixelType(mitk::MakeScalarPixelType<DefaultSegmentationDataType>());
213 segmentation->Initialize(pixelType, 3, dimensions);
214 segmentation->AddLayer();
218 segmentation->Initialize(original);
222 label->SetName(organName);
223 label->SetColor(color);
225 segmentation->GetActiveLabelSet()->AddLabel(label);
226 segmentation->GetActiveLabelSet()->SetActiveLabel(1);
230 if (segmentation->GetDimension() < 4)
232 for (
unsigned int dim = 0; dim < segmentation->GetDimension(); ++dim)
234 byteSize *= segmentation->GetDimension(dim);
239 memset(writeAccess.GetData(), 0, byteSize);
244 for (
unsigned int dim = 0; dim < 3; ++dim)
246 byteSize *= segmentation->GetDimension(dim);
249 for (
unsigned int volumeNumber = 0; volumeNumber < segmentation->GetDimension(3); volumeNumber++)
253 memset(writeAccess.GetData(), 0, byteSize);
260 segmentation->SetTimeGeometry(originalGeometry);
264 Tool::ErrorMessage(
"Original image does not have a 'Time sliced geometry'! Cannot create a segmentation.");
268 return CreateSegmentationNode(segmentation, organName, color);
272 const std::string &organName,
280 segmentationNode->SetData(image);
291 lutProp->SetLookupTable(lut);
292 segmentationNode->SetProperty(
"LookupTable", lutProp);
293 segmentationNode->SetProperty(
"texture interpolation",
BoolProperty::New(
false));
298 segmentationNode->SetProperty(
"reslice interpolation",
305 return segmentationNode;
Predicate that evaluates if the given DataNode has a specific property. If the second parameter is NU...
Composite predicate that negates its child predicate Changed: NodePredicateNot now derives from NodeP...
Base class to implement InteractionEventObservers.
itk::SmartPointer< Self > Pointer
Observer that manages the interaction with the display.
Base of all data objects.
Predicate that evaluates if the given DataNodes data object has the specified dimension, for datasets where dimension is applicable.
DataCollection - Class to facilitate loading/accessing structured data.
EventConfig GetEventConfig() const
Returns the current configuration.
const mitk::TimeGeometry * GetTimeGeometry() const
Return the TimeGeometry of the data as const pointer.
void * GetService(const ServiceReferenceBase &reference)
The LevelWindow class Class to store level/window values.
Image class for storing images.
std::vector< ServiceReferenceU > GetServiceReferences(const std::string &clazz, const std::string &filter=std::string())
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
ImageWriteAccessor class to get locked write-access for a particular image part.
Predicate that evaluates if the given DataNodes data object is of a specific data type...
unsigned int GetDimension() const
Get dimension of the image.
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
Composite predicate that forms a logical AND relation from its child predicates.
Class for nodes of the DataTree.
Composite predicate that forms a logical OR relation from its child predicates.
Class for defining the data type of pixels.
bool SetEventConfig(const std::string &filename, const us::Module *module=nullptr)
Loads a configuration from an XML resource.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.