Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef itLabelSampler_h
18 #define itLabelSampler_h
19 
20 #include "itkImageToImageFilter.h"
21 
22 namespace itk
23 {
24 template< class TImage>
25 class LabelSampler:public ImageToImageFilter< TImage, TImage >
26 {
27 public:
29  typedef LabelSampler Self;
30  typedef ImageToImageFilter< TImage, TImage > Superclass;
32  typedef std::map<int,int> outmap;
33 
35  itkNewMacro(Self)
36 
37 
38  itkTypeMacro(Self, ImageToImageFilter)
39 
40  itkSetMacro(AcceptRate, double)
41  itkSetMacro(Label, int)
42  itkGetMacro(LabelVoxelCountMap, outmap)
43  itkGetMacro(NumberOfSampledVoxels,int)
44 
45  int GetLabelVoxelCount(int label)
46  {
47  if(m_LabelVoxelCountMap.empty())
48  return 0;
49  return m_LabelVoxelCountMap[label];
50  }
51 
52 protected:
54  :m_Label(-1)
55  ,m_AcceptRate(1.0)
56  ,m_UseLabelVoxelCount(false)
57  {
58  this->SetNumberOfRequiredInputs(1);
59  this->SetNumberOfRequiredOutputs(1);
60  }
61 
63 
65  virtual void GenerateData();
66 
67 private:
68  LabelSampler(const Self &); //purposely not implemented
69  void operator=(const Self &); //purposely not implemented
70 
71  int m_Label;
72  int m_NumberOfSampledVoxels;
73  double m_AcceptRate;
74  bool m_UseLabelVoxelCount;
75  std::map<int,int> m_LabelVoxelCountMap;
76 };
77 } //namespace ITK
78 
79 
80 #ifndef ITK_MANUAL_INSTANTIATION
81 #include <../src/Algorithms/itkLabelSampler.cpp>
82 #endif
83 
84 
85 #endif // itLabelSampler_h
SmartPointer< Self > Pointer
ImageToImageFilter< TImage, TImage > Superclass
std::map< int, int > outmap
int GetLabelVoxelCount(int label)
LabelSampler Self
virtual void GenerateData()