41 #include <vtkLookupTable.h>
43 #include <itkExceptionObject.h>
44 #include <itkGradientMagnitudeRecursiveGaussianImageFilter.h>
45 #include <itkWatershedImageFilter.h>
62 Superclass::Activated();
67 Superclass::Deactivated();
96 input = Get3DImage(input, timestep);
106 labelSetOutput->InitializeByLabeledImage(output);
110 dataNode->SetData(labelSetOutput);
113 std::string name = referenceData->GetName() +
"_Watershed";
114 dataNode->SetName(name);
118 m_ToolManager->GetDataStorage()->GetDerivations(referenceData);
119 mitk::DataStorage::SetOfObjects::ConstIterator currentNode = children->Begin();
121 while (currentNode != children->End())
123 if (dataNode->GetName().compare(currentNode->Value()->GetName()) == 0)
125 removeNode = currentNode->Value();
130 if (removeNode.IsNotNull())
131 m_ToolManager->GetDataStorage()->Remove(removeNode);
134 m_ToolManager->GetDataStorage()->Add(dataNode, referenceData);
136 catch (itk::ExceptionObject &e)
138 MITK_ERROR <<
"Watershed Filter Error: " << e.GetDescription();
144 template <
typename TPixel,
unsigned int VImageDimension>
148 typedef itk::WatershedImageFilter<itk::Image<float, VImageDimension>> WatershedFilter;
149 typedef itk::GradientMagnitudeRecursiveGaussianImageFilter<itk::Image<TPixel, VImageDimension>,
150 itk::Image<float, VImageDimension>>
155 magnitude->SetInput(originalImage);
156 magnitude->SetSigma(1.0);
160 command->AddStepsToDo(60);
164 watershed->SetInput(magnitude->GetOutput());
165 watershed->SetThreshold(m_Threshold);
166 watershed->SetLevel(m_Level);
167 watershed->AddObserver(itk::ProgressEvent(), command);
171 typedef itk::CastImageFilter<
typename WatershedFilter::OutputImageType,
172 itk::Image<Tool::DefaultSegmentationDataType, VImageDimension>>
175 cast->SetInput(watershed->GetOutput());
181 command->SetProgress(10);
const SliceNavigationController * GetTimeNavigationController() const
itk::SmartPointer< Self > Pointer
#define MITKSEGMENTATION_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
#define AccessByItk_1(mitkImage, itkImageTypeFunction, arg1)
itk::SmartPointer< const Self > ConstPointer
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 RenderingManager * GetInstance()
Module * GetModule() const
Image class for storing images.
virtual unsigned int GetPos() const
mitk::Stepper * GetTime()
Get the Stepper through the time.
ModuleResource GetResource(const std::string &path) const
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.