Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkOclFilter.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 
18 #ifndef __mitkOclFilter_h
19 #define __mitkOclFilter_h
20 
21 #include "mitkOclUtils.h"
22 #include "mitkCommon.h"
23 
24 #include <vector>
25 #include <usModule.h>
26 
27 #include <MitkOpenCLExports.h>
28 
29 namespace mitk
30 {
37 class MITKOPENCL_EXPORT OclFilter
38 {
39 public:
46  void AddSourceFile(const char* filename);
47 
54  void SetCompilerFlags(const char* flags);
55 
59  virtual bool IsInitialized();
60 
62  virtual ~OclFilter();
63 
64 protected:
65 
66  typedef std::vector<const char*> CStringList;
67  typedef std::vector<size_t> ClSizeList;
68 
70  OclFilter();
71 
73  OclFilter(const char* filename);
74 
76  const char* m_ClCompilerFlags;
77 
79  cl_program m_ClProgram;
80 
82  cl_command_queue m_CommandQue;
83 
85  std::string m_FilterID;
86 
88  const char* m_Preambel;
89 
91  CStringList m_ClFiles;
92 
95 
97  size_t m_LocalWorkSize[3];
98 
100  size_t m_GlobalWorkSize[3];
101 
103  void SetWorkingSize(unsigned int locx, unsigned int dimx,
104  unsigned int locy = 1, unsigned int dimy = 1,
105  unsigned int locz = 1, unsigned int dimz = 1);
106 
109  bool ExecuteKernel( cl_kernel kernel, unsigned int workSizeDim );
110 
118  bool Initialize();
119 
125  void CompileSource();
126 
133  void SetSourcePreambel(const char* preambel);
134 
139  virtual us::Module* GetModule() = 0;
140 
146  void LoadSourceFiles(CStringList &SourceCodeList, ClSizeList &SourceCodeSizeList);
147 };
148 }
149 #endif // __mitkOclFilter_h
std::string m_FilterID
Unique ID of the filter, needs to be specified in the constructor of the derived class.
Definition: mitkOclFilter.h:85
bool m_Initialized
status of the filter
Definition: mitkOclFilter.h:94
cl_program m_ClProgram
The compiled OpenCL program.
Definition: mitkOclFilter.h:79
const char * m_Preambel
source preambel for e.g. #define commands to be inserted into the OpenCL source
Definition: mitkOclFilter.h:88
DataCollection - Class to facilitate loading/accessing structured data.
std::vector< const char * > CStringList
Definition: mitkOclFilter.h:66
static const std::string filename
std::vector< vcl_size_t > ClSizeList
Definition: mitkOclFilter.h:67
CStringList m_ClFiles
List of sourcefiles that will be compiled for this filter.
Definition: mitkOclFilter.h:91
cl_command_queue m_CommandQue
Command queue for the filter.
Definition: mitkOclFilter.h:82
Superclass for all OpenCL based filter.
Definition: mitkOclFilter.h:37
const char * m_ClCompilerFlags
String that contains the compiler flags.
Definition: mitkOclFilter.h:76