iRoCS Toolbox  1.1.0
geodesic.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 SEGMENTATION_GEODESIC_HH
24 #define SEGMENTATION_GEODESIC_HH
25 
26 #ifdef HAVE_CONFIG_H
27 #include <config.hh>
28 #endif
29 
30 #define USE_S2KIT
31 #include <cerrno>
32 #include <cmath>
33 #include <cstdio>
34 #include <cstdlib>
35 #include <cstring>
36 #include <ctime>
37 #include <vector>
38 #include <string>
39 #include <iostream>
40 #include <fstream>
41 
42 #include <blitz/array.h>
43 
44 #include <fftw3.h>
45 
47 
49 
50 extern "C"
51 {
52 #include <lmbs2kit/makeweights.h>
53 #include <lmbs2kit/cospmls.h>
54 #include <lmbs2kit/FST_semi_memo.h>
55 #include <lmbs2kit/csecond.h>
56 #include <lmbs2kit/primitive.h>
57 #include <lmbs2kit/naive_synthesis.h>
58 #include <lmbs2kit/seminaive.h>
59 #include <lmbs2kit/pmls.h>
60 }
61 
62 #include "SH_forward.hh"
63 #include "SH_backward.hh"
64 #include "SH_tools.hh"
65 
66 namespace segmentation
67 {
68 
69 /*======================================================================*/
79 /*======================================================================*/
80  template<typename DataT, int Dim>
81  void radialProjection(
82  blitz::Array<blitz::TinyVector<DataT,Dim>,Dim> const &field,
83  blitz::TinyVector<double,Dim> const &elementSizeUm,
84  blitz::TinyVector<double,Dim> const &centerUm,
85  blitz::Array<DataT,Dim> &result);
86 
87 /*======================================================================*/
117 /*======================================================================*/
118  template<typename DataT>
119  void geodesicSH(
120  blitz::Array<blitz::TinyVector<DataT,3>,3> const &edgeForce,
121  blitz::TinyVector<double,3> const &elementSizeUm,
122  FrequencyArray &coeffs, blitz::TinyVector<double,3> const &positionUm,
123  double radiusUm, int bw, double roundness, int nIter, double tau = 0.1,
124  iRoCS::ProgressReporter *progress = NULL);
125 
126 /*======================================================================*/
139 /*======================================================================*/
140  void generateMask(
141  FrequencyArray const &coeffs, blitz::Array<bool,3> &mask,
142  blitz::TinyVector<double,3> const &elementSizeUm,
143  blitz::TinyVector<double,3> const &centerUm);
144 
155  void geodesic_sh(
156  blitz::Array<blitz::TinyVector< float, 3>, 3> const &gvf,
157  blitz::TinyVector<float, 3> const &elementSizeUm,
158  FrequencyArray &coeffs,
159  blitz::TinyVector<float, 3> positionUm, float radiusUm,
160  int bw, double roundness, int num_iter,
161  iRoCS::ProgressReporter *progress = NULL);
162 
174  void geodesic_sh(
175  blitz::Array<blitz::TinyVector< float, 3>, 3> const &gvf,
176  blitz::TinyVector<float, 3> const &el_size_um,
177  blitz::TinyVector<float, 3> best_center,
178  float best_radius, int bandwidth, double roundness,
179  int num_iter, blitz::Array<bool, 3> &mask,
180  blitz::Array<blitz::TinyVector< float, 3 >, 3> &normals,
181  iRoCS::ProgressReporter *progress = NULL);
182 
183 } //namespace
184 
185 #include "geodesic.icc"
186 
187 #endif // guard
void radialProjection(blitz::Array< blitz::TinyVector< DataT, Dim >, Dim > const &field, blitz::TinyVector< double, Dim > const &elementSizeUm, blitz::TinyVector< double, Dim > const &centerUm, blitz::Array< DataT, Dim > &result)
Project the elements of the given vector field to rays originating from the given center point...
blitz::Array< std::complex< double >, 1 > FrequencyArray
Definition: SH_tools.hh:38
void generateMask(FrequencyArray const &coeffs, blitz::Array< bool, 3 > &mask, blitz::TinyVector< double, 3 > const &elementSizeUm, blitz::TinyVector< double, 3 > const &centerUm)
Generate a binary mask being true inside the spherical function and false outside.
Classes and functions for sub-pixel Array access with different interpolation strategies.
void geodesic_sh(blitz::Array< blitz::TinyVector< float, 3 >, 3 > const &gvf, blitz::TinyVector< float, 3 > const &elementSizeUm, FrequencyArray &coeffs, blitz::TinyVector< float, 3 > positionUm, float radiusUm, int bw, double roundness, int num_iter, iRoCS::ProgressReporter *progress=NULL)
Geodesic Active contours.
void geodesicSH(blitz::Array< blitz::TinyVector< DataT, 3 >, 3 > const &edgeForce, blitz::TinyVector< double, 3 > const &elementSizeUm, FrequencyArray &coeffs, blitz::TinyVector< double, 3 > const &positionUm, double radiusUm, int bw, double roundness, int nIter, double tau=0.1, iRoCS::ProgressReporter *progress=NULL)
Evolve an active contour with spherical topology represented by a scalar spherical harmonic function...