21 #include "itkBinaryBallStructuringElement.h"
22 #include "itkBinaryDilateImageFilter.h"
23 #include "itkBinaryErodeImageFilter.h"
24 #include "itkFlatStructuringElement.h"
25 #include "itkGrayscaleDilateImageFilter.h"
28 mitk::DataCollection *dataCollection, std::string name,
unsigned int xy,
unsigned int z, std::string suffix)
30 for (
size_t patient = 0; patient < dataCollection->
Size(); ++patient)
33 if (dataPatient == NULL)
34 MITK_ERROR <<
"DilateBinaryByName - 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!";
48 if (tumorSeed == NULL)
49 MITK_ERROR <<
"Image " << name <<
" does not exits. Fatal.";
53 typedef itk::FlatStructuringElement<3> StructuringElementType;
54 StructuringElementType::RadiusType elementRadius;
55 elementRadius.Fill(xy);
58 StructuringElementType structuringElement = StructuringElementType::Box(elementRadius);
59 typedef itk::BinaryDilateImageFilter<BinaryImage, BinaryImage, StructuringElementType>
60 BinaryDilateImageFilterType;
63 dilateFilter0->SetInput(itkTumorSeed);
64 dilateFilter0->SetKernel(structuringElement);
65 dilateFilter0->SetForegroundValue(1);
66 dilateFilter0->Update();
71 dataTimeStep->
AddData(dil.GetPointer(), name + suffix,
"Dilated Binary");
77 mitk::DataCollection *dataCollection, std::string name,
unsigned int xy,
unsigned int z, std::string suffix)
79 for (
size_t patient = 0; patient < dataCollection->
Size(); ++patient)
82 if (dataPatient == NULL)
83 MITK_ERROR <<
"DilateBinaryByName - Structure of DataCollection is invalid at patient level. Data inconsistent!";
85 if (dataPatient->
Size() == 0)
86 MITK_ERROR <<
"Empty Patient Collective. Probably Fatal.";
88 for (
size_t timeStep = 0; timeStep < dataPatient->
Size(); ++timeStep)
91 if (dataTimeStep == NULL)
93 <<
"DilateBinaryByName- Structure of DataCollection is invalid at time step level. Data inconsistent!";
97 if (tumorSeed == NULL)
98 MITK_ERROR <<
"Image " << name <<
" does not exits. Fatal.";
102 typedef itk::FlatStructuringElement<3> StructuringElementType;
103 StructuringElementType::RadiusType elementRadius;
104 elementRadius.Fill(xy);
105 elementRadius[2] = z;
107 StructuringElementType structuringElement = StructuringElementType::Box(elementRadius);
109 typedef itk::BinaryErodeImageFilter<BinaryImage, BinaryImage, StructuringElementType> BinaryErodeImageFilterType;
112 dilateFilter0->SetInput(itkTumorSeed);
113 dilateFilter0->SetKernel(structuringElement);
114 dilateFilter0->SetForegroundValue(1);
115 dilateFilter0->Update();
120 dataTimeStep->
AddData(dil.GetPointer(), name + suffix,
"Dilated Binary");
static void ErodeBinaryByName(DataCollection *dataCollection, std::string name, unsigned int xy=5, unsigned int z=0, std::string suffix="ERODE")
ErodeBinaryByName - Erode all occurances of a modality within a mitk::DataCollection.
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.
Image class for storing images.
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.
mitk::BaseGeometry * GetGeometry(int t=0) const
Return the geometry, which is a TimeGeometry, of the data as non-const pointer.
static void DilateBinaryByName(DataCollection *dataCollection, std::string name, unsigned int xy=5, unsigned int z=0, std::string suffix="DILATE")
DilateBinaryByName - Dilate all occurances of a modality within a mitk::DataCollection.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.