Medical Imaging Interaction Toolkit  2024.12.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
itkLabelSampler.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 itLabelSampler_h
14 #define itLabelSampler_h
15 
16 #include "itkImageToImageFilter.h"
17 
18 namespace itk
19 {
20 template< class TImage>
21 class LabelSampler:public ImageToImageFilter< TImage, TImage >
22 {
23 public:
25  typedef LabelSampler Self;
26  typedef ImageToImageFilter< TImage, TImage > Superclass;
28  typedef std::map<int,int> outmap;
29 
31  itkNewMacro(Self);
32  itkTypeMacro(Self, ImageToImageFilter);
33  itkSetMacro(AcceptRate, double);
34  itkSetMacro(Label, int);
35  itkGetMacro(LabelVoxelCountMap, outmap);
36  itkGetMacro(NumberOfSampledVoxels,int);
37 
38  int GetLabelVoxelCount(int label)
39  {
40  if(m_LabelVoxelCountMap.empty())
41  return 0;
42  return m_LabelVoxelCountMap[label];
43  }
44 
45 protected:
47  :m_Label(-1)
48  ,m_AcceptRate(1.0)
49  ,m_UseLabelVoxelCount(false)
50  {
51  this->SetNumberOfRequiredInputs(1);
52  this->SetNumberOfRequiredOutputs(1);
53  }
54 
56 
58  virtual void GenerateData();
59 
60 private:
61  LabelSampler(const Self &); //purposely not implemented
62  void operator=(const Self &); //purposely not implemented
63 
64  int m_Label;
65  int m_NumberOfSampledVoxels;
66  double m_AcceptRate;
67  bool m_UseLabelVoxelCount;
68  std::map<int,int> m_LabelVoxelCountMap;
69 };
70 } //namespace ITK
71 
72 
73 #ifndef ITK_MANUAL_INSTANTIATION
74 #include <../src/Algorithms/itkLabelSampler.cpp>
75 #endif
76 
77 
78 #endif // itLabelSampler_h
itk::LabelSampler::Superclass
ImageToImageFilter< TImage, TImage > Superclass
Definition: itkLabelSampler.h:26
itk::LabelSampler::Self
LabelSampler Self
Definition: itkLabelSampler.h:25
itk::LabelSampler::Pointer
SmartPointer< Self > Pointer
Definition: itkLabelSampler.h:27
itk::SmartPointer< Self >
itk::LabelSampler::GenerateData
virtual void GenerateData()
itk::LabelSampler::~LabelSampler
~LabelSampler()
Definition: itkLabelSampler.h:55
itk::LabelSampler::GetLabelVoxelCount
int GetLabelVoxelCount(int label)
Definition: itkLabelSampler.h:38
itk
SET FUNCTIONS.
Definition: itkIntelligentBinaryClosingFilter.h:30
itk::LabelSampler
Definition: itkLabelSampler.h:21
itk::LabelSampler::LabelSampler
LabelSampler()
Definition: itkLabelSampler.h:46
itk::LabelSampler::outmap
std::map< int, int > outmap
Definition: itkLabelSampler.h:28