aimstil  5.0.5
rf4Tools.h
Go to the documentation of this file.
1 #ifndef TIL_RF4_TOOLS_H
2 #define TIL_RF4_TOOLS_H
3 
4 
5 // includes from STL
6 #include <iostream>
7 #include <vector>
8 
9 // includes from TIL library
10 #include "til/til_common.h"
11 #include "til/imageTools.h"
12 #include "til/rf4.h"
13 
14 
15 
16 // Namespace
17 
18 namespace til {
19 
20 
21 // NB: out can be the same image as in
22 
23 template < typename TImage, typename TLineFilter >
24 void filterAlongAxis
25 (const TImage &im, TImage &out, ImageAxis axis, const TLineFilter &filter)
26 {
27  typedef typename TImage::value_type value_type;
28 
29  int barLength = im.dim()[axis];
30 
31  std::vector<value_type> barIn(barLength);
32  std::vector<value_type> barOut(barLength);
33 
35  for (p[0]=0; p[0]<(axis==X_AXIS?1:im.dim()[0]); ++p[0])
36  {
37  for (p[1]=0; p[1]<(axis==Y_AXIS?1:im.dim()[1]); ++p[1])
38  {
39  for (p[2]=0; p[2]<(axis==Z_AXIS?1:im.dim()[2]); ++p[2])
40  {
41  extractBar(im, p, axis, barIn);
42  filter.apply(barIn, barOut);
43  insertBar(out, p, axis, barOut);
44  }
45  }
46  }
47 }
48 
49 
50 
51 /*
52 template < typename T >
53 void print(RF4<T> rf4)
54 {
55  std::cout << "Forward Filter:" << std::endl;
56  std::cout << rf4.getMIF()[0] <<" "<< rf4.getMIF()[1] <<" "<< rf4.getMIF()[2] <<" "<< rf4.getMIF()[3] << std::endl;
57  std::cout << rf4.getMOF()[0] <<" "<< rf4.getMOF()[1] <<" "<< rf4.getMOF()[2] <<" "<< rf4.getMOF()[3] << std::endl;
58 
59  std::cout << "Backward Filter:" << std::endl;
60  std::cout << rf4.getMIB()[0] <<" "<< rf4.getMIB()[1] <<" "<< rf4.getMIB()[2] <<" "<< rf4.getMIB()[3] << std::endl;
61  std::cout << rf4.getMOB()[0] <<" "<< rf4.getMOB()[1] <<" "<< rf4.getMOB()[2] <<" "<< rf4.getMOB()[3] << std::endl;
62 
63 }
64 */
65 
66 } // namespace
67 
68 #endif
69 
Belongs to package Box Do not include directly, include til/Box.h instead.
Definition: Accumulator.h:10
General macros, definitions and functions.
Small miscellaneous utility functions for images.
void extractBar(const TImage &im, const numeric_array< int, 3 > &pos, ImageAxis axis, std::vector< typename TImage::value_type > &bar)
Extract the line starting from (x,y,z) in the direction of axis from im to bar.
Definition: imageTools.h:438
ImageAxis
Definition: miscTools.h:123
void filterAlongAxis(const TImage &im, TImage &out, ImageAxis axis, const TLineFilter &filter)
Definition: rf4Tools.h:25
void insertBar(TImage &im, const numeric_array< int, 3 > &pos, ImageAxis axis, const std::vector< typename TImage::value_type > &bar)
Insert the line starting from (x,y,z) in the direction of axis from bar to im.
Definition: imageTools.h:465