Medical Imaging Interaction Toolkit  2021.10.00
Medical Imaging Interaction Toolkit
mitkCorrectorAlgorithm.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 
13 #ifndef mitkCorrectorAlgorithmhIncluded
14 #define mitkCorrectorAlgorithmhIncluded
15 
16 #include "mitkContourModel.h"
17 #include "mitkImageToImageFilter.h"
19 #include <mitkLabel.h>
20 
21 #include <itkImage.h>
22 
23 #define multilabelSegmentationType unsigned short
24 namespace mitk
25 {
39  {
40  public:
42  itkFactorylessNewMacro(Self);
43  itkCloneMacro(Self);
44 
46 
50  void SetContour(ContourModel *contour) { this->m_Contour = contour; }
51  itkSetMacro(FillColor, int);
52  itkGetConstMacro(FillColor, int);
53 
54  itkSetMacro(EraseColor, int);
55  itkGetConstMacro(EraseColor, int);
59  // itkGetObjectMacro(DifferenceImage, Image);
60 
61  // used by TobiasHeimannCorrectionAlgorithm
62  typedef struct
63  {
64  int lineStart;
65  int lineEnd;
66  bool modified;
67 
68  std::vector<itk::Index<2>> points;
69  } TSegData;
70 
71  protected:
73  ~CorrectorAlgorithm() override;
74 
75  // does the actual processing
76  void GenerateData() override;
77 
78  bool ImprovedHeimannCorrectionAlgorithm(itk::Image<DefaultSegmentationDataType, 2>::Pointer pic);
79  bool ModifySegment(const TSegData &segment, itk::Image<DefaultSegmentationDataType, 2>::Pointer pic);
80 
84 
87 
88  private:
89  template <typename ScalarType>
90  itk::Index<2> ensureIndexInImage(ScalarType i0, ScalarType i1);
91 
92  void ColorSegment(const mitk::CorrectorAlgorithm::TSegData &segment,
93  itk::Image<mitk::CorrectorAlgorithm::DefaultSegmentationDataType, 2>::Pointer pic);
94  itk::Image<mitk::CorrectorAlgorithm::DefaultSegmentationDataType, 2>::Pointer CloneImage(
95  itk::Image<mitk::CorrectorAlgorithm::DefaultSegmentationDataType, 2>::Pointer pic);
96  itk::Index<2> GetFirstPoint(const mitk::CorrectorAlgorithm::TSegData &segment,
97  itk::Image<mitk::CorrectorAlgorithm::DefaultSegmentationDataType, 2>::Pointer pic);
98  std::vector<itk::Index<2>> FindSeedPoints(
100  itk::Image<mitk::CorrectorAlgorithm::DefaultSegmentationDataType, 2>::Pointer pic);
101  int FillRegion(const std::vector<itk::Index<2>> &seedPoints,
102  itk::Image<mitk::CorrectorAlgorithm::DefaultSegmentationDataType, 2>::Pointer pic);
103  void OverwriteImage(itk::Image<mitk::CorrectorAlgorithm::DefaultSegmentationDataType, 2>::Pointer source,
104  itk::Image<mitk::CorrectorAlgorithm::DefaultSegmentationDataType, 2>::Pointer target);
105  };
106 }
107 
108 #endif
void SetContour(ContourModel *contour)
User drawn contour.
ContourModel is a structure of linked vertices defining a contour in 3D space. The vertices are store...
mitk::Label::PixelType DefaultSegmentationDataType
double ScalarType
Superclass of all classes generating some kind of mitk::BaseData.
#define MITKSEGMENTATION_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
ContourModel::Pointer m_Contour
Calculated difference image.
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
Superclass of all classes having one or more Images as input and generating Images as output...
std::vector< itk::Index< 2 > > points
unsigned short PixelType
Definition: mitkLabel.h:33