23 #include <mitkImageStatisticsCalculator.h>
30 #include <itkBinaryBallStructuringElement.h>
31 #include <itkBinaryContourImageFilter.h>
32 #include <itkBinaryThresholdImageFilter.h>
33 #include <itkDilateObjectMorphologyImageFilter.h>
34 #include <itkErodeObjectMorphologyImageFilter.h>
39 this->SetNumberOfRequiredInputs(1);
41 this->SetNumberOfIndexedOutputs(1);
52 if (m_SegmentationMask.IsNull())
54 MITK_WARN <<
"Please set a segmentation mask first" << std::endl;
62 statCalc->SetInputImage(image);
65 imgMask->SetImageMask(m_SegmentationMask);
68 double mean = stats->GetMean();
69 double stdDev = stats->GetStd();
71 double upperThreshold = mean + stdDev;
72 double lowerThreshold = mean - stdDev;
97 i2UFilter->SetInput(edgeImage);
98 i2UFilter->SetThreshold(1.0);
101 m_PointGrid = this->GetOutput();
102 if (m_PointGrid.IsNull())
105 m_PointGrid->SetVtkUnstructuredGrid(i2UFilter->GetOutput()->GetVtkUnstructuredGrid());
110 template <
typename TPixel,
unsigned int VImageDimension>
114 typedef itk::BinaryBallStructuringElement<TPixel, VImageDimension> myKernelType;
118 ball.CreateStructuringElement();
120 typedef typename itk::Image<TPixel, VImageDimension>
ImageType;
124 dilationFilter->SetInput(originalImage);
125 dilationFilter->SetKernel(ball);
126 dilationFilter->Update();
132 erodeFilter->SetInput(dilatedImage);
133 erodeFilter->SetKernel(ball);
134 erodeFilter->Update();
139 template <
typename TPixel,
unsigned int VImageDimension>
143 typedef itk::Image<TPixel, VImageDimension>
ImageType;
144 typedef itk::BinaryContourImageFilter<ImageType, ImageType> binaryContourImageFilterType;
145 typedef unsigned short OutputPixelType;
146 typedef itk::Image<OutputPixelType, VImageDimension> OutputImageType;
149 binaryContourFilter->SetInput(originalImage);
150 binaryContourFilter->SetForegroundValue(1);
151 binaryContourFilter->SetBackgroundValue(0);
152 binaryContourFilter->Update();
155 itkImage->Graft(binaryContourFilter->GetOutput());
160 template <
typename TPixel,
unsigned int VImageDimension>
166 typedef itk::Image<TPixel, VImageDimension>
ImageType;
167 typedef itk::Image<unsigned short, VImageDimension> SegmentationType;
168 typedef itk::BinaryThresholdImageFilter<ImageType, SegmentationType> ThresholdFilterType;
170 if (
typeid(TPixel) !=
typeid(
float) &&
typeid(TPixel) !=
typeid(
double))
173 lower = std::floor(lower + 0.5);
174 upper = std::floor(upper - 0.5);
182 filter->SetInput(originalImage);
183 filter->SetLowerThreshold(lower);
184 filter->SetUpperThreshold(upper);
185 filter->SetInsideValue(1);
186 filter->SetOutsideValue(0);
194 this->m_SegmentationMask = segmentation;
199 Superclass::GenerateOutputInformation();
void Progress(unsigned int steps=1)
Sets the current amount of progress to current progress + steps.
#define AccessByItk_3(mitkImage, itkImageTypeFunction, arg1, arg2, arg3)
itk::SmartPointer< Self > Pointer
void ContourSearch(itk::Image< TPixel, VImageDimension > *originalImage, mitk::Image::Pointer &result)
void ITKThresholding(itk::Image< TPixel, VImageDimension > *originalImage, double lower, double upper, mitk::Image::Pointer &result)
itk::SmartPointer< Self > Pointer
void ThreadedClosing(itk::Image< TPixel, VImageDimension > *originalImage, mitk::Image::Pointer &result)
#define AccessByItk_1(mitkImage, itkImageTypeFunction, arg1)
static ProgressBar * GetInstance()
static method to get the GUI dependent ProgressBar-instance so the methods for steps to do and progre...
const mitk::Image * GetInput(void) const
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.
map::core::discrete::Elements< 3 >::InternalImageType ImageType
virtual void GenerateData()
virtual void GenerateOutputInformation()
virtual ~FeatureBasedEdgeDetectionFilter()
FeatureBasedEdgeDetectionFilter()
static void FillHoles(mitk::Image::Pointer &image)
Perform morphological operation on 2D, 3D or 3D+t segmentation.
void SetSegmentationMask(mitk::Image::Pointer)
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.