30 #include <itkBinaryFillholeImageFilter.h>
31 #include <itkConnectedThresholdImageFilter.h>
51 Superclass::Activated();
56 Superclass::Deactivated();
65 m_LastEventSender = positionEvent->
GetSender();
66 m_LastEventSlice = m_LastEventSender->
GetSlice();
70 if (workingSlice.IsNull())
74 const BaseGeometry *sliceGeometry = workingSlice->GetGeometry();
79 MITK_ERROR <<
"point apparently not inside segmentation slice" << std::endl;
84 typedef InputImageType::IndexType IndexType;
85 typedef itk::ConnectedThresholdImageFilter<InputImageType, InputImageType> RegionGrowingFilterType;
95 regionGrower->SetInput(itkImage);
96 regionGrower->AddSeed(seedIndex);
100 regionGrower->SetLower(bound);
101 regionGrower->SetUpper(bound);
102 regionGrower->SetReplaceValue(1);
107 fillHolesFilter->SetInput(regionGrower->GetOutput());
108 fillHolesFilter->SetForegroundValue(1);
112 resultImage->SetGeometry(workingSlice->GetGeometry());
114 DataNode *workingNode(m_ToolManager->GetWorkingData(0));
118 Image *image =
dynamic_cast<Image *
>(workingNode->GetData());
127 contourextractor->SetInput(resultImage);
128 contourextractor->Update();
150 DataNode *workingNode(m_ToolManager->GetWorkingData(0));
154 Image *image =
dynamic_cast<Image *
>(workingNode->GetData());
156 if (!image || !planeGeometry)
163 MITK_ERROR <<
"Unable to extract slice." << std::endl;
169 slice, feedbackContour,
false,
false);
171 if (projectedContour.IsNull())
182 projectedContour, timeStep, slice, image, m_PaintingPixelValue * activeColor);
184 this->WriteBackSegmentationResult(positionEvent, slice);
ContourModel is a structure of linked vertices defining a contour in 3D space. The vertices are store...
Super class for all position events.
itk::SmartPointer< Self > Pointer
virtual unsigned int GetSlice() const
BaseRenderer * GetSender() const
static void FillContourInSlice(ContourModel *projectedContour, Image *sliceImage, mitk::Image::Pointer workingImage, int paintingPixelValue=1)
Fill a contour in a 2D slice with a specified pixel value at time step 0.
Point3D GetPositionInWorld() const
bool IsIndexInside(const mitk::Point3D &index) const
Test whether the point p ((continous!)index coordinates in units) is inside the bounding box...
virtual const PlaneGeometry * GetCurrentWorldPlaneGeometry()
Get the current 2D-worldgeometry (m_CurrentWorldPlaneGeometry) used for 2D-rendering.
Image::Pointer GrabItkImageMemory(itk::SmartPointer< ItkOutputImageType > &itkimage, mitk::Image *mitkImage=nullptr, const BaseGeometry *geometry=nullptr, bool update=true)
Grabs the memory of an itk::Image (with a specific type) and puts it into an mitk::Image.The memory is managed by the mitk::Image after calling this function. The itk::Image remains valid until the mitk::Image decides to free the memory.
itk::Image< double, 3 > InputImageType
static RenderingManager * GetInstance()
Represents an action, that is executed after a certain event (in statemachine-mechanism) TODO: implem...
Image class for storing images.
mitk::Label * GetActiveLabel(unsigned int layer=0)
Returns the active label of a specific layer.
virtual unsigned int GetTimeStep() const
void RequestUpdate(vtkRenderWindow *renderWindow)
void MITKCORE_EXPORT CastToItkImage(const mitk::Image *mitkImage, itk::SmartPointer< ItkOutputImageType > &itkOutputImage)
Cast an mitk::Image to an itk::Image with a specific type.
LabelSetImage class for handling labels and layers in a segmentation session.
Describes a two-dimensional, rectangular plane.
#define CONNECT_FUNCTION(a, f)
PixelType GetValue() const
vtkRenderWindow * GetRenderWindow() const
Access the RenderWindow into which this renderer renders.
BaseGeometry Describes the geometry of a data object.
Class for nodes of the DataTree.
void WorldToIndex(const mitk::Point3D &pt_mm, mitk::Point3D &pt_units) const
Convert world coordinates (in mm) of a point to (continuous!) index coordinates.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.