Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 {
26  template <class TInputImage, class TOutputImage>
28  : public ConnectedThresholdImageFilter<TInputImage, TOutputImage>
29  {
30  public:
33  typedef ConnectedThresholdImageFilter<TInputImage, TOutputImage> Superclass;
36 
38  itkFactorylessNewMacro(Self);
39  itkCloneMacro(Self);
40 
42  itkTypeMacro(ConnectedAdaptiveThresholdImageFilter, ConnectedThresholdImageFilter);
43 
44  typedef TInputImage InputImageType;
45  typedef TOutputImage OutputImageType;
46  typedef typename OutputImageType::Pointer OutputImagePointer;
47  typedef typename InputImageType::IndexType IndexType;
48  typedef typename InputImageType::PixelType PixelType;
49 
50  void SetGrowingDirectionIsUpwards(bool upwards) { m_GrowingDirectionIsUpwards = upwards; }
51  /* Switch between fine and raw leakage detection. */
52  void SetFineDetectionMode(bool fine)
53  {
54  m_FineDetectionMode = fine;
55  m_DiscardLastPreview = false;
56  }
57 
58  int GetSeedpointValue(void) { return m_SeedpointValue; }
59  int GetLeakagePoint(void) { return m_DetectedLeakagePoint; }
60 
61  /*
62  * Correct the position of the seed point, only performed if seed point value is outside threshold range
63  * @param sizeOfVolume edge length of the square volume in which the search for a "better" seed is performed
64  */
65  IndexType CorrectSeedPointPosition(unsigned int sizeOfVolume, int lowerTh, int upperTh);
66 
67  /* Sets all voxels in a square volume with the size of @param croppingSize
68  * and the center point equal to @param seedPoint to the value zero.
69  */
70  void CropMask(unsigned int croppingSize);
71 
72  /* Modifies the iterator mask to keep all previous segmentation results in the same mask.
73  * @returnParam largest value in the segmentation mask
74  */
75  unsigned int AdjustIteratorMask();
76 
77  /* Sets parameters needed for adjusting the iterator mask
78  * @param iteratorMaskForFineSegmentation pointer to the image containing the complete segmentation result of one
79  * leaf (inclusively leakage-segmentation)
80  * @param adjLowerTh lower threshold value of the segmentation without leakage-segmentation
81  * @param adjLowerTh upper threshold value of the segmentation without leakage-segmentation
82  * @param discardLeafSegmentation flag if the last segmentation preview ended with a leakage already in the first
83  * step
84  */
85  void SetParameterForFineSegmentation(TOutputImage *iteratorMaskForFineSegmentation,
86  unsigned int adjLowerTh,
87  unsigned int adjUpperTh,
88  itk::Index<3> seedPoint,
89  bool discardLeafSegmentation);
90 
91  TOutputImage *GetResultImage();
92 
93  protected:
96 
97  void GenerateData() override;
98 
99  private:
100  OutputImagePointer m_OutoutImageMaskFineSegmentation;
101  bool m_GrowingDirectionIsUpwards;
102  PixelType m_SeedpointValue;
103  PixelType m_DetectedLeakagePoint;
104  PixelType m_InitValue;
105  unsigned int m_AdjLowerTh;
106  unsigned int m_AdjUpperTh;
107  itk::Index<3> m_SeedPointIndex;
108 
109  /* Flag for switching between raw segmentation and fine segmentation (Bronchial tree segmentation) */
110  bool m_FineDetectionMode;
111 
112  bool m_DiscardLastPreview;
113  bool m_SegmentationCancelled;
114  };
115 
116 } // end namespace itk
117 
118 #ifndef ITK_MANUAL_INSTANTIATION
119 #include "itkConnectedAdaptiveThresholdImageFilter.txx"
120 #endif
121 
122 #endif
itk::ConnectedAdaptiveThresholdImageFilter::SetFineDetectionMode
void SetFineDetectionMode(bool fine)
Definition: itkConnectedAdaptiveThresholdImageFilter.h:52
itk::ConnectedAdaptiveThresholdImageFilter::SetGrowingDirectionIsUpwards
void SetGrowingDirectionIsUpwards(bool upwards)
Definition: itkConnectedAdaptiveThresholdImageFilter.h:50
itk::ConnectedAdaptiveThresholdImageFilter
ImageFilter used for processing an image with an adaptive iterator (such as itkAdaptiveThresholdItera...
Definition: itkConnectedAdaptiveThresholdImageFilter.h:27
itk::ConnectedAdaptiveThresholdImageFilter::InputImageType
TInputImage InputImageType
Definition: itkConnectedAdaptiveThresholdImageFilter.h:42
itk::SmartPointer< Self >
itk::ConnectedAdaptiveThresholdImageFilter::Pointer
SmartPointer< Self > Pointer
Definition: itkConnectedAdaptiveThresholdImageFilter.h:34
itk::ConnectedAdaptiveThresholdImageFilter::ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkConnectedAdaptiveThresholdImageFilter.h:35
itk::ConnectedAdaptiveThresholdImageFilter::~ConnectedAdaptiveThresholdImageFilter
~ConnectedAdaptiveThresholdImageFilter() override
Definition: itkConnectedAdaptiveThresholdImageFilter.h:95
itk::ConnectedAdaptiveThresholdImageFilter::PixelType
InputImageType::PixelType PixelType
Definition: itkConnectedAdaptiveThresholdImageFilter.h:48
itk::ConnectedAdaptiveThresholdImageFilter::OutputImageType
TOutputImage OutputImageType
Definition: itkConnectedAdaptiveThresholdImageFilter.h:45
itk::ConnectedAdaptiveThresholdImageFilter::GetSeedpointValue
int GetSeedpointValue(void)
Definition: itkConnectedAdaptiveThresholdImageFilter.h:58
itk::ConnectedAdaptiveThresholdImageFilter::Self
ConnectedAdaptiveThresholdImageFilter Self
Definition: itkConnectedAdaptiveThresholdImageFilter.h:32
itk
SET FUNCTIONS.
Definition: itkIntelligentBinaryClosingFilter.h:30
itk::ConnectedAdaptiveThresholdImageFilter::Superclass
ConnectedThresholdImageFilter< TInputImage, TOutputImage > Superclass
Definition: itkConnectedAdaptiveThresholdImageFilter.h:33
itk::Index< 3 >
itk::ConnectedAdaptiveThresholdImageFilter::IndexType
InputImageType::IndexType IndexType
Definition: itkConnectedAdaptiveThresholdImageFilter.h:47
itk::ConnectedAdaptiveThresholdImageFilter::GetLeakagePoint
int GetLeakagePoint(void)
Definition: itkConnectedAdaptiveThresholdImageFilter.h:59
itk::ConnectedAdaptiveThresholdImageFilter::OutputImagePointer
OutputImageType::Pointer OutputImagePointer
Definition: itkConnectedAdaptiveThresholdImageFilter.h:46