My Project
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  {
51  return P2DImage(x.clone());
52  }
53 };
55 
69 class EXPORT_3D C2DImageFifoFilter: public TFifoFilter<P2DImage>, public CProductBase
70 {
71 public:
72  typedef image2d_stack plugin_data;
73  typedef filter_type plugin_type;
74 
83  C2DImageFifoFilter(size_t filter_width, size_t min_fill, size_t read_start);
84 protected:
85 
92  C3DImage *create_buffer(const C2DBounds& slice_sice, size_t depth, EPixelType type);
93 
99  struct CShiftSlices: public TFilter<int> {
100  template <typename T>
101  int operator ()(T3DImage<T>& input) const
102  {
103  copy_backward(input.begin(), input.end() - input.get_size().x
104  * input.get_size().y, input.end());
105  return 0;
106  }
107  };
109 };
110 
116  public TFactory<C2DImageFifoFilter>
117 {
118 protected:
123  C2DFifoFilterPlugin(char const *const name);
124 
126  typedef std::vector<P2DImage> CImageStack;
127 
136  bool call_test(const CImageStack& in_data, const CImageStack& test_data,
137  C2DImageFifoFilter& filter)const ;
138 };
139 
145 
146 
147 #ifdef __GNUC__
148 #pragma GCC diagnostic push
149 #ifndef __clang__
150 #pragma GCC diagnostic ignored "-Wattributes"
151 #endif
152 #endif
153 
154 extern template class EXPORT_3D TFifoFilter<P2DImage>;
155 extern template class EXPORT_3D TFifoFilterSink<P2DImage>;
156 
157 #ifdef __GNUC__
158 #pragma GCC diagnostic pop
159 #endif
160 
166 
168 
169 #endif
C2DImage::Pointer P2DImage
Shared pointer representation of the 2D Image.
Definition: 2d/image.hh:120
The plug-in base class for the FIFO filters.
C2DFifoFilterPlugin(char const *const name)
std::vector< P2DImage > CImageStack
helper class to store a set of images
bool call_test(const CImageStack &in_data, const CImageStack &test_data, C2DImageFifoFilter &filter) const
The class to provide filtering of series of 2D images as if they where 3D images.
C3DImage * create_buffer(const C2DBounds &slice_sice, size_t depth, EPixelType type)
C2DImageFifoFilter(size_t filter_width, size_t min_fill, size_t read_start)
image2d_stack plugin_data
This is the base class for 2D images that can hold generic pixel data.
Definition: 2d/image.hh:48
virtual C2DImage * clone() const __attribute__((warn_unused_result))=0
The generic base type of a 3D image.
Definition: 3d/image.hh:47
The base class for all plug-in created object.
Definition: product_base.hh:41
Specific type of the 3D images that hold real pixel data.
Definition: 3d/image.hh:150
This is tha base of all plugins that create "things", like filters, cost functions time step operator...
Definition: factory.hh:51
Helper class for testing FIFO filter chains.
Definition: fifofilter.hh:159
Generic base class for out-of-core FIFO filters.
Definition: fifofilter.hh:53
the singleton that a plug-in handler really is
Definition: handler.hh:159
#define EXPORT_3D
Definition: defines3d.hh:45
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36
TFifoFilter< P2DImage >::Pointer P2DImageFifoFilter
Pointer type for the FIFO filter.
THandlerSingleton< TFactoryPluginHandler< C2DFifoFilterPlugin > > C2DFifoFilterPluginHandler
Plugin handler for the FIFO filters.
static F::result_type filter(const F &f, const B &b)
Definition: core/filter.hh:258
EPixelType
Definition: pixeltype.hh:32
base class for all filer type functors.
Definition: core/filter.hh:70