iRoCS Toolbox  1.1.0
ProfileSampler.hh
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * Copyright (C) 2015 Margret Keuper, Thorsten Falk
4  *
5  * Image Analysis Lab, University of Freiburg, Germany
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  *
21  **************************************************************************/
22 
23 #ifndef LIBSEGMENTATION_SRC_PROFILESAMPLER_HH
24 #define LIBSEGMENTATION_SRC_PROFILESAMPLER_HH
25 
26 #ifdef HAVE_CONFIG_H
27 #include <config.hh>
28 #endif
29 
30 #include <blitz/array.h>
31 #include <vector>
33 
34 namespace segmentation
35 {
36 
37 // forward declarations
38  template<typename T>
39  class MahalanobisDistance;
40 
41  template<class T, int Dim>
42  class ProfileSampler
43  {
44 
45  public:
46 
51  ProfileSampler(int numSamples, T samplingDistUm);
52 
60  blitz::Array<T,1> sample(
61  blitz::Array<T,Dim> const &data,
62  blitz::TinyVector<double,Dim> const &elSize,
63  blitz::TinyVector<double,Dim> const &centerUm,
64  blitz::TinyVector<double,Dim> const &positionUm) const;
65 
73  void sample(
74  blitz::Array<T,Dim> const &data,
75  blitz::TinyVector<double,Dim> const &elSize,
76  blitz::TinyVector<double,Dim> const &centerUm,
77  std::vector< blitz::TinyVector<double,Dim> > const &candidates,
78  blitz::Array<T, 2> &profiles,
79  iRoCS::ProgressReporter *progress = NULL) const;
80 
91  void sample(
92  blitz::Array<T,Dim> const &data,
93  blitz::TinyVector<double,Dim> const &elSize,
94  blitz::TinyVector<double,Dim> const &centerUm,
95  blitz::Array<T,Dim> const &candidates, T threshold,
96  blitz::Array<T,2> &profiles,
97  std::vector< blitz::TinyVector<double,Dim> > &usedCandidates,
98  blitz::TinyVector<double,Dim> const &lbUm = 0.0,
99  blitz::TinyVector<double,Dim> const &ubUm =
100  (std::numeric_limits<T>::infinity()),
101  iRoCS::ProgressReporter *progress = NULL) const;
102 
103  private:
104 
105  int _numSamples;
106  T _samplingDistUm;
107 
108  };
109 
110 } // segmentation
111 
112 #endif //LIBSEGMENTATION_SRC_PROFILESAMPLER_HH
ProfileSampler(int numSamples, T samplingDistUm)
blitz::Array< T, 1 > sample(blitz::Array< T, Dim > const &data, blitz::TinyVector< double, Dim > const &elSize, blitz::TinyVector< double, Dim > const &centerUm, blitz::TinyVector< double, Dim > const &positionUm) const