Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
itkConnectedAdaptiveThresholdImageFilter.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 #ifndef itkConnectedAdaptiveThresholdImageFilter_h
13 #define itkConnectedAdaptiveThresholdImageFilter_h
14 
15 #include <itkConnectedThresholdImageFilter.h>
16 #include <itkImage.h>
17 
18 namespace itk
19 {
27  template <class TInputImage, class TOutputImage>
29  : public ConnectedThresholdImageFilter<TInputImage, TOutputImage>
30  {
31  public:
34  typedef ConnectedThresholdImageFilter<TInputImage, TOutputImage> Superclass;
37 
39  itkFactorylessNewMacro(Self);
40  itkCloneMacro(Self);
41 
43  itkTypeMacro(ConnectedAdaptiveThresholdImageFilter, ConnectedThresholdImageFilter);
44 
45  typedef TInputImage InputImageType;
46  typedef TOutputImage OutputImageType;
47  typedef typename OutputImageType::Pointer OutputImagePointer;
48  typedef typename InputImageType::IndexType IndexType;
49  typedef typename InputImageType::PixelType PixelType;
50 
54  void SetGrowingDirectionIsUpwards(bool upwards) { m_GrowingDirectionIsUpwards = upwards; }
55 
59  void SetFineDetectionMode(bool fine)
60  {
61  m_FineDetectionMode = fine;
62  m_DiscardLastPreview = false;
63  }
64 
66  int GetSeedpointValue(void) { return m_SeedpointValue; }
67 
69  int GetLeakagePoint(void) { return m_DetectedLeakagePoint; }
70 
81  IndexType CorrectSeedPointPosition(unsigned int sizeOfVolume, int lowerTh, int upperTh);
82 
86  void CropMask(unsigned int croppingSize);
87 
91  unsigned int AdjustIteratorMask();
92 
101  void SetParameterForFineSegmentation(TOutputImage *iteratorMaskForFineSegmentation,
102  unsigned int adjLowerTh,
103  unsigned int adjUpperTh,
104  itk::Index<3> seedPoint,
105  bool discardLeafSegmentation);
106 
108  TOutputImage *GetResultImage();
109 
110  protected:
113 
114  void GenerateData() override;
115 
116  private:
117  OutputImagePointer m_OutoutImageMaskFineSegmentation;
118  bool m_GrowingDirectionIsUpwards;
119  PixelType m_SeedpointValue;
120  PixelType m_DetectedLeakagePoint;
121  PixelType m_InitValue;
122  unsigned int m_AdjLowerTh;
123  unsigned int m_AdjUpperTh;
124  itk::Index<3> m_SeedPointIndex;
125 
126  /* Flag for switching between raw segmentation and fine segmentation (Bronchial tree segmentation) */
127  bool m_FineDetectionMode;
128 
129  bool m_DiscardLastPreview;
130  bool m_SegmentationCancelled;
131  };
132 
133 } // end namespace itk
134 
135 #ifndef ITK_MANUAL_INSTANTIATION
136 #include <itkConnectedAdaptiveThresholdImageFilter.tpp>
137 #endif
138 
139 #endif
ImageFilter for region growing with an adaptive threshold iterator.
void SetGrowingDirectionIsUpwards(bool upwards)
Set the growing direction for adaptive thresholding.
int GetSeedpointValue(void)
Get the pixel value at the seed point.
unsigned int AdjustIteratorMask()
Modify the iterator mask to accumulate previous segmentation results.
void SetFineDetectionMode(bool fine)
Switch between fine and raw leakage detection mode.
int GetLeakagePoint(void)
Get the detected leakage point value.
TOutputImage * GetResultImage()
Get the result image after filter execution.
ConnectedThresholdImageFilter< TInputImage, TOutputImage > Superclass
void SetParameterForFineSegmentation(TOutputImage *iteratorMaskForFineSegmentation, unsigned int adjLowerTh, unsigned int adjUpperTh, itk::Index< 3 > seedPoint, bool discardLeafSegmentation)
Configure parameters for fine segmentation (bronchial tree leaf analysis).
IndexType CorrectSeedPointPosition(unsigned int sizeOfVolume, int lowerTh, int upperTh)
Correct the seed point position if its value is outside the threshold range.
void CropMask(unsigned int croppingSize)
Set all voxels in a cubic region around the seed point to zero.