Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 
14 #ifndef mitkOclFilter_h
15 #define mitkOclFilter_h
16 
17 #include "mitkOclUtils.h"
18 #include "mitkCommon.h"
19 
20 #include <vector>
21 #include <usModule.h>
22 
23 #include <MitkOpenCLExports.h>
24 
25 namespace mitk
26 {
33 class MITKOPENCL_EXPORT OclFilter
34 {
35 public:
42  void AddSourceFile(const char* filename);
43 
50  void SetCompilerFlags(const char* flags);
51 
55  virtual bool IsInitialized();
56 
60  virtual unsigned long GetDeviceMemory();
61 
63  virtual ~OclFilter();
64 
65 protected:
66 
67  typedef std::vector<const char*> CStringList;
68  typedef std::vector<size_t> ClSizeList;
69 
71  OclFilter();
72 
74  OclFilter(const char* filename);
75 
77  const char* m_ClCompilerFlags;
78 
80  cl_program m_ClProgram;
81 
83  cl_command_queue m_CommandQue;
84 
86  std::string m_FilterID;
87 
89  const char* m_Preambel;
90 
93 
96 
98  size_t m_LocalWorkSize[3];
99 
101  size_t m_GlobalWorkSize[3];
102 
104  void SetWorkingSize(unsigned int locx, unsigned int dimx,
105  unsigned int locy = 1, unsigned int dimy = 1,
106  unsigned int locz = 1, unsigned int dimz = 1);
107 
110  bool ExecuteKernel( cl_kernel kernel, unsigned int workSizeDim );
111 
114  bool ExecuteKernelChunks( cl_kernel kernel, unsigned int workSizeDim, size_t* chunksDim );
115 
119  bool ExecuteKernelChunksInBatches(cl_kernel kernel, unsigned int workSizeDim, size_t* chunksDim, size_t batchSize, int waitTimems);
127  bool Initialize();
128 
132  void CompileSource();
133 
140  void SetSourcePreambel(const char* preambel);
141 
146  virtual us::Module* GetModule() = 0;
147 
154  void LoadSourceFiles(CStringList &SourceCodeList, ClSizeList &SourceCodeSizeList);
155 };
156 }
157 #endif
mitk::OclFilter::m_CommandQue
cl_command_queue m_CommandQue
Command queue for the filter.
Definition: mitkOclFilter.h:83
usModule.h
mitk::OclFilter::m_FilterID
std::string m_FilterID
Unique ID of the filter, needs to be specified in the constructor of the derived class.
Definition: mitkOclFilter.h:86
mitk::OclFilter::m_ClCompilerFlags
const char * m_ClCompilerFlags
String that contains the compiler flags.
Definition: mitkOclFilter.h:77
mitk::OclFilter::m_Preambel
const char * m_Preambel
source preambel for e.g. #define commands to be inserted into the OpenCL source
Definition: mitkOclFilter.h:89
mitk::OclFilter::CStringList
std::vector< const char * > CStringList
Definition: mitkOclFilter.h:67
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::OclFilter::ClSizeList
std::vector< size_t > ClSizeList
Definition: mitkOclFilter.h:68
mitk::OclFilter::m_ClFiles
CStringList m_ClFiles
List of sourcefiles that will be compiled for this filter.
Definition: mitkOclFilter.h:92
mitkOclUtils.h
us::Module
Definition: usModule.h:78
mitkCommon.h
mitk::OclFilter::m_Initialized
bool m_Initialized
status of the filter
Definition: mitkOclFilter.h:95
mitk::OclFilter
Superclass for all OpenCL based filter.
Definition: mitkOclFilter.h:33
mitk::OclFilter::m_ClProgram
cl_program m_ClProgram
The compiled OpenCL program.
Definition: mitkOclFilter.h:80