2dimagefifofilter.hh
Go to the documentation of this file.
1 /* -*- mia-c++ -*-
2  *
3  * This file is part of MIA - a toolbox for medical image analysis
4  * Copyright (c) Leipzig, Madrid 1999-2013 Gert Wollny
5  *
6  * MIA is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with MIA; if not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 #ifndef __mia_2dfifofilterstack_hh
22 #define __mia_2dfifofilterstack_hh
23 
24 #include <mia/2d/image.hh>
25 #include <mia/3d/image.hh>
26 #include <mia/core/factory.hh>
27 #include <mia/core/fifofilter.hh>
28 #include <mia/core/filter.hh>
29 #include <mia/2d/image.hh>
30 
32 
37 struct EXPORT_3D image2d_stack {
38  static const char *data_descr;
39 };
40 
47 template <>
48 struct __copy_create_ptr<C2DImage> {
49  static P2DImage apply(const C2DImage& x){
50  return P2DImage(x.clone());
51  }
52 };
54 
68 class EXPORT_3D C2DImageFifoFilter: public TFifoFilter<P2DImage>, public CProductBase {
69 public:
70  typedef image2d_stack plugin_data;
71  typedef filter_type plugin_type;
72 
81  C2DImageFifoFilter(size_t filter_width, size_t min_fill, size_t read_start);
82 protected:
83 
90  C3DImage *create_buffer(const C2DBounds& slice_sice, size_t depth, EPixelType type);
91 
97  struct CShiftSlices: public TFilter<int> {
98  template <typename T>
99  int operator ()(T3DImage<T>& input) const
100  {
101  copy_backward(input.begin(), input.end() - input.get_size().x
102  * input.get_size().y , input.end());
103  return 0;
104  }
105  };
107 };
108 
114  public TFactory<C2DImageFifoFilter> {
115 protected:
120  C2DFifoFilterPlugin(char const * const name);
121 
123  typedef std::vector<P2DImage> CImageStack;
124 
133  bool call_test(const CImageStack& in_data, const CImageStack& test_data,
134  C2DImageFifoFilter& filter)const ;
135 };
136 
142 
148 
150 
151 #endif