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-2017 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 
143 
144 #ifdef __GNUC__
145 #pragma GCC diagnostic push
146 #ifndef __clang__
147 #pragma GCC diagnostic ignored "-Wattributes"
148 #endif
149 #endif
150 
151 extern template class EXPORT_3D TFifoFilter<P2DImage>;
152 extern template class EXPORT_3D TFifoFilterSink<P2DImage>;
153 
154 #ifdef __GNUC__
155 #pragma GCC diagnostic pop
156 #endif
157 
163 
165 
166 #endif
the singleton that a plug-in handler really is
Definition: handler.hh:157
C2DImage::Pointer P2DImage
Shared pointer representation of the 2D Image.
Definition: 2d/image.hh:119
Specific type of the 3D images that hold real pixel data.
Definition: 3d/image.hh:148
EPixelType
Definition: pixeltype.hh:32
base class for all filer type functors.
Definition: core/filter.hh:70
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
#define EXPORT_3D
Definition: defines3d.hh:44
static F::result_type filter(const F &f, const B &b)
Definition: core/filter.hh:250
virtual C2DImage * clone() const __attribute__((warn_unused_result))=0
const_iterator end() const
constant iterator
Definition: 3d/image.hh:293
T y
vector element
Definition: 3d/vector.hh:53
This is tha base of all plugins that create "things", like filters, cost functions time step operator...
Definition: factory.hh:49
image2d_stack plugin_data
Helper class for testing FIFO filter chains.
Definition: fifofilter.hh:157
The generic base type of a 3D image.
Definition: 3d/image.hh:46
virtual const C3DBounds & get_size() const
The plug-in base class for the FIFO filters.
The class to provide filtering of series of 2D images as if they where 3D images. ...
THandlerSingleton< TFactoryPluginHandler< C2DFifoFilterPlugin > > C2DFifoFilterPluginHandler
Plugin handler for the FIFO filters.
std::vector< P2DImage > CImageStack
helper class to store a set of images
The base class for all plug-in created object.
Definition: product_base.hh:40
This is the base class for 2D images that can hold generic pixel data.
Definition: 2d/image.hh:47
const_iterator begin() const
constant iterator
Definition: 3d/image.hh:288
TFifoFilter< P2DImage >::Pointer P2DImageFifoFilter
Pointer type for the FIFO filter.
T x
vector element
Definition: 3d/vector.hh:51
Generic base class for out-of-core FIFO filters.
Definition: fifofilter.hh:52
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36