18 #ifndef itkWatershedSegmenter_h
19 #define itkWatershedSegmenter_h
87 template<
typename TInputImage >
97 static constexpr
unsigned int ImageDimension = TInputImage::ImageDimension;
129 static constexpr
short NULL_FLOW = -1;
134 return itkDynamicCastInDebugMode< InputImageType * >
145 return itkDynamicCastInDebugMode< OutputImageType * >
156 return itkDynamicCastInDebugMode< SegmentTableType * >
167 return itkDynamicCastInDebugMode< BoundaryType * >
175 void GenerateData()
override;
185 if ( reg == m_LargestPossibleRegion ) {
return; }
186 m_LargestPossibleRegion = reg;
192 {
return m_LargestPossibleRegion; }
196 static void RelabelImage(OutputImageTypePointer,
202 using Superclass::MakeOutput;
221 itkSetClampMacro(Threshold,
double, 0.0, 1.0);
222 itkGetConstMacro(Threshold,
double);
228 itkSetMacro(DoBoundaryAnalysis,
bool);
229 itkGetConstMacro(DoBoundaryAnalysis,
bool);
236 itkGetConstMacro(SortEdgeLists,
bool);
237 itkSetMacro(SortEdgeLists,
bool);
248 bool is_on_boundary{
false};
253 using flat_region_table_t = itksys::hash_map< IdentifierType, flat_region_t, itksys::hash< IdentifierType > >;
265 using edge_table_t = itksys::hash_map< IdentifierType, InputPixelType, itksys::hash< IdentifierType > >;
267 using edge_table_hash_t = itksys::hash_map< IdentifierType, edge_table_t, itksys::hash< IdentifierType > >;
272 void PrintSelf(std::ostream & os,
Indent indent)
const override;
278 virtual void GenerateConnectivity();
283 void GenerateInputRequestedRegion()
override;
285 void GenerateOutputRequestedRegion(
DataObject *output)
override;
287 void UpdateOutputInformation()
override;
291 void InitializeBoundary();
296 void AnalyzeBoundaryFlow(InputImageTypePointer,
297 flat_region_table_t &,
303 void BuildRetainingWall(InputImageTypePointer,
304 ImageRegionType, InputPixelType);
308 void LabelMinima(InputImageTypePointer,
309 ImageRegionType, flat_region_table_t &,
315 void GradientDescent(InputImageTypePointer, ImageRegionType);
319 void DescendFlatRegions(flat_region_table_t &, ImageRegionType);
323 void UpdateSegmentTable(InputImageTypePointer, ImageRegionType);
328 void CollectBoundaryInformation(flat_region_table_t &);
335 static void Threshold(InputImageTypePointer destination,
336 InputImageTypePointer source,
337 const ImageRegionType source_region,
338 const ImageRegionType destination_region,
339 InputPixelType threshold);
342 static void MinMax(InputImageTypePointer img,
343 ImageRegionType region,
344 InputPixelType & min,
345 InputPixelType & max);
351 static void SetInputImageValues(InputImageTypePointer img,
352 const ImageRegionType region,
353 InputPixelType value);
355 static void SetOutputImageValues(OutputImageTypePointer img,
356 const ImageRegionType region,
384 #ifndef ITK_MANUAL_INSTANTIATION
385 #include "itkWatershedSegmenter.hxx"
IdentifierType * min_label_ptr
InputImageType::OffsetType * direction
SegmentTableType * GetSegmentTable()
typename flat_hash_t::value_type FlatHashValueType
OutputImageType * GetOutputImage()
Light weight base class for most itk classes.
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
bool m_DoBoundaryAnalysis
ImageRegionType GetLargestPossibleRegion() const
InputPixelType bounds_min
itksys::hash_map< IdentifierType, InputPixelType, itksys::hash< IdentifierType > > edge_table_t
InputImageType InputImageType
typename InputImageType::RegionType ImageRegionType
typename OutputImageType::Pointer OutputImageTypePointer
typename SegmentTableType::Pointer SegmentTableTypePointer
itksys::hash_map< IdentifierType, edge_table_t, itksys::hash< IdentifierType > > edge_table_hash_t
itksys::hash_map< IdentifierType, flat_region_t, itksys::hash< IdentifierType > > flat_region_table_t
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
void operator=(const Self &)
void SetOutputImage(OutputImageType *img)
class ITK_FORWARD_EXPORT ProcessObject
typename BoundaryType::FlatHashValueType BoundaryFlatHashValueType
void SetLargestPossibleRegion(ImageRegionType reg)
SizeValueType IdentifierType
InputImageType * GetInputImage()
ImageBaseType::IndexType IndexType
BoundaryType * GetBoundary()
ImageRegionType m_LargestPossibleRegion
typename InputImageType::PixelType InputPixelType
connectivity_t m_Connectivity
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
typename BoundaryType::Pointer BoundaryTypePointer
void SetSegmentTable(SegmentTableType *s)
Control indentation during Print() invocation.
virtual void SetNthInput(DataObjectPointerArraySizeType num, DataObject *input)
typename InputImageType::Pointer InputImageTypePointer
IdentifierType m_CurrentLabel
typename BoundaryType::IndexType BoundaryIndexType
virtual void SetNthOutput(DataObjectPointerArraySizeType num, DataObject *output)
ImageBaseType::RegionType RegionType
SmartPointer< Self > Pointer
void SetBoundary(BoundaryType *b)
double m_MaximumFloodLevel
Base class for all data objects in ITK.
Templated n-dimensional image class.
void SetInputImage(InputImageType *img)
DataObject * GetOutput(const DataObjectIdentifierType &key)