|
@@ -1,524 +0,0 @@
|
|
|
-#include <gmodule.h>
|
|
|
-#ifdef __APPLE__
|
|
|
-#include <OpenCL/cl.h>
|
|
|
-#else
|
|
|
-#include <CL/cl.h>
|
|
|
-#endif
|
|
|
-
|
|
|
-#include <ufo/ufo-filter-reduce.h>
|
|
|
-#include <ufo/ufo-buffer.h>
|
|
|
-#include <ufo/ufo-resource-manager.h>
|
|
|
-
|
|
|
-#include "ufo-filter-lamino-bp-generic.h"
|
|
|
-
|
|
|
-//#include <stdio.h> // TODO remove later
|
|
|
-
|
|
|
-#include "lamino-filter-def.h"
|
|
|
-#include <math.h>
|
|
|
-
|
|
|
-
|
|
|
-struct _UfoFilterLaminoBPGenericPrivate {
|
|
|
- // float theta;
|
|
|
- cl_kernel bp_kernel;
|
|
|
- cl_kernel clean_vol_kernel;
|
|
|
- cl_kernel norm_vol_kernel;
|
|
|
- cl_mem param_mem;
|
|
|
- gint proj_idx;
|
|
|
- CLParameters params;
|
|
|
- gboolean finished;
|
|
|
- size_t global_work_size[3];
|
|
|
-};
|
|
|
-
|
|
|
-GType ufo_filter_lamino_bp_generic_get_type(void) G_GNUC_CONST;
|
|
|
-
|
|
|
-G_DEFINE_TYPE(UfoFilterLaminoBPGeneric, ufo_filter_lamino_bp_generic, UFO_TYPE_FILTER_REDUCE);
|
|
|
-
|
|
|
-#define UFO_FILTER_LAMINO_BP_GENERIC_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), UFO_TYPE_FILTER_LAMINO_BP_GENERIC, UfoFilterLaminoBPGenericPrivate))
|
|
|
-
|
|
|
-enum {
|
|
|
- PROP_0 = 0,
|
|
|
- PROP_THETA,
|
|
|
- PROP_PSI,
|
|
|
- PROP_ANGLE_STEP,
|
|
|
- PROP_VOL_SX,
|
|
|
- PROP_VOL_SY,
|
|
|
- PROP_VOL_SZ,
|
|
|
- PROP_VOL_OX,
|
|
|
- PROP_VOL_OY,
|
|
|
- PROP_VOL_OZ,
|
|
|
- PROP_PROJ_OX,
|
|
|
- PROP_PROJ_OY,
|
|
|
- N_PROPERTIES
|
|
|
-};
|
|
|
-
|
|
|
-static GParamSpec *lamino_bp_generic_properties[N_PROPERTIES] = { NULL, };
|
|
|
-
|
|
|
-
|
|
|
-/* static void testing_cl_platform()
|
|
|
- {
|
|
|
- cl_int error = 0;
|
|
|
-
|
|
|
-//Platform Information
|
|
|
-cl_uint numPlatforms;
|
|
|
-cl_platform_id* clSelectedPlatformID = NULL;
|
|
|
-//get the number of available platforms
|
|
|
-
|
|
|
-clGetPlatformIDs(0, NULL, &numPlatforms);
|
|
|
-//alloc memory so we can get the whole list
|
|
|
-clSelectedPlatformID = (cl_platform_id*)malloc(sizeof(cl_platform_id)*numPlatforms);
|
|
|
-//get the list of available platforms
|
|
|
-error = clGetPlatformIDs(numPlatforms, clSelectedPlatformID, NULL);
|
|
|
-
|
|
|
-g_message("Available platforms number: %d", numPlatforms);
|
|
|
-
|
|
|
-char platform_info[128];
|
|
|
-clGetPlatformInfo(clSelectedPlatformID[0], CL_PLATFORM_NAME, sizeof(char)*128, platform_info, NULL);
|
|
|
-g_message("CL_PLATFORM_NAME: %s", platform_info);
|
|
|
-
|
|
|
-cl_uint ciDeviceCount;
|
|
|
-cl_device_id* clDevices = NULL;
|
|
|
-error = clGetDeviceIDs(clSelectedPlatformID[0], CL_DEVICE_TYPE_GPU, 0, NULL, &ciDeviceCount);
|
|
|
-clDevices = (cl_device_id*) malloc(sizeof(cl_device_id) * ciDeviceCount);
|
|
|
-error = clGetDeviceIDs(clSelectedPlatformID[0], CL_DEVICE_TYPE_GPU, ciDeviceCount, clDevices, &ciDeviceCount);
|
|
|
-
|
|
|
-g_message("Available Devices: %d.",ciDeviceCount);
|
|
|
-char device_info[128];
|
|
|
-cl_uint device_value = 0;
|
|
|
-cl_ulong device_value_ulong = 0;
|
|
|
-size_t device_sizet = 0;
|
|
|
-size_t dimsz[3];
|
|
|
-
|
|
|
-for(unsigned int i=0; i < ciDeviceCount ; i++)
|
|
|
-{
|
|
|
-if(clGetDeviceInfo(clDevices[i], CL_DEVICE_NAME, sizeof(char)*128, device_info, NULL) == CL_SUCCESS)
|
|
|
-g_message("#%d CL_DEVICE_NAME: %s", i+1, device_info);
|
|
|
-
|
|
|
-if(clGetDeviceInfo(clDevices[i], CL_DRIVER_VERSION, sizeof(char)*128, device_info, NULL) == CL_SUCCESS)
|
|
|
-g_message("#%d CL_DRIVER_VERSION: %s", i+1, device_info);
|
|
|
-
|
|
|
-if(clGetDeviceInfo(clDevices[i], CL_DEVICE_MAX_CLOCK_FREQUENCY, sizeof(cl_uint), &device_value, NULL) == CL_SUCCESS)
|
|
|
-g_message("#%d CL_DEVICE_MAX_CLOCK_FREQUENCY: %dMHz", i+1, device_value);
|
|
|
-
|
|
|
-if(clGetDeviceInfo(clDevices[i], CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, sizeof(cl_ulong), &device_value_ulong, NULL) == CL_SUCCESS)
|
|
|
-g_message("#%d CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: %d kB", i+1, device_value_ulong/(1024));
|
|
|
-
|
|
|
-if(clGetDeviceInfo(clDevices[i], CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(cl_ulong), &device_value_ulong, NULL) == CL_SUCCESS)
|
|
|
-g_message("#%d CL_DEVICE_GLOBAL_MEM_SIZE: %d MB", i+1, device_value_ulong/(1024*1024));
|
|
|
-
|
|
|
-if(clGetDeviceInfo(clDevices[i], CL_DEVICE_LOCAL_MEM_SIZE, sizeof(cl_ulong), &device_value_ulong, NULL) == CL_SUCCESS)
|
|
|
-g_message("#%d CL_DEVICE_LOCAL_MEM_SIZE: %d kB", i+1, device_value_ulong/(1024));
|
|
|
-
|
|
|
-if(clGetDeviceInfo(clDevices[i], CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof(cl_ulong), &device_value_ulong, NULL) == CL_SUCCESS)
|
|
|
-g_message("#%d CL_DEVICE_MAX_MEM_ALLOC_SIZE: %d MB", i+1, device_value_ulong/(1024*1024));
|
|
|
-
|
|
|
-if(clGetDeviceInfo(clDevices[i], CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(size_t), &device_sizet, NULL) == CL_SUCCESS)
|
|
|
-g_message("#%d CL_DEVICE_MAX_WORK_GROUP_SIZE: %d", i+1, device_sizet);
|
|
|
-
|
|
|
-if(clGetDeviceInfo(clDevices[i], CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, sizeof(cl_uint), &device_value, NULL) == CL_SUCCESS)
|
|
|
-g_message("#%d CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: %d", i+1, device_value);
|
|
|
-
|
|
|
-if(clGetDeviceInfo(clDevices[i], CL_DEVICE_MAX_WORK_ITEM_SIZES, sizeof(size_t)*3, dimsz, NULL) == CL_SUCCESS)
|
|
|
-g_message("#%d CL_DEVICE_MAX_WORK_ITEM_SIZES: %d x %d x %d", i+1, dimsz[0], dimsz[1], dimsz[2]);
|
|
|
-
|
|
|
-g_message(" ");
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-if(error != CL_SUCCESS)
|
|
|
- g_message("OpenCL testing failed");
|
|
|
- else
|
|
|
- g_message("OpenCL testing succeded");
|
|
|
-
|
|
|
- }*/
|
|
|
-
|
|
|
-static void
|
|
|
-ufo_filter_lamino_bp_generic_initialize (UfoFilterReduce *filter, UfoBuffer *input[], guint **output_dims, gfloat *default_value, GError **error)
|
|
|
-{
|
|
|
- UfoFilterLaminoBPGenericPrivate *priv = UFO_FILTER_LAMINO_BP_GENERIC_GET_PRIVATE(filter);
|
|
|
- UfoResourceManager *manager = ufo_filter_get_resource_manager(UFO_FILTER(filter));
|
|
|
- GError *tmp_error = NULL;
|
|
|
- cl_context context;
|
|
|
- guint width, height;
|
|
|
-
|
|
|
- // TODO: how to solve 'include problem' for cl-files?
|
|
|
- // resource_manager_add_program
|
|
|
- // (UfoResourceManager *manager,
|
|
|
- // const gchar *filename, const gchar *options, GError **error)
|
|
|
-
|
|
|
- // ufo_resource_manager_add_program(manager, "lamino_bp_generic.cl",
|
|
|
- // "-I /home/timurttv/_UFO-Project/framework/ufo-filters-am-installed/lib/ufo", &error);
|
|
|
-
|
|
|
- priv->bp_kernel = ufo_resource_manager_get_kernel(manager, "lamino_bp_generic.cl", "lamino_bp_generic", &tmp_error);
|
|
|
- priv->norm_vol_kernel = ufo_resource_manager_get_kernel(manager, "lamino_bp_generic.cl", "lamino_norm_vol", &tmp_error);
|
|
|
-
|
|
|
- /* We don't need to clean the volume manually. All output buffers are
|
|
|
- * initialized with `default_value`. */
|
|
|
- /* priv->clean_vol_kernel = ufo_resource_manager_get_kernel(manager, "lamino_bp_generic.cl", "lamino_clean_vol", &tmp_error); */
|
|
|
-
|
|
|
- if (tmp_error != NULL) {
|
|
|
- g_propagate_error (error, tmp_error);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- ufo_buffer_get_2d_dimensions (input[0], &width, &height);
|
|
|
- priv->params.proj_sx = (int) width;
|
|
|
- priv->params.proj_sy = (int) height;
|
|
|
-
|
|
|
- ////// init recon-parameters which are common for all projs
|
|
|
- // shift volume origin to the box center
|
|
|
- // moved to user scipt part
|
|
|
- // params->vol_ox += (float)vSX/2.0;
|
|
|
- // params->vol_oy += (float)vSY/2.0;
|
|
|
- // params->vol_oz += (float)vSZ/2.0;
|
|
|
- context = (cl_context) ufo_resource_manager_get_context(manager);
|
|
|
- priv->param_mem = clCreateBuffer(context, CL_MEM_READ_ONLY, sizeof(CLParameters), NULL, NULL);
|
|
|
- priv->proj_idx = 0;
|
|
|
-
|
|
|
- output_dims[0][0] = priv->params.vol_sx;
|
|
|
- output_dims[0][1] = priv->params.vol_sy;
|
|
|
- output_dims[0][2] = priv->params.vol_sz;
|
|
|
-
|
|
|
- priv->global_work_size[0] = (size_t) priv->params.vol_sx;
|
|
|
- priv->global_work_size[1] = (size_t) priv->params.vol_sy;
|
|
|
- priv->global_work_size[2] = (size_t) priv->params.vol_sz;
|
|
|
-
|
|
|
- *default_value = 0.0f;
|
|
|
-}
|
|
|
-
|
|
|
-static void
|
|
|
-ufo_filter_lamino_bp_generic_collect(UfoFilterReduce *filter, UfoBuffer *input[], UfoBuffer *output[], GError **error)
|
|
|
-{
|
|
|
- /////////////////// testing OpenCL platform
|
|
|
- // testing_cl_platform();
|
|
|
-
|
|
|
- g_return_if_fail(UFO_IS_FILTER(filter));
|
|
|
-
|
|
|
- UfoFilterLaminoBPGenericPrivate *priv = UFO_FILTER_LAMINO_BP_GENERIC_GET_PRIVATE(filter);
|
|
|
- CLParameters *params = &(priv->params);
|
|
|
-
|
|
|
- cl_command_queue command_queue = (cl_command_queue) ufo_filter_get_command_queue (UFO_FILTER (filter));
|
|
|
- cl_mem output_mem = (cl_mem) ufo_buffer_get_device_array(output[0], command_queue);
|
|
|
- const guint vol_num_dims = 3;
|
|
|
-
|
|
|
- // clean volume before reconstruction on the GPU side
|
|
|
- g_message("prepare the volume");
|
|
|
- /* cl_event event; */
|
|
|
- /* cl_kernel clean_vol_kernel = priv->clean_vol_kernel; */
|
|
|
- /* CHECK_OPENCL_ERROR(clSetKernelArg(clean_vol_kernel, 0, sizeof(cl_mem), (void *) &output_mem)); */
|
|
|
- /* CHECK_OPENCL_ERROR(clEnqueueNDRangeKernel(command_queue, clean_vol_kernel, */
|
|
|
- /* vol_num_dims, NULL, global_work_size, NULL, 0, NULL, &event)); */
|
|
|
- // clFinish(command_queue);
|
|
|
- // whait until kernel finishes its job
|
|
|
- /* ufo_buffer_attach_event(output, event); */
|
|
|
-
|
|
|
- // setup backprojection kernel
|
|
|
- cl_kernel kernel = priv->bp_kernel;
|
|
|
-
|
|
|
- // projection conter
|
|
|
- // allocate memory for parameters
|
|
|
- //
|
|
|
- ////// init recon-parameters which are individual for each projs
|
|
|
- params->alpha = - 3 * G_PI/2 + params->theta;
|
|
|
- params->phi = params->angle_step* ((float) priv->proj_idx);
|
|
|
-
|
|
|
- float sf = sin(params->phi), cf = cos(params->phi), ct=cos(params->alpha),
|
|
|
- st = sin(params->alpha), cg = cos(params->psi), sg=sin(params->psi);
|
|
|
-
|
|
|
- params->mat_0 = cg * cf - sg * st * sf;
|
|
|
- params->mat_1 = -cg * sf - sg * st * cf;
|
|
|
- params->mat_2 = -sg * ct;
|
|
|
- params->mat_3 = sg * cf + cg * st * sf;
|
|
|
- params->mat_4 = -sg * sf + cg * st * cf;
|
|
|
- params->mat_5 = cg * ct;
|
|
|
-
|
|
|
- //g_message("%d %d %d", vSX, vSY, vSZ);
|
|
|
- //g_message("%f %f %f", params->vol_ox, params->vol_oy, params->vol_oz);
|
|
|
- //g_message("%f %f %f %f ", params->theta, params->phi, params->psi, params->alpha);
|
|
|
- //g_message("%f %f %f", params->proj_ox, params->proj_oy, params->angle_step);
|
|
|
-
|
|
|
- // send parameters to GPU
|
|
|
- clEnqueueWriteBuffer(command_queue, priv->param_mem, CL_TRUE, 0, sizeof(CLParameters), params, 0, NULL, NULL);
|
|
|
-
|
|
|
- // copy projection to GPU
|
|
|
- cl_mem input_mem = (cl_mem) ufo_buffer_get_device_array(input[0], command_queue);
|
|
|
- CHECK_OPENCL_ERROR(clSetKernelArg(kernel, 0, sizeof(cl_mem), (void *) &input_mem));
|
|
|
- CHECK_OPENCL_ERROR(clSetKernelArg(kernel, 1, sizeof(cl_mem), (void *) &output_mem));
|
|
|
- CHECK_OPENCL_ERROR(clSetKernelArg(kernel, 2, sizeof(cl_mem), (void *) &priv->param_mem));
|
|
|
- // call backprojection routine
|
|
|
- g_message("processing of %d-th projection", priv->proj_idx);
|
|
|
- CHECK_OPENCL_ERROR(clEnqueueNDRangeKernel(command_queue, kernel,
|
|
|
- vol_num_dims, NULL, priv->global_work_size, NULL, 0, NULL, NULL));
|
|
|
- // clFinish(command_queue);
|
|
|
-
|
|
|
- priv->proj_idx++;
|
|
|
-}
|
|
|
-
|
|
|
-static gboolean
|
|
|
-ufo_filter_lamino_bp_generic_reduce (UfoFilterReduce *filter, UfoBuffer *output[], GError **error)
|
|
|
-{
|
|
|
- UfoFilterLaminoBPGenericPrivate *priv = UFO_FILTER_LAMINO_BP_GENERIC_GET_PRIVATE(filter);
|
|
|
-
|
|
|
- if (priv->finished)
|
|
|
- return FALSE;
|
|
|
-
|
|
|
- // normalize volume after reconstruction
|
|
|
- cl_command_queue cmd_queue = ufo_filter_get_command_queue (UFO_FILTER (filter));
|
|
|
- cl_kernel norm_vol_kernel = priv->norm_vol_kernel;
|
|
|
- cl_mem output_mem = ufo_buffer_get_device_array (output[0], cmd_queue);
|
|
|
- float stepPhi = priv->params.angle_step;
|
|
|
- const guint vol_num_dims = 3;
|
|
|
-
|
|
|
- CHECK_OPENCL_ERROR(clSetKernelArg(norm_vol_kernel, 0, sizeof(cl_mem), (void *) &output_mem));
|
|
|
- CHECK_OPENCL_ERROR(clSetKernelArg(norm_vol_kernel, 1, sizeof(float), &stepPhi));
|
|
|
-
|
|
|
- // call normalization kernel
|
|
|
- g_message("volume post-processing");
|
|
|
- CHECK_OPENCL_ERROR(clEnqueueNDRangeKernel((cl_command_queue) cmd_queue, norm_vol_kernel,
|
|
|
- vol_num_dims, NULL, priv->global_work_size, NULL, 0, NULL, NULL));
|
|
|
-
|
|
|
- priv->finished = TRUE;
|
|
|
-
|
|
|
- return TRUE;
|
|
|
-}
|
|
|
-
|
|
|
-static void
|
|
|
-ufo_filter_lamino_bp_generic_finalize (GObject *object)
|
|
|
-{
|
|
|
- UfoFilterLaminoBPGenericPrivate *priv = UFO_FILTER_LAMINO_BP_GENERIC_GET_PRIVATE (object);
|
|
|
- CHECK_OPENCL_ERROR (clReleaseMemObject (priv->param_mem));
|
|
|
- G_OBJECT_CLASS (ufo_filter_lamino_bp_generic_parent_class)->finalize (object);
|
|
|
-}
|
|
|
-
|
|
|
-static void
|
|
|
-ufo_filter_lamino_bp_generic_set_property(GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
|
|
|
-{
|
|
|
- UfoFilterLaminoBPGeneric *self = UFO_FILTER_LAMINO_BP_GENERIC(object);
|
|
|
- switch (property_id) {
|
|
|
- case PROP_THETA:
|
|
|
- self->priv->params.theta = (float) g_value_get_double(value);
|
|
|
- break;
|
|
|
- case PROP_PSI:
|
|
|
- self->priv->params.psi = (float) g_value_get_double(value);
|
|
|
- break;
|
|
|
- case PROP_ANGLE_STEP:
|
|
|
- self->priv->params.angle_step = (float) g_value_get_double(value);
|
|
|
- break;
|
|
|
- case PROP_VOL_SX:
|
|
|
- self->priv->params.vol_sx = g_value_get_uint(value);
|
|
|
- break;
|
|
|
- case PROP_VOL_SY:
|
|
|
- self->priv->params.vol_sy = g_value_get_uint(value);
|
|
|
- break;
|
|
|
- case PROP_VOL_SZ:
|
|
|
- self->priv->params.vol_sz = g_value_get_uint(value);
|
|
|
- break;
|
|
|
- case PROP_VOL_OX:
|
|
|
- self->priv->params.vol_ox = (float)g_value_get_double(value);
|
|
|
- break;
|
|
|
- case PROP_VOL_OY:
|
|
|
- self->priv->params.vol_oy = (float)g_value_get_double(value);
|
|
|
- break;
|
|
|
- case PROP_VOL_OZ:
|
|
|
- self->priv->params.vol_oz = (float)g_value_get_double(value);
|
|
|
- break;
|
|
|
- case PROP_PROJ_OX:
|
|
|
- self->priv->params.proj_ox = (float)g_value_get_double(value);
|
|
|
- break;
|
|
|
- case PROP_PROJ_OY:
|
|
|
- self->priv->params.proj_oy = (float)g_value_get_double(value);
|
|
|
- break;
|
|
|
- default:
|
|
|
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
|
|
|
- break;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-static void
|
|
|
-ufo_filter_lamino_bp_generic_get_property (GObject *object, guint property_id, GValue *value, GParamSpec*pspec)
|
|
|
-{
|
|
|
- UfoFilterLaminoBPGeneric *self = UFO_FILTER_LAMINO_BP_GENERIC(object);
|
|
|
- switch (property_id) {
|
|
|
- case PROP_THETA:
|
|
|
- g_value_set_double(value, (double) self->priv->params.theta);
|
|
|
- break;
|
|
|
- case PROP_PSI:
|
|
|
- g_value_set_double(value, (double) self->priv->params.psi);
|
|
|
- break;
|
|
|
- case PROP_ANGLE_STEP:
|
|
|
- g_value_set_double(value, (double) self->priv->params.angle_step);
|
|
|
- break;
|
|
|
- case PROP_VOL_SX:
|
|
|
- g_value_set_uint(value, self->priv->params.vol_sx);
|
|
|
- break;
|
|
|
- case PROP_VOL_SY:
|
|
|
- g_value_set_uint(value, self->priv->params.vol_sy);
|
|
|
- break;
|
|
|
- case PROP_VOL_SZ:
|
|
|
- g_value_set_uint(value, self->priv->params.vol_sz);
|
|
|
- break;
|
|
|
- case PROP_VOL_OX:
|
|
|
- g_value_set_double(value, (double)self->priv->params.vol_ox);
|
|
|
- break;
|
|
|
- case PROP_VOL_OY:
|
|
|
- g_value_set_double(value, (double)self->priv->params.vol_oy);
|
|
|
- break;
|
|
|
- case PROP_VOL_OZ:
|
|
|
- g_value_set_double(value, (double)self->priv->params.vol_oz);
|
|
|
- break;
|
|
|
- case PROP_PROJ_OX:
|
|
|
- g_value_set_double(value, (double)self->priv->params.proj_ox);
|
|
|
- break;
|
|
|
- case PROP_PROJ_OY:
|
|
|
- g_value_set_double(value, (double)self->priv->params.proj_oy);
|
|
|
- break;
|
|
|
- default:
|
|
|
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
|
|
|
- break;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-static void
|
|
|
-ufo_filter_lamino_bp_generic_class_init(UfoFilterLaminoBPGenericClass *klass)
|
|
|
-{
|
|
|
- GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
|
|
|
- UfoFilterReduceClass *filter_class = UFO_FILTER_REDUCE_CLASS(klass);
|
|
|
-
|
|
|
- gobject_class->set_property = ufo_filter_lamino_bp_generic_set_property;
|
|
|
- gobject_class->get_property = ufo_filter_lamino_bp_generic_get_property;
|
|
|
- gobject_class->finalize = ufo_filter_lamino_bp_generic_finalize;
|
|
|
- filter_class->initialize = ufo_filter_lamino_bp_generic_initialize;
|
|
|
- filter_class->collect = ufo_filter_lamino_bp_generic_collect;
|
|
|
- filter_class->reduce = ufo_filter_lamino_bp_generic_reduce;
|
|
|
-
|
|
|
- lamino_bp_generic_properties[PROP_THETA] =
|
|
|
- g_param_spec_double("theta",
|
|
|
- "Laminographic angle in radians",
|
|
|
- "Laminographic angle in radians",
|
|
|
- -4.0 * G_PI, +4.0 * G_PI, 0.0,
|
|
|
- G_PARAM_READWRITE);
|
|
|
-
|
|
|
- lamino_bp_generic_properties[PROP_PSI] =
|
|
|
- g_param_spec_double("psi",
|
|
|
- "Axis misalignment angle in radians",
|
|
|
- "Axis misalignment angle in radians",
|
|
|
- -4.0 * G_PI, +4.0 * G_PI, 0.0,
|
|
|
- G_PARAM_READWRITE);
|
|
|
-
|
|
|
- lamino_bp_generic_properties[PROP_ANGLE_STEP] =
|
|
|
- g_param_spec_double("angle-step",
|
|
|
- "Increment of rotation angle phi in radians",
|
|
|
- "Increment of rotation angle phi in radians",
|
|
|
- -4.0 * G_PI, +4.0 * G_PI, 0.0,
|
|
|
- G_PARAM_READWRITE);
|
|
|
-
|
|
|
- lamino_bp_generic_properties[PROP_VOL_SX] =
|
|
|
- g_param_spec_uint("vol-sx",
|
|
|
- "Size of reconstructed volume along the 0X-axis in voxels",
|
|
|
- "Size of reconstructed volume along the 0X-axis in voxels",
|
|
|
- 0, 1024*8, 512,
|
|
|
- G_PARAM_READWRITE);
|
|
|
-
|
|
|
- lamino_bp_generic_properties[PROP_VOL_SY] =
|
|
|
- g_param_spec_uint("vol-sy",
|
|
|
- "Size of reconstructed volume along the 0Y-axis in voxels",
|
|
|
- "Size of reconstructed volume along the 0Y-axis in voxels",
|
|
|
- 0, 1024*8, 512,
|
|
|
- G_PARAM_READWRITE);
|
|
|
-
|
|
|
-
|
|
|
- lamino_bp_generic_properties[PROP_VOL_SZ] =
|
|
|
- g_param_spec_uint("vol-sz",
|
|
|
- "Size of reconstructed volume along the 0Z-axis in voxels",
|
|
|
- "Size of reconstructed volume along the 0Z-axis in voxels",
|
|
|
- 0, 1024*8, 512,
|
|
|
- G_PARAM_READWRITE);
|
|
|
-
|
|
|
- lamino_bp_generic_properties[PROP_VOL_OX] =
|
|
|
- g_param_spec_double("vol-ox",
|
|
|
- "Volume origin offset from the center of a reco-box along the OX-axis in voxels",
|
|
|
- "Volume origin offset from the center of a reco-box along the OX-axis in voxels",
|
|
|
- -1024*8, 1024*8, 0,
|
|
|
- G_PARAM_READWRITE);
|
|
|
-
|
|
|
- lamino_bp_generic_properties[PROP_VOL_OY] =
|
|
|
- g_param_spec_double("vol-oy",
|
|
|
- "Volume origin offset from the center of a reco-box along the OY-axis in voxels",
|
|
|
- "Volume origin offset from the center of a reco-box along the OY-axis in voxels",
|
|
|
- -1024*8, 1024*8, 0,
|
|
|
- G_PARAM_READWRITE);
|
|
|
-
|
|
|
- lamino_bp_generic_properties[PROP_VOL_OZ] =
|
|
|
- g_param_spec_double("vol-oz",
|
|
|
- "Volume origin offset from the center of a reco-box along the OZ-axis in voxels",
|
|
|
- "Volume origin offset from the center of a reco-box along the OZ-axis in voxels",
|
|
|
- -1024*8, 1024*8, 0,
|
|
|
- G_PARAM_READWRITE);
|
|
|
-
|
|
|
- lamino_bp_generic_properties[PROP_PROJ_OX] =
|
|
|
- g_param_spec_double("proj-ox",
|
|
|
- "Projection of the rotation center on the radiograph origin on the OX-axis",
|
|
|
- "Projection of the rotation center on the radiograph origin on the OX-axis",
|
|
|
- -1024*8, 1024*8, 0,
|
|
|
- G_PARAM_READWRITE);
|
|
|
-
|
|
|
- lamino_bp_generic_properties[PROP_PROJ_OY] =
|
|
|
- g_param_spec_double("proj-oy",
|
|
|
- "Projection of the rotation center on the radiograph origin on the OY-axis",
|
|
|
- "Projection of the rotation center on the radiograph origin on the OY-axis",
|
|
|
- -1024*8, 1024*8, 0,
|
|
|
- G_PARAM_READWRITE);
|
|
|
-
|
|
|
- g_object_class_install_property(gobject_class, PROP_THETA, lamino_bp_generic_properties[PROP_THETA]);
|
|
|
- g_object_class_install_property(gobject_class, PROP_PSI, lamino_bp_generic_properties[PROP_PSI]);
|
|
|
- g_object_class_install_property(gobject_class, PROP_ANGLE_STEP, lamino_bp_generic_properties[PROP_ANGLE_STEP]);
|
|
|
- g_object_class_install_property(gobject_class, PROP_VOL_SX, lamino_bp_generic_properties[PROP_VOL_SX]);
|
|
|
- g_object_class_install_property(gobject_class, PROP_VOL_SY, lamino_bp_generic_properties[PROP_VOL_SY]);
|
|
|
- g_object_class_install_property(gobject_class, PROP_VOL_SZ, lamino_bp_generic_properties[PROP_VOL_SZ]);
|
|
|
- g_object_class_install_property(gobject_class, PROP_VOL_OX, lamino_bp_generic_properties[PROP_VOL_OX]);
|
|
|
- g_object_class_install_property(gobject_class, PROP_VOL_OY, lamino_bp_generic_properties[PROP_VOL_OY]);
|
|
|
- g_object_class_install_property(gobject_class, PROP_VOL_OZ, lamino_bp_generic_properties[PROP_VOL_OZ]);
|
|
|
- g_object_class_install_property(gobject_class, PROP_PROJ_OX, lamino_bp_generic_properties[PROP_PROJ_OX]);
|
|
|
- g_object_class_install_property(gobject_class, PROP_PROJ_OY, lamino_bp_generic_properties[PROP_PROJ_OY]);
|
|
|
-
|
|
|
-
|
|
|
- /* install private data */
|
|
|
- g_type_class_add_private(gobject_class, sizeof(UfoFilterLaminoBPGenericPrivate));
|
|
|
-}
|
|
|
-
|
|
|
-static void
|
|
|
-ufo_filter_lamino_bp_generic_init(UfoFilterLaminoBPGeneric *self)
|
|
|
-{
|
|
|
- UfoInputParameter input_params[] = {{2, UFO_FILTER_INFINITE_INPUT}};
|
|
|
- UfoOutputParameter output_params[] = {{3}};
|
|
|
-
|
|
|
- // initialize parameters here
|
|
|
- self->priv = UFO_FILTER_LAMINO_BP_GENERIC_GET_PRIVATE(self);
|
|
|
- self->priv->finished = FALSE;
|
|
|
-
|
|
|
- CLParameters * prms = &(self->priv->params);
|
|
|
- prms->theta = 0.0;
|
|
|
- prms->psi = 0.0;
|
|
|
- prms->angle_step = 0.0;
|
|
|
-
|
|
|
- prms->vol_sx = 512;
|
|
|
- prms->vol_sy = 512;
|
|
|
- prms->vol_sz = 512;
|
|
|
-
|
|
|
- prms->vol_ox = 0.0;
|
|
|
- prms->vol_oy = 0.0;
|
|
|
- prms->vol_oz = 0.0;
|
|
|
-
|
|
|
- prms->proj_ox = 0.0;
|
|
|
- prms->proj_oy = 0.0;
|
|
|
-
|
|
|
- ufo_filter_register_inputs (UFO_FILTER (self), 1, input_params);
|
|
|
- ufo_filter_register_outputs (UFO_FILTER (self), 1, output_params);
|
|
|
-}
|
|
|
-
|
|
|
-G_MODULE_EXPORT UfoFilter *
|
|
|
-ufo_filter_plugin_new(void)
|
|
|
-{
|
|
|
- return g_object_new(UFO_TYPE_FILTER_LAMINO_BP_GENERIC, NULL);
|
|
|
-}
|
|
|
-
|