Medical Imaging Interaction Toolkit  2023.12.99-29da53b2
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 mitkCorrectorAlgorithm_h
14 #define mitkCorrectorAlgorithm_h
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
mitkLabel.h
mitkImageToImageFilter.h
mitk::CorrectorAlgorithm::m_FillColor
int m_FillColor
Definition: mitkCorrectorAlgorithm.h:85
mitk::CorrectorAlgorithm::TSegData::lineStart
int lineStart
Definition: mitkCorrectorAlgorithm.h:64
itk::SmartPointer< Self >
mitk::Label::PixelType
unsigned short PixelType
Definition: mitkLabel.h:34
mitk::CorrectorAlgorithm::DefaultSegmentationDataType
mitk::Label::PixelType DefaultSegmentationDataType
Definition: mitkCorrectorAlgorithm.h:43
mitk::CorrectorAlgorithm::m_WorkingImage
Image::Pointer m_WorkingImage
Definition: mitkCorrectorAlgorithm.h:81
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitkContourModel.h
mitk::CorrectorAlgorithm::TSegData::modified
bool modified
Definition: mitkCorrectorAlgorithm.h:66
mitk::CorrectorAlgorithm::TSegData
Calculated difference image.
Definition: mitkCorrectorAlgorithm.h:62
mitk::BaseDataSource
Superclass of all classes generating some kind of mitk::BaseData.
Definition: mitkBaseDataSource.h:71
mitk::CorrectorAlgorithm::TSegData::lineEnd
int lineEnd
Definition: mitkCorrectorAlgorithm.h:65
mitk::CorrectorAlgorithm::m_Contour
ContourModel::Pointer m_Contour
Definition: mitkCorrectorAlgorithm.h:82
mitk::ContourModel
ContourModel is a structure of linked vertices defining a contour in 3D space. The vertices are store...
Definition: mitkContourModel.h:47
mitk::CorrectorAlgorithm::m_DifferenceImage
Image::Pointer m_DifferenceImage
Definition: mitkCorrectorAlgorithm.h:83
MITKSEGMENTATION_EXPORT
#define MITKSEGMENTATION_EXPORT
Definition: MitkSegmentationExports.h:15
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitk::CorrectorAlgorithm::SetContour
void SetContour(ContourModel *contour)
User drawn contour.
Definition: mitkCorrectorAlgorithm.h:50
mitk::CorrectorAlgorithm::TSegData::points
std::vector< itk::Index< 2 > > points
Definition: mitkCorrectorAlgorithm.h:68
MitkSegmentationExports.h
mitk::CorrectorAlgorithm
Definition: mitkCorrectorAlgorithm.h:38
mitk::CorrectorAlgorithm::m_EraseColor
int m_EraseColor
Definition: mitkCorrectorAlgorithm.h:86
mitk::BaseData::Pointer
itk::SmartPointer< Self > Pointer
Definition: mitkBaseData.h:46
mitk::ImageToImageFilter
Superclass of all classes having one or more Images as input and generating Images as output.
Definition: mitkImageToImageFilter.h:25
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20