SIRF  3.4.0
cReg.h
1 /*
2 SyneRBI Synergistic Image Reconstruction Framework (SIRF)
3 Copyright 2015 - 2017 Rutherford Appleton Laboratory STFC
4 Copyright 2017 - 2020 University College London
5 
6 This is software developed for the Collaborative Computational
7 Project in Synergistic Reconstruction for Biomedical Imaging (formerly CCP PETMR)
8 (http://www.ccpsynerbi.ac.uk/).
9 
10 Licensed under the Apache License, Version 2.0 (the "License");
11 you may not use this file except in compliance with the License.
12 You may obtain a copy of the License at
13 http://www.apache.org/licenses/LICENSE-2.0
14 Unless required by applicable law or agreed to in writing, software
15 distributed under the License is distributed on an "AS IS" BASIS,
16 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 See the License for the specific language governing permissions and
18 limitations under the License.
19 */
20 
21 #ifndef cREG_INTERFACE
22 #define cREG_INTERFACE
23 
24 #ifndef CREG_FOR_MATLAB
25 #define PTR_INT size_t
26 #define PTR_FLOAT size_t
27 #define PTR_DOUBLE size_t
28 
29 extern "C" {
30 #else
31 #define PTR_INT int*
32 #define PTR_FLOAT float*
33 #define PTR_DOUBLE double*
34 #endif
35 
36  // Common Reg Object methods
37  void* cReg_newObject(const char* name);
38  void* cReg_objectFromFile(const char* name, const char* filename);
39  void* setParameter(void* ptr, const char* obj, const char* name, const void* value);
40  void* parameter(const void* ptr, const char* obj, const char* name);
41 
42  // NiftiImageData
43  void* cReg_NiftiImageData_get_headers(const void *handle_vector_ptr);
44  void* cReg_NiftiImageData_print_headers(const void *handle_vector_ptr);
45  void* cReg_NiftiImageData_write(const void* ptr, const char* filename, const int datatype);
46  void* cReg_NiftiImageData_fill(const void* ptr, const float val);
47  void* cReg_NiftiImageData_fill_arr(const void* ptr, PTR_FLOAT val);
48  void* cReg_NiftiImageData_deep_copy(const void* copy_ptr, const void *orig_ptr);
49  void* cReg_NiftiImageData_get_dimensions(const void* ptr, PTR_INT ptr_dim);
50  void* cReg_NiftiImageData_get_voxel_sizes(const void* ptr, PTR_FLOAT ptr_out);
51  void* cReg_NiftiImageData_as_array(const void* ptr, PTR_FLOAT ptr_data);
52  void* cReg_NiftiImageData_maths_im(const void *res_ptr, const void* im1_ptr, const void* im2_ptr, const int maths_type);
53  void* cReg_NiftiImageData_maths_num(const void *res_ptr, const void* im1_ptr, const float val, const int maths_type);
54  void* cReg_NiftiImageData_equal(const void* im1_ptr, const void* im2_ptr);
55  void* cReg_NiftiImageData_norm(const void* im1_ptr, const void* im2_ptr);
56  void* cReg_NiftiImageData_get_original_datatype(const void* im_ptr);
57  void* cReg_NiftiImageData_crop(const void* im_ptr, PTR_INT min_index_ptr, PTR_INT max_index_ptr);
58  void* cReg_NiftiImageData_pad(const void* im_ptr, PTR_INT min_index_ptr, PTR_INT max_index_ptr, const float val);
59  void* cReg_NiftiImageData_set_voxel_spacing(const void* im_ptr, const float x, const float y, const float z, const int interpolation_order);
60  void* cReg_NiftiImageData_normalise_zero_and_one(const void* im_ptr);
61  void* cReg_NiftiImageData_standardise(const void* im_ptr);
62  void* cReg_NiftiImageData_get_inner_product(const void* im1_ptr, const void* im2_ptr);
65  void* cReg_NiftiImageData_from_SIRFImageData(void* ptr, const int is_3D);
66  void* cReg_NiftiImageData_from_complex_ImageData_real_component(void* in_ptr);
67  void* cReg_NiftiImageData_from_complex_ImageData_imag_component(void* in_ptr);
68  void* cReg_NiftiImageData_are_equal_to_given_accuracy(void* im1_ptr, void* im2_ptr, const float accuracy);
69  void* cReg_NiftiImageData_kernel_convolution(void* im_ptr, const float sigma, const int type);
70 
71  // NiftiImageData3D
72 
73  // NiftiImageData3DTensor
74  void* cReg_NiftiImageData3DTensor_write_split_xyz_components(const void* ptr, const char* filename, const int datatype);
75  void* cReg_NiftiImageData3DTensor_create_from_3D_image(const void *ptr, const void* obj);
76  void* cReg_NiftiImageData3DTensor_construct_from_3_components(const char* obj, const void *x_ptr, const void *y_ptr, const void *z_ptr);
77  void* cReg_NiftiImageData3DTensor_flip_component(const void *ptr, const int dim);
78 
79  // NiftiImageData3DDeformation
80  void* cReg_NiftiImageData3DDeformation_compose_single_deformation(const void* im, const char* types, const void* trans_vector_ptr);
81  void* cReg_NiftiImageData3DDeformation_create_from_disp(const void* disp_ptr);
82  void* cReg_NiftiImageData3DDeformation_get_inverse(const void* def_ptr, const void* floating_ptr);
83 
84  // NiftiImageData3DDisplacement
85  void* cReg_NiftiImageData3DDisplacement_create_from_def(const void* def_ptr);
86 
87  // Registration
88  void* cReg_Registration_process(void* ptr);
89  void* cReg_Registration_get_deformation_displacement_image(const void* ptr, const char *transform_type, const int idx);
90  void* cReg_Registration_add_floating(const void* ptr, const void *im_ptr);
91  void* cReg_Registration_clear_floatings(const void* ptr);
92  void* cReg_Registration_get_output(const void* ptr,const int idx);
93  void* cReg_Registration_set_reference_image_filename(const void* ptr, const char* filename);
94  void* cReg_Registration_set_floating_image_filename(const void* ptr, const char* filename);
95  void* cReg_Registration_add_floating_image_filename(const void* ptr, const char* filename);
96 
97  // NiftyReg-based registration
98  void* cReg_NiftyRegistration_set_parameter(const void* ptr, const char* par, const char* arg1, const char* arg2);
99  void* cReg_NiftyRegistration_print_all_wrapped_methods(const char* name);
100 
101  // Aladin methods
102  void* cReg_NiftyAladin_get_TM(const void* ptr, const char* dir);
103 
104  // SPM methods
105  void* cReg_SPMRegistration_get_TM(const void* ptr, const char* dir, const int idx);
106 
107  // NiftyResampler
108  void* cReg_NiftyResampler_add_transformation(void* self, const void* trans, const char* type);
109  void* cReg_NiftyResampler_clear_transformations(void* self);
110  void* cReg_NiftyResampler_process(void* ptr);
111  void* cReg_NiftyResampler_forward(const void *output_ptr, const void * const input_ptr, const void *resampler_ptr);
112  void* cReg_NiftyResampler_adjoint(const void *output_ptr, const void * const input_ptr, const void *resampler_ptr);
113 
114  // ImageWeightedMean
115  void* cReg_ImageWeightedMean_add_image(void* ptr, const void* obj, const float weight);
116  void* cReg_ImageWeightedMean_add_image_filename(void* ptr, const char* filename, const float weight);
117  void* cReg_ImageWeightedMean_process(void* ptr);
118 
119  // Transformation
120  void* cReg_Transformation_get_as_deformation_field(const void* ptr, const char* name, const void* ref);
121 
122  // AffineTransformation
123  void* cReg_AffineTransformation_construct_from_TM(PTR_FLOAT ptr_TM);
124  void* cReg_AffineTransformation_construct_from_trans_and_quaternion(PTR_FLOAT trans_ptr, const void* quat_ptr);
125  void* cReg_AffineTransformation_construct_from_trans_and_euler(PTR_FLOAT trans_ptr, PTR_FLOAT euler_ptr);
126  void* cReg_AffineTransformation_deep_copy(const void* ptr);
127  void* cReg_AffineTransformation_write(const void* ptr, const char* filename);
128  void* cReg_AffineTransformation_as_array(const void* ptr, PTR_FLOAT ptr_TM);
129  void* cReg_AffineTransformation_get_identity();
130  void* cReg_AffineTransformation_get_inverse(const void* ptr);
131  void* cReg_AffineTransformation_get_Euler_angles(const void* ptr, PTR_FLOAT Euler);
132  void* cReg_AffineTransformation_get_quaternion(const void* ptr);
133  void* cReg_AffineTransformation_mul(const void* mat1_ptr, const void* mat2_ptr);
134  void* cReg_AffineTransformation_equal(const void* mat1_ptr, const void* mat2_ptr);
135  void* cReg_AffineTransformation_get_average(const void *handle_vector_ptr);
136 
137  // Quaternion
138  void* cReg_Quaternion_construct_from_array(PTR_FLOAT arr);
139  void* cReg_Quaternion_construct_from_AffineTransformation(const void* ptr);
140  void* cReg_Quaternion_get_average(const void *handle_vector_ptr);
141  void* cReg_Quaternion_as_array(const void* ptr, PTR_FLOAT arr);
142 
143 #ifndef CREG_FOR_MATLAB
144 }
145 #endif
146 
147 #endif