23 #include "mitkCorrectorTool2D.xpm" 56 return mitkCorrectorTool2D_xpm;
80 Superclass::Activated();
85 Superclass::Deactivated();
97 int timestep = positionEvent->GetSender()->GetTimeStep();
100 contour->
Expand(timestep + 1);
119 assert(positionEvent->GetSender()->GetRenderWindow());
134 assert(positionEvent->GetSender()->GetRenderWindow());
141 auto *
image =
dynamic_cast<Image *
>(workingNode->GetData());
142 const PlaneGeometry *planeGeometry((positionEvent->GetSender()->GetCurrentWorldPlaneGeometry()));
143 if (!
image || !planeGeometry)
146 const auto *abstractTransformGeometry(
147 dynamic_cast<const AbstractTransformGeometry *>(positionEvent->GetSender()->GetCurrentWorldPlaneGeometry()));
148 if (!
image || abstractTransformGeometry)
156 MITK_ERROR <<
"Unable to extract slice." << std::endl;
160 int timestep = positionEvent->GetSender()->GetTimeStep();
168 singleTimestepContour->AddVertex((*it)->Coordinates);
174 algorithm->SetContour(singleTimestepContour);
177 int workingColorId(1);
178 if (labelSetImage.IsNotNull())
180 workingColorId = labelSetImage->GetActiveLabel()->GetValue();
181 algorithm->SetFillColor(workingColorId);
185 algorithm->UpdateLargestPossibleRegion();
187 catch (std::exception &e)
189 MITK_ERROR <<
"Caught exception '" << e.what() <<
"'" << std::endl;
193 resultSlice->Initialize(algorithm->GetOutput());
195 if (labelSetImage.IsNotNull())
204 resultSlice->SetVolume(imAccess.GetData());
ContourModel is a structure of linked vertices defining a contour in 3D space. The vertices are store...
Super class for all position events.
virtual void SetClosed(bool isClosed, int timestep=0)
Set closed property to given boolean.
virtual unsigned int GetSlice() const
void Initialize() override
Initialize all data objects.
#define MITKSEGMENTATION_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
VertexIterator Begin(int timestep=0) const
Returns a const VertexIterator at the start element of the contour.
BaseRenderer * GetSender() const
void AddVertex(mitk::Point3D &vertex, int timestep=0)
Add a vertex to the contour at given timestep. The vertex is added at the end of contour.
MITK_TOOL_MACRO(MITKSEGMENTATION_EXPORT, LiveWireTool2D, "LiveWire tool")
static RenderingManager * GetInstance()
Represents an action, that is executed after a certain event (in statemachine-mechanism) TODO: implem...
virtual unsigned int GetTimeStep() const
void Expand(unsigned int timeSteps) override
Expand the timebounds of the TimeGeometry to given number of timesteps.
Module * GetModule() const
Image class for storing images.
ModuleResource GetResource(const std::string &path) const
mitk::Image::Pointer image
void RequestUpdate(vtkRenderWindow *renderWindow)
VertexIterator End(int timestep=0) const
Returns a const VertexIterator at the end element of the contour.
LabelSetImage class for handling labels and layers in a segmentation session.
Describes a two-dimensional, rectangular plane.
#define CONNECT_FUNCTION(a, f)
ImageReadAccessor class to get locked read access for a particular image part.
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
Class for nodes of the DataTree.