21 #include "itkBinaryBallStructuringElement.h"
22 #include "itkBinaryDilateImageFilter.h"
23 #include "itkFlatStructuringElement.h"
24 #include "itkGrayscaleMorphologicalOpeningImageFilter.h"
30 for (
size_t patient = 0; patient < dataCollection->
Size(); ++patient)
33 if (dataPatient == NULL)
34 MITK_ERROR <<
"PerformGrayOpening - Structure of DataCollection is invalid at patient level. Data inconsistent!";
36 if (dataPatient->
Size() == 0)
37 MITK_ERROR <<
"Empty Patient Collective. Probably Fatal.";
39 for (
size_t timeStep = 0; timeStep < dataPatient->
Size(); ++timeStep)
42 if (dataTimeStep == NULL)
44 <<
"DilateBinaryByName- Structure of DataCollection is invalid at time step level. Data inconsistent!";
52 if (itkImage.IsNull())
53 MITK_ERROR <<
"Image " << name <<
" does not exist. Fatal.";
55 typedef itk::FlatStructuringElement<3> StructuringElementType;
56 StructuringElementType::RadiusType elementRadius;
57 elementRadius.Fill(1);
59 StructuringElementType structuringElement = StructuringElementType::Box(elementRadius);
61 typedef itk::GrayscaleMorphologicalOpeningImageFilter<ImageType, ImageType, StructuringElementType>
62 DilateImageFilterType;
65 dilateFilter0->SetInput(itkImage);
66 dilateFilter0->SetKernel(structuringElement);
67 dilateFilter0->Update();
70 dilateFilter1->SetInput(dilateFilter0->GetOutput());
71 dilateFilter1->SetKernel(structuringElement);
72 dilateFilter1->Update();
75 dataTimeStep->
AddData(dil.GetPointer(), name + suffix,
"");
itk::SmartPointer< Self > Pointer
vcl_size_t Size() const
Size - number of data items in collection.
vcl_size_t AddData(DataObject::Pointer data, std::string name, std::string filePath="")
AddData Add a data item.
mitk::Image::Pointer GetMitkImage(vcl_size_t index)
GetMitkImage - casts data to mitk::Image and returns it.
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.
static void PerformGrayOpening(mitk::DataCollection *dataCollection, std::string name, std::string suffix)
PerformGrayOpening - Opening operation on a specific modality type wihtin the DataCollection. Creates a new item.
void MITKCORE_EXPORT CastToItkImage(const mitk::Image *mitkImage, itk::SmartPointer< ItkOutputImageType > &itkOutputImage)
Cast an mitk::Image to an itk::Image with a specific type.
itk::DataObject::Pointer GetData(vcl_size_t index)
GetData Get original data by index.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.