ufo-filter-lamino-bp-generic.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. #include <gmodule.h>
  2. #ifdef __APPLE__
  3. #include <OpenCL/cl.h>
  4. #else
  5. #include <CL/cl.h>
  6. #endif
  7. #include <ufo/ufo-filter.h>
  8. #include <ufo/ufo-buffer.h>
  9. #include <ufo/ufo-resource-manager.h>
  10. #include "ufo-filter-lamino-bp-generic.h"
  11. //#include <stdio.h> // TODO remove later
  12. #include "lamino-filter-def.h"
  13. #include <math.h>
  14. struct _UfoFilterLaminoBPGenericPrivate {
  15. // float theta;
  16. cl_kernel bp_kernel;
  17. cl_kernel clean_vol_kernel;
  18. cl_kernel norm_vol_kernel;
  19. CLParameters params;
  20. };
  21. GType ufo_filter_lamino_bp_generic_get_type(void) G_GNUC_CONST;
  22. /* Inherit from UFO_TYPE_FILTER */
  23. G_DEFINE_TYPE(UfoFilterLaminoBPGeneric, ufo_filter_lamino_bp_generic, UFO_TYPE_FILTER);
  24. #define UFO_FILTER_LAMINO_BP_GENERIC_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), UFO_TYPE_FILTER_LAMINO_BP_GENERIC, UfoFilterLaminoBPGenericPrivate))
  25. enum {
  26. PROP_0 = 0,
  27. PROP_THETA,
  28. PROP_PSI,
  29. PROP_ANGLE_STEP,
  30. PROP_VOL_SX,
  31. PROP_VOL_SY,
  32. PROP_VOL_SZ,
  33. PROP_VOL_OX,
  34. PROP_VOL_OY,
  35. PROP_VOL_OZ,
  36. PROP_PROJ_OX,
  37. PROP_PROJ_OY,
  38. N_PROPERTIES
  39. };
  40. static GParamSpec *lamino_bp_generic_properties[N_PROPERTIES] = { NULL, };
  41. /* static void testing_cl_platform()
  42. {
  43. cl_int error = 0;
  44. //Platform Information
  45. cl_uint numPlatforms;
  46. cl_platform_id* clSelectedPlatformID = NULL;
  47. //get the number of available platforms
  48. clGetPlatformIDs(0, NULL, &numPlatforms);
  49. //alloc memory so we can get the whole list
  50. clSelectedPlatformID = (cl_platform_id*)malloc(sizeof(cl_platform_id)*numPlatforms);
  51. //get the list of available platforms
  52. error = clGetPlatformIDs(numPlatforms, clSelectedPlatformID, NULL);
  53. g_message("Available platforms number: %d", numPlatforms);
  54. char platform_info[128];
  55. clGetPlatformInfo(clSelectedPlatformID[0], CL_PLATFORM_NAME, sizeof(char)*128, platform_info, NULL);
  56. g_message("CL_PLATFORM_NAME: %s", platform_info);
  57. cl_uint ciDeviceCount;
  58. cl_device_id* clDevices = NULL;
  59. error = clGetDeviceIDs(clSelectedPlatformID[0], CL_DEVICE_TYPE_GPU, 0, NULL, &ciDeviceCount);
  60. clDevices = (cl_device_id*) malloc(sizeof(cl_device_id) * ciDeviceCount);
  61. error = clGetDeviceIDs(clSelectedPlatformID[0], CL_DEVICE_TYPE_GPU, ciDeviceCount, clDevices, &ciDeviceCount);
  62. g_message("Available Devices: %d.",ciDeviceCount);
  63. char device_info[128];
  64. cl_uint device_value = 0;
  65. cl_ulong device_value_ulong = 0;
  66. size_t device_sizet = 0;
  67. size_t dimsz[3];
  68. for(unsigned int i=0; i < ciDeviceCount ; i++)
  69. {
  70. if(clGetDeviceInfo(clDevices[i], CL_DEVICE_NAME, sizeof(char)*128, device_info, NULL) == CL_SUCCESS)
  71. g_message("#%d CL_DEVICE_NAME: %s", i+1, device_info);
  72. if(clGetDeviceInfo(clDevices[i], CL_DRIVER_VERSION, sizeof(char)*128, device_info, NULL) == CL_SUCCESS)
  73. g_message("#%d CL_DRIVER_VERSION: %s", i+1, device_info);
  74. if(clGetDeviceInfo(clDevices[i], CL_DEVICE_MAX_CLOCK_FREQUENCY, sizeof(cl_uint), &device_value, NULL) == CL_SUCCESS)
  75. g_message("#%d CL_DEVICE_MAX_CLOCK_FREQUENCY: %dMHz", i+1, device_value);
  76. if(clGetDeviceInfo(clDevices[i], CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, sizeof(cl_ulong), &device_value_ulong, NULL) == CL_SUCCESS)
  77. g_message("#%d CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: %d kB", i+1, device_value_ulong/(1024));
  78. if(clGetDeviceInfo(clDevices[i], CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(cl_ulong), &device_value_ulong, NULL) == CL_SUCCESS)
  79. g_message("#%d CL_DEVICE_GLOBAL_MEM_SIZE: %d MB", i+1, device_value_ulong/(1024*1024));
  80. if(clGetDeviceInfo(clDevices[i], CL_DEVICE_LOCAL_MEM_SIZE, sizeof(cl_ulong), &device_value_ulong, NULL) == CL_SUCCESS)
  81. g_message("#%d CL_DEVICE_LOCAL_MEM_SIZE: %d kB", i+1, device_value_ulong/(1024));
  82. if(clGetDeviceInfo(clDevices[i], CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof(cl_ulong), &device_value_ulong, NULL) == CL_SUCCESS)
  83. g_message("#%d CL_DEVICE_MAX_MEM_ALLOC_SIZE: %d MB", i+1, device_value_ulong/(1024*1024));
  84. if(clGetDeviceInfo(clDevices[i], CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(size_t), &device_sizet, NULL) == CL_SUCCESS)
  85. g_message("#%d CL_DEVICE_MAX_WORK_GROUP_SIZE: %d", i+1, device_sizet);
  86. if(clGetDeviceInfo(clDevices[i], CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, sizeof(cl_uint), &device_value, NULL) == CL_SUCCESS)
  87. g_message("#%d CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: %d", i+1, device_value);
  88. if(clGetDeviceInfo(clDevices[i], CL_DEVICE_MAX_WORK_ITEM_SIZES, sizeof(size_t)*3, dimsz, NULL) == CL_SUCCESS)
  89. g_message("#%d CL_DEVICE_MAX_WORK_ITEM_SIZES: %d x %d x %d", i+1, dimsz[0], dimsz[1], dimsz[2]);
  90. g_message(" ");
  91. }
  92. if(error != CL_SUCCESS)
  93. g_message("OpenCL testing failed");
  94. else
  95. g_message("OpenCL testing succeded");
  96. }*/
  97. static void ufo_filter_lamino_bp_generic_process(UfoFilter *filter)
  98. {
  99. /////////////////// testing OpenCL platform
  100. // testing_cl_platform();
  101. g_return_if_fail(UFO_IS_FILTER(filter));
  102. UfoFilterLaminoBPGeneric *self = UFO_FILTER_LAMINO_BP_GENERIC(filter);
  103. UfoFilterLaminoBPGenericPrivate *priv = UFO_FILTER_LAMINO_BP_GENERIC_GET_PRIVATE(self);
  104. UfoResourceManager *manager = ufo_resource_manager();
  105. UfoChannel *input_channel = ufo_filter_get_input_channel(filter);
  106. UfoChannel *output_channel = ufo_filter_get_output_channel(filter);
  107. cl_command_queue command_queue = (cl_command_queue) ufo_filter_get_command_queue(filter);
  108. cl_context context = (cl_context) ufo_resource_manager_get_context(manager);
  109. UfoBuffer *input = ufo_channel_get_input_buffer(input_channel);
  110. ////// init recon-parameters which are common for all projs
  111. CLParameters * params = &(priv->params);
  112. // get size of a projection
  113. guint proj_num_dims = 0;
  114. guint * proj_dim_size = NULL;
  115. ufo_buffer_get_dimensions(input, &proj_num_dims, &proj_dim_size);
  116. params->proj_sx = proj_dim_size[0];
  117. params->proj_sy = proj_dim_size[1];
  118. int vSX = priv->params.vol_sx;
  119. int vSY = priv->params.vol_sy;
  120. int vSZ = priv->params.vol_sz;
  121. // shift volume origin to the box center
  122. params->vol_ox += (float)vSX/2.0;
  123. params->vol_oy += (float)vSY/2.0;
  124. params->vol_oz += (float)vSZ/2.0;
  125. // allocate memory for the reconstructed volume
  126. guint vol_num_dims = 3;
  127. guint vol_dim_size[3] = {vSX, vSY, vSZ};
  128. size_t global_work_size[3] = { (size_t)vSX, (size_t) vSY, (size_t)vSZ};
  129. ufo_channel_allocate_output_buffers(output_channel, vol_num_dims, vol_dim_size);
  130. UfoBuffer *output = ufo_channel_get_output_buffer(output_channel);
  131. cl_mem output_mem = (cl_mem) ufo_buffer_get_device_array(output, command_queue);
  132. // clean volume before reconstruction on the GPU side
  133. g_message("prepare the volume");
  134. cl_event event;
  135. cl_kernel clean_vol_kernel = priv->clean_vol_kernel;
  136. CHECK_OPENCL_ERROR(clSetKernelArg(clean_vol_kernel, 0, sizeof(cl_mem), (void *) &output_mem));
  137. CHECK_OPENCL_ERROR(clEnqueueNDRangeKernel(command_queue, clean_vol_kernel,
  138. vol_num_dims, NULL, global_work_size, NULL, 0, NULL, &event));
  139. // whait until kernel finishes its job
  140. ufo_buffer_attach_event(output, event);
  141. // setup backprojection kernel
  142. cl_kernel kernel = priv->bp_kernel;
  143. CHECK_OPENCL_ERROR(clSetKernelArg(kernel, 1, sizeof(cl_mem), (void *) &output_mem));
  144. // projection conter
  145. int proj_idx = 0;
  146. // allocate memory for parameters
  147. cl_mem param_mem = clCreateBuffer(context, CL_MEM_READ_ONLY, sizeof(CLParameters), NULL, NULL);
  148. g_message("loop");
  149. while(input != NULL)
  150. {
  151. ////// init recon-parameters which are individual for each projs
  152. params->alpha = - 3 * G_PI/2 + params->theta;
  153. params->phi = params->angle_step*(float)proj_idx;
  154. float sf = sin(params->phi), cf = cos(params->phi), ct=cos(params->alpha),
  155. st = sin(params->alpha), cg = cos(params->psi), sg=sin(params->psi);
  156. params->mat_0 = cg * cf - sg * st * sf;
  157. params->mat_1 = -cg * sf - sg * st * cf;
  158. params->mat_2 = -sg * ct;
  159. params->mat_3 = sg * cf + cg * st * sf;
  160. params->mat_4 = -sg * sf + cg * st * cf;
  161. params->mat_5 = cg * ct;
  162. // send parameters to GPU
  163. clEnqueueWriteBuffer(command_queue, param_mem, CL_TRUE, 0, sizeof(CLParameters), params, 0, NULL, &event);
  164. // copy projection to GPU
  165. cl_mem input_mem = (cl_mem) ufo_buffer_get_device_array(input, command_queue);
  166. CHECK_OPENCL_ERROR(clSetKernelArg(kernel, 0, sizeof(cl_mem), (void *)&input_mem));
  167. CHECK_OPENCL_ERROR(clSetKernelArg(kernel, 2, sizeof(cl_mem), (void *)&param_mem));
  168. // call backprojection routine
  169. g_message("processing of %d-th projection", proj_idx);
  170. CHECK_OPENCL_ERROR(clEnqueueNDRangeKernel(command_queue, kernel,
  171. vol_num_dims, NULL, global_work_size, NULL, 0, NULL, &event));
  172. // wait untill it finishes its job
  173. ufo_buffer_attach_event(output, event);
  174. // release input buffer
  175. ufo_channel_finalize_input_buffer(input_channel, input);
  176. // get next projection
  177. input = ufo_channel_get_input_buffer(input_channel);
  178. proj_idx++;
  179. }
  180. // normalize volume after reconstruction
  181. cl_kernel norm_vol_kernel = priv->norm_vol_kernel;
  182. CHECK_OPENCL_ERROR(clSetKernelArg(norm_vol_kernel, 0, sizeof(cl_mem), (void *) &output_mem));
  183. // setup the normalization factor
  184. float stepPhi = params->angle_step;
  185. CHECK_OPENCL_ERROR(clSetKernelArg(norm_vol_kernel, 1, sizeof(float), &stepPhi));
  186. // call normalization kernel
  187. g_message("volume post-processing");
  188. CHECK_OPENCL_ERROR(clEnqueueNDRangeKernel(command_queue, norm_vol_kernel,
  189. vol_num_dims, NULL, global_work_size, NULL, 0, NULL, &event));
  190. // temporal saving unless 3d writer is not ready
  191. /*FILE * amfile = fopen("_reco.bin","wb");
  192. float * recobuf = ufo_buffer_get_host_array(output, command_queue);
  193. fwrite(recobuf, sizeof(float), vSX*vSY*vSZ, amfile);
  194. fclose(amfile);*/
  195. // transfer buffer to 3D write filter
  196. ufo_channel_finalize_output_buffer(output_channel, output);
  197. // realese output buffer
  198. ufo_channel_finish(output_channel);
  199. // free all buffers and cl_mems
  200. CHECK_OPENCL_ERROR(clReleaseMemObject(param_mem));
  201. g_free(proj_dim_size);
  202. }
  203. static void ufo_filter_lamino_bp_generic_set_property(GObject *object,
  204. guint property_id,
  205. const GValue *value,
  206. GParamSpec *pspec)
  207. {
  208. UfoFilterLaminoBPGeneric *self = UFO_FILTER_LAMINO_BP_GENERIC(object);
  209. switch (property_id)
  210. {
  211. case PROP_THETA:
  212. self->priv->params.theta = (float) g_value_get_double(value);
  213. break;
  214. case PROP_PSI:
  215. self->priv->params.psi = (float) g_value_get_double(value);
  216. break;
  217. case PROP_ANGLE_STEP:
  218. self->priv->params.angle_step = (float) g_value_get_double(value);
  219. break;
  220. case PROP_VOL_SX:
  221. self->priv->params.vol_sx = g_value_get_uint(value);
  222. break;
  223. case PROP_VOL_SY:
  224. self->priv->params.vol_sy = g_value_get_uint(value);
  225. break;
  226. case PROP_VOL_SZ:
  227. self->priv->params.vol_sz = g_value_get_uint(value);
  228. break;
  229. case PROP_VOL_OX:
  230. self->priv->params.vol_ox = (float)g_value_get_double(value);
  231. break;
  232. case PROP_VOL_OY:
  233. self->priv->params.vol_oy = (float)g_value_get_double(value);
  234. break;
  235. case PROP_VOL_OZ:
  236. self->priv->params.vol_oz = (float)g_value_get_double(value);
  237. break;
  238. case PROP_PROJ_OX:
  239. self->priv->params.proj_ox = (float)g_value_get_double(value);
  240. break;
  241. case PROP_PROJ_OY:
  242. self->priv->params.proj_oy = (float)g_value_get_double(value);
  243. break;
  244. default:
  245. G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
  246. break;
  247. }
  248. }
  249. static void ufo_filter_lamino_bp_generic_get_property(GObject *object,
  250. guint property_id,
  251. GValue *value,
  252. GParamSpec *pspec)
  253. {
  254. UfoFilterLaminoBPGeneric *self = UFO_FILTER_LAMINO_BP_GENERIC(object);
  255. switch (property_id)
  256. {
  257. case PROP_THETA:
  258. g_value_set_double(value, (double) self->priv->params.theta);
  259. break;
  260. case PROP_PSI:
  261. g_value_set_double(value, (double) self->priv->params.psi);
  262. break;
  263. case PROP_ANGLE_STEP:
  264. g_value_set_double(value, (double) self->priv->params.angle_step);
  265. break;
  266. case PROP_VOL_SX:
  267. g_value_set_uint(value, self->priv->params.vol_sx);
  268. break;
  269. case PROP_VOL_SY:
  270. g_value_set_uint(value, self->priv->params.vol_sy);
  271. break;
  272. case PROP_VOL_SZ:
  273. g_value_set_uint(value, self->priv->params.vol_sz);
  274. break;
  275. case PROP_VOL_OX:
  276. g_value_set_double(value, (double)self->priv->params.vol_ox);
  277. break;
  278. case PROP_VOL_OY:
  279. g_value_set_double(value, (double)self->priv->params.vol_oy);
  280. break;
  281. case PROP_VOL_OZ:
  282. g_value_set_double(value, (double)self->priv->params.vol_oz);
  283. break;
  284. case PROP_PROJ_OX:
  285. g_value_set_double(value, (double)self->priv->params.proj_ox);
  286. break;
  287. case PROP_PROJ_OY:
  288. g_value_set_double(value, (double)self->priv->params.proj_oy);
  289. break;
  290. default:
  291. G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
  292. break;
  293. }
  294. }
  295. static void ufo_filter_lamino_bp_generic_initialize(UfoFilter *filter)
  296. {
  297. UfoFilterLaminoBPGeneric *self = UFO_FILTER_LAMINO_BP_GENERIC(filter);
  298. UfoResourceManager *manager = ufo_resource_manager();
  299. GError *error = NULL;
  300. self->priv->bp_kernel = NULL;
  301. // TODO: how to solve 'include problem' for cl-files?
  302. ufo_resource_manager_add_program(manager, "lamino_bp_generic.cl",
  303. "-I /home/timurttv/_UFO-Project/framework/ufo-filters-am-installed/lib/ufo", &error);
  304. if (error != NULL) {
  305. g_warning("%s", error->message);
  306. g_error_free(error);
  307. return;
  308. }
  309. self->priv->bp_kernel = ufo_resource_manager_get_kernel(manager, "lamino_bp_generic", &error);
  310. self->priv->clean_vol_kernel = ufo_resource_manager_get_kernel(manager, "lamino_clean_vol", &error);
  311. self->priv->norm_vol_kernel = ufo_resource_manager_get_kernel(manager, "lamino_norm_vol", &error);
  312. if (error != NULL) {
  313. g_warning("%s", error->message);
  314. g_error_free(error);
  315. }
  316. }
  317. static void ufo_filter_lamino_bp_generic_class_init(UfoFilterLaminoBPGenericClass *klass)
  318. {
  319. GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
  320. UfoFilterClass *filter_class = UFO_FILTER_CLASS(klass);
  321. gobject_class->set_property = ufo_filter_lamino_bp_generic_set_property;
  322. gobject_class->get_property = ufo_filter_lamino_bp_generic_get_property;
  323. filter_class->initialize = ufo_filter_lamino_bp_generic_initialize;
  324. filter_class->process = ufo_filter_lamino_bp_generic_process;
  325. lamino_bp_generic_properties[PROP_THETA] =
  326. g_param_spec_double("theta",
  327. "Laminographic angle in radians",
  328. "Laminographic angle in radians",
  329. -4.0 * G_PI, +4.0 * G_PI, 0.0,
  330. G_PARAM_READWRITE);
  331. lamino_bp_generic_properties[PROP_PSI] =
  332. g_param_spec_double("psi",
  333. "Axis misalignment angle in radians",
  334. "Axis misalignment angle in radians",
  335. -4.0 * G_PI, +4.0 * G_PI, 0.0,
  336. G_PARAM_READWRITE);
  337. lamino_bp_generic_properties[PROP_ANGLE_STEP] =
  338. g_param_spec_double("angle-step",
  339. "Increment of rotation angle phi in radians",
  340. "Increment of rotation angle phi in radians",
  341. -4.0 * G_PI, +4.0 * G_PI, 0.0,
  342. G_PARAM_READWRITE);
  343. lamino_bp_generic_properties[PROP_VOL_SX] =
  344. g_param_spec_uint("vol-sx",
  345. "Size of reconstructed volume along the 0X-axis in voxels",
  346. "Size of reconstructed volume along the 0X-axis in voxels",
  347. 0, 1024*8, 512,
  348. G_PARAM_READWRITE);
  349. lamino_bp_generic_properties[PROP_VOL_SY] =
  350. g_param_spec_uint("vol-sy",
  351. "Size of reconstructed volume along the 0Y-axis in voxels",
  352. "Size of reconstructed volume along the 0Y-axis in voxels",
  353. 0, 1024*8, 512,
  354. G_PARAM_READWRITE);
  355. lamino_bp_generic_properties[PROP_VOL_SZ] =
  356. g_param_spec_uint("vol-sz",
  357. "Size of reconstructed volume along the 0Z-axis in voxels",
  358. "Size of reconstructed volume along the 0Z-axis in voxels",
  359. 0, 1024*8, 512,
  360. G_PARAM_READWRITE);
  361. lamino_bp_generic_properties[PROP_VOL_OX] =
  362. g_param_spec_double("vol-ox",
  363. "Volume origin offset from the center of a reco-box along the OX-axis in voxels",
  364. "Volume origin offset from the center of a reco-box along the OX-axis in voxels",
  365. -1024*8, 1024*8, 0,
  366. G_PARAM_READWRITE);
  367. lamino_bp_generic_properties[PROP_VOL_OY] =
  368. g_param_spec_double("vol-oy",
  369. "Volume origin offset from the center of a reco-box along the OY-axis in voxels",
  370. "Volume origin offset from the center of a reco-box along the OY-axis in voxels",
  371. -1024*8, 1024*8, 0,
  372. G_PARAM_READWRITE);
  373. lamino_bp_generic_properties[PROP_VOL_OZ] =
  374. g_param_spec_double("vol-oz",
  375. "Volume origin offset from the center of a reco-box along the OZ-axis in voxels",
  376. "Volume origin offset from the center of a reco-box along the OZ-axis in voxels",
  377. -1024*8, 1024*8, 0,
  378. G_PARAM_READWRITE);
  379. lamino_bp_generic_properties[PROP_PROJ_OX] =
  380. g_param_spec_double("proj-ox",
  381. "Projection of the rotation center on the radiograph origin on the OX-axis",
  382. "Projection of the rotation center on the radiograph origin on the OX-axis",
  383. -1024*8, 1024*8, 0, G_PARAM_READWRITE);
  384. lamino_bp_generic_properties[PROP_PROJ_OY] =
  385. g_param_spec_double("proj-oy",
  386. "Projection of the rotation center on the radiograph origin on the OY-axis",
  387. "Projection of the rotation center on the radiograph origin on the OY-axis",
  388. -1024*8, 1024*8, 0,
  389. G_PARAM_READWRITE);
  390. g_object_class_install_property(gobject_class, PROP_THETA, lamino_bp_generic_properties[PROP_THETA]);
  391. g_object_class_install_property(gobject_class, PROP_PSI, lamino_bp_generic_properties[PROP_PSI]);
  392. g_object_class_install_property(gobject_class, PROP_ANGLE_STEP, lamino_bp_generic_properties[PROP_ANGLE_STEP]);
  393. g_object_class_install_property(gobject_class, PROP_VOL_SX, lamino_bp_generic_properties[PROP_VOL_SX]);
  394. g_object_class_install_property(gobject_class, PROP_VOL_SY, lamino_bp_generic_properties[PROP_VOL_SY]);
  395. g_object_class_install_property(gobject_class, PROP_VOL_SZ, lamino_bp_generic_properties[PROP_VOL_SZ]);
  396. g_object_class_install_property(gobject_class, PROP_VOL_OX, lamino_bp_generic_properties[PROP_VOL_OX]);
  397. g_object_class_install_property(gobject_class, PROP_VOL_OY, lamino_bp_generic_properties[PROP_VOL_OY]);
  398. g_object_class_install_property(gobject_class, PROP_VOL_OZ, lamino_bp_generic_properties[PROP_VOL_OZ]);
  399. g_object_class_install_property(gobject_class, PROP_PROJ_OX, lamino_bp_generic_properties[PROP_PROJ_OX]);
  400. g_object_class_install_property(gobject_class, PROP_PROJ_OY, lamino_bp_generic_properties[PROP_PROJ_OY]);
  401. /* install private data */
  402. g_type_class_add_private(gobject_class, sizeof(UfoFilterLaminoBPGenericPrivate));
  403. }
  404. static void ufo_filter_lamino_bp_generic_init(UfoFilterLaminoBPGeneric *self)
  405. {
  406. // initialize parameters here
  407. self->priv = UFO_FILTER_LAMINO_BP_GENERIC_GET_PRIVATE(self);
  408. CLParameters * prms = &(self->priv->params);
  409. prms->theta = 0.0;
  410. prms->psi = 0.0;
  411. prms->angle_step = 0.0;
  412. prms->vol_sx = 512;
  413. prms->vol_sy = 512;
  414. prms->vol_sz = 512;
  415. prms->vol_ox = 0.0;
  416. prms->vol_oy = 0.0;
  417. prms->vol_oz = 0.0;
  418. prms->proj_ox = 0.0;
  419. prms->proj_oy = 0.0;
  420. ufo_filter_register_input(UFO_FILTER(self), "projection", 2);
  421. ufo_filter_register_output(UFO_FILTER(self), "volume", 3);
  422. }
  423. G_MODULE_EXPORT UfoFilter *ufo_filter_plugin_new(void)
  424. {
  425. return g_object_new(UFO_TYPE_FILTER_LAMINO_BP_GENERIC, NULL);
  426. }