Medical Imaging Interaction Toolkit  2018.4.99-389bf124
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 "ipSegmentation.h"
17 #include "mitkContourModel.h"
18 #include "mitkImageToImageFilter.h"
20 #include <mitkLabel.h>
21 
22 #include <itkImage.h>
23 
24 #define multilabelSegmentationType unsigned short
25 namespace mitk
26 {
40  {
41  public:
43  itkFactorylessNewMacro(Self);
44  itkCloneMacro(Self);
45 
47 
51  void SetContour(ContourModel *contour) { this->m_Contour = contour; }
52  itkSetMacro(FillColor, int);
53  itkGetConstMacro(FillColor, int);
54 
55  itkSetMacro(EraseColor, int);
56  itkGetConstMacro(EraseColor, int);
60  // itkGetObjectMacro(DifferenceImage, Image);
61 
62  // used by TobiasHeimannCorrectionAlgorithm
63  typedef struct
64  {
65  int lineStart;
66  int lineEnd;
67  bool modified;
68 
69  std::vector<itk::Index<2>> points;
70  } TSegData;
71 
72  protected:
74  ~CorrectorAlgorithm() override;
75 
76  // does the actual processing
77  void GenerateData() override;
78 
79  bool ImprovedHeimannCorrectionAlgorithm(itk::Image<DefaultSegmentationDataType, 2>::Pointer pic);
80  bool ModifySegment(const TSegData &segment, itk::Image<DefaultSegmentationDataType, 2>::Pointer pic);
81 
85 
88 
89  private:
90  template <typename ScalarType>
91  itk::Index<2> ensureIndexInImage(ScalarType i0, ScalarType i1);
92 
93  void ColorSegment(const mitk::CorrectorAlgorithm::TSegData &segment,
94  itk::Image<mitk::CorrectorAlgorithm::DefaultSegmentationDataType, 2>::Pointer pic);
95  itk::Image<mitk::CorrectorAlgorithm::DefaultSegmentationDataType, 2>::Pointer CloneImage(
96  itk::Image<mitk::CorrectorAlgorithm::DefaultSegmentationDataType, 2>::Pointer pic);
97  itk::Index<2> GetFirstPoint(const mitk::CorrectorAlgorithm::TSegData &segment,
98  itk::Image<mitk::CorrectorAlgorithm::DefaultSegmentationDataType, 2>::Pointer pic);
99  std::vector<itk::Index<2>> FindSeedPoints(
100  const mitk::CorrectorAlgorithm::TSegData &segment,
101  itk::Image<mitk::CorrectorAlgorithm::DefaultSegmentationDataType, 2>::Pointer pic);
102  int FillRegion(const std::vector<itk::Index<2>> &seedPoints,
103  itk::Image<mitk::CorrectorAlgorithm::DefaultSegmentationDataType, 2>::Pointer pic);
104  void OverwriteImage(itk::Image<mitk::CorrectorAlgorithm::DefaultSegmentationDataType, 2>::Pointer source,
105  itk::Image<mitk::CorrectorAlgorithm::DefaultSegmentationDataType, 2>::Pointer target);
106  };
107 }
108 
109 #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:40
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:36