nabu 2024.1.10__py3-none-any.whl → 2024.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. nabu/__init__.py +1 -1
  2. nabu/app/bootstrap.py +2 -3
  3. nabu/app/cast_volume.py +4 -2
  4. nabu/app/cli_configs.py +5 -0
  5. nabu/app/composite_cor.py +1 -1
  6. nabu/app/create_distortion_map_from_poly.py +5 -6
  7. nabu/app/diag_to_pix.py +7 -19
  8. nabu/app/diag_to_rot.py +14 -29
  9. nabu/app/double_flatfield.py +32 -44
  10. nabu/app/parse_reconstruction_log.py +3 -0
  11. nabu/app/reconstruct.py +53 -15
  12. nabu/app/reconstruct_helical.py +2 -2
  13. nabu/app/stitching.py +27 -13
  14. nabu/app/tests/__init__.py +0 -0
  15. nabu/app/tests/test_reduce_dark_flat.py +4 -1
  16. nabu/cuda/kernel.py +11 -2
  17. nabu/cuda/processing.py +2 -2
  18. nabu/cuda/src/cone.cu +77 -0
  19. nabu/cuda/src/hierarchical_backproj.cu +271 -0
  20. nabu/cuda/utils.py +0 -6
  21. nabu/estimation/alignment.py +5 -19
  22. nabu/estimation/cor.py +173 -599
  23. nabu/estimation/cor_sino.py +356 -26
  24. nabu/estimation/focus.py +63 -11
  25. nabu/estimation/tests/test_cor.py +124 -58
  26. nabu/estimation/tests/test_focus.py +6 -6
  27. nabu/estimation/tilt.py +2 -1
  28. nabu/estimation/utils.py +5 -33
  29. nabu/io/__init__.py +1 -1
  30. nabu/io/cast_volume.py +1 -1
  31. nabu/io/reader.py +416 -21
  32. nabu/io/tests/test_readers.py +422 -0
  33. nabu/io/tests/test_writers.py +1 -102
  34. nabu/io/writer.py +4 -433
  35. nabu/opencl/kernel.py +14 -3
  36. nabu/opencl/processing.py +8 -0
  37. nabu/pipeline/config_validators.py +5 -2
  38. nabu/pipeline/datadump.py +12 -5
  39. nabu/pipeline/estimators.py +162 -188
  40. nabu/pipeline/fullfield/chunked.py +168 -92
  41. nabu/pipeline/fullfield/chunked_cuda.py +7 -3
  42. nabu/pipeline/fullfield/computations.py +2 -7
  43. nabu/pipeline/fullfield/dataset_validator.py +0 -4
  44. nabu/pipeline/fullfield/nabu_config.py +37 -13
  45. nabu/pipeline/fullfield/processconfig.py +22 -13
  46. nabu/pipeline/fullfield/reconstruction.py +13 -9
  47. nabu/pipeline/helical/helical_chunked_regridded.py +1 -1
  48. nabu/pipeline/helical/helical_chunked_regridded_cuda.py +1 -0
  49. nabu/pipeline/helical/helical_reconstruction.py +1 -1
  50. nabu/pipeline/params.py +21 -1
  51. nabu/pipeline/processconfig.py +1 -12
  52. nabu/pipeline/reader.py +146 -0
  53. nabu/pipeline/tests/test_estimators.py +44 -72
  54. nabu/pipeline/utils.py +4 -2
  55. nabu/pipeline/writer.py +10 -2
  56. nabu/preproc/ccd_cuda.py +1 -1
  57. nabu/preproc/ctf.py +14 -7
  58. nabu/preproc/ctf_cuda.py +2 -3
  59. nabu/preproc/double_flatfield.py +5 -12
  60. nabu/preproc/double_flatfield_cuda.py +2 -2
  61. nabu/preproc/flatfield.py +5 -1
  62. nabu/preproc/flatfield_cuda.py +5 -1
  63. nabu/preproc/phase.py +24 -73
  64. nabu/preproc/phase_cuda.py +5 -8
  65. nabu/preproc/tests/test_ctf.py +11 -7
  66. nabu/preproc/tests/test_flatfield.py +67 -122
  67. nabu/preproc/tests/test_paganin.py +54 -30
  68. nabu/processing/azim.py +206 -0
  69. nabu/processing/convolution_cuda.py +1 -1
  70. nabu/processing/fft_cuda.py +15 -17
  71. nabu/processing/histogram.py +2 -0
  72. nabu/processing/histogram_cuda.py +2 -1
  73. nabu/processing/kernel_base.py +3 -0
  74. nabu/processing/muladd_cuda.py +1 -0
  75. nabu/processing/padding_opencl.py +1 -1
  76. nabu/processing/roll_opencl.py +1 -0
  77. nabu/processing/rotation_cuda.py +2 -2
  78. nabu/processing/tests/test_fft.py +17 -10
  79. nabu/processing/unsharp_cuda.py +1 -1
  80. nabu/reconstruction/cone.py +104 -40
  81. nabu/reconstruction/fbp.py +3 -0
  82. nabu/reconstruction/fbp_base.py +7 -2
  83. nabu/reconstruction/filtering.py +20 -7
  84. nabu/reconstruction/filtering_cuda.py +7 -1
  85. nabu/reconstruction/hbp.py +424 -0
  86. nabu/reconstruction/mlem.py +99 -0
  87. nabu/reconstruction/reconstructor.py +2 -0
  88. nabu/reconstruction/rings_cuda.py +19 -19
  89. nabu/reconstruction/sinogram_cuda.py +1 -0
  90. nabu/reconstruction/sinogram_opencl.py +3 -1
  91. nabu/reconstruction/tests/test_cone.py +10 -5
  92. nabu/reconstruction/tests/test_deringer.py +7 -6
  93. nabu/reconstruction/tests/test_fbp.py +124 -10
  94. nabu/reconstruction/tests/test_filtering.py +13 -11
  95. nabu/reconstruction/tests/test_halftomo.py +30 -4
  96. nabu/reconstruction/tests/test_mlem.py +91 -0
  97. nabu/reconstruction/tests/test_reconstructor.py +8 -3
  98. nabu/resources/dataset_analyzer.py +142 -92
  99. nabu/resources/gpu.py +1 -0
  100. nabu/resources/nxflatfield.py +134 -125
  101. nabu/resources/templates/id16a_fluo.conf +42 -0
  102. nabu/resources/tests/test_extract.py +10 -0
  103. nabu/resources/tests/test_nxflatfield.py +2 -2
  104. nabu/stitching/alignment.py +80 -24
  105. nabu/stitching/config.py +105 -68
  106. nabu/stitching/definitions.py +1 -0
  107. nabu/stitching/frame_composition.py +68 -60
  108. nabu/stitching/overlap.py +91 -51
  109. nabu/stitching/single_axis_stitching.py +32 -0
  110. nabu/stitching/slurm_utils.py +6 -6
  111. nabu/stitching/stitcher/__init__.py +0 -0
  112. nabu/stitching/stitcher/base.py +124 -0
  113. nabu/stitching/stitcher/dumper/__init__.py +3 -0
  114. nabu/stitching/stitcher/dumper/base.py +94 -0
  115. nabu/stitching/stitcher/dumper/postprocessing.py +356 -0
  116. nabu/stitching/stitcher/dumper/preprocessing.py +60 -0
  117. nabu/stitching/stitcher/post_processing.py +555 -0
  118. nabu/stitching/stitcher/pre_processing.py +1068 -0
  119. nabu/stitching/stitcher/single_axis.py +484 -0
  120. nabu/stitching/stitcher/stitcher.py +0 -0
  121. nabu/stitching/stitcher/y_stitcher.py +13 -0
  122. nabu/stitching/stitcher/z_stitcher.py +45 -0
  123. nabu/stitching/stitcher_2D.py +278 -0
  124. nabu/stitching/tests/test_config.py +12 -37
  125. nabu/stitching/tests/test_frame_composition.py +33 -59
  126. nabu/stitching/tests/test_overlap.py +149 -7
  127. nabu/stitching/tests/test_utils.py +1 -1
  128. nabu/stitching/tests/test_y_preprocessing_stitching.py +132 -0
  129. nabu/stitching/tests/{test_z_stitching.py → test_z_postprocessing_stitching.py} +167 -561
  130. nabu/stitching/tests/test_z_preprocessing_stitching.py +431 -0
  131. nabu/stitching/utils/__init__.py +1 -0
  132. nabu/stitching/utils/post_processing.py +281 -0
  133. nabu/stitching/utils/tests/test_post-processing.py +21 -0
  134. nabu/stitching/{utils.py → utils/utils.py} +79 -52
  135. nabu/stitching/y_stitching.py +27 -0
  136. nabu/stitching/z_stitching.py +32 -2281
  137. nabu/testutils.py +1 -152
  138. nabu/thirdparty/tomocupy_remove_stripe.py +43 -9
  139. nabu/utils.py +158 -61
  140. {nabu-2024.1.10.dist-info → nabu-2024.2.0.dist-info}/METADATA +24 -17
  141. {nabu-2024.1.10.dist-info → nabu-2024.2.0.dist-info}/RECORD +145 -121
  142. {nabu-2024.1.10.dist-info → nabu-2024.2.0.dist-info}/WHEEL +1 -1
  143. nabu/io/tiffwriter_zmm.py +0 -99
  144. nabu/pipeline/fallback_utils.py +0 -149
  145. nabu/pipeline/helical/tests/test_accumulator.py +0 -158
  146. nabu/pipeline/helical/tests/test_pipeline_elements_full.py +0 -355
  147. nabu/pipeline/helical/tests/test_strategy.py +0 -61
  148. nabu/pipeline/helical/utils.py +0 -51
  149. nabu/pipeline/tests/test_chunk_reader.py +0 -74
  150. {nabu-2024.1.10.dist-info → nabu-2024.2.0.dist-info}/LICENSE +0 -0
  151. {nabu-2024.1.10.dist-info → nabu-2024.2.0.dist-info}/entry_points.txt +0 -0
  152. {nabu-2024.1.10.dist-info → nabu-2024.2.0.dist-info}/top_level.txt +0 -0
nabu/cuda/src/cone.cu ADDED
@@ -0,0 +1,77 @@
1
+ /*
2
+ -----------------------------------------------------------------------
3
+ Copyright: 2010-2022, imec Vision Lab, University of Antwerp
4
+ 2014-2022, CWI, Amsterdam
5
+
6
+ Contact: astra@astra-toolbox.com
7
+ Website: http://www.astra-toolbox.com/
8
+
9
+ This file is part of the ASTRA Toolbox.
10
+
11
+
12
+ The ASTRA Toolbox is free software: you can redistribute it and/or modify
13
+ it under the terms of the GNU General Public License as published by
14
+ the Free Software Foundation, either version 3 of the License, or
15
+ (at your option) any later version.
16
+
17
+ The ASTRA Toolbox is distributed in the hope that it will be useful,
18
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ GNU General Public License for more details.
21
+
22
+ You should have received a copy of the GNU General Public License
23
+ along with the ASTRA Toolbox. If not, see <http://www.gnu.org/licenses/>.
24
+
25
+ -----------------------------------------------------------------------
26
+ */
27
+
28
+
29
+ static const unsigned int g_anglesPerWeightBlock = 16;
30
+ static const unsigned int g_detBlockU = 32;
31
+ static const unsigned int g_detBlockV = 32;
32
+
33
+
34
+ __global__ void devFDK_preweight(void* D_projData, unsigned int projPitch, unsigned int startAngle, unsigned int endAngle, float fSrcOrigin, float fDetOrigin, float fZShift, float fDetUSize, float fDetVSize, unsigned int iProjAngles, unsigned int iProjU, unsigned int iProjV)
35
+ {
36
+ float* projData = (float*)D_projData;
37
+ int angle = startAngle + blockIdx.y * g_anglesPerWeightBlock + threadIdx.y;
38
+ if (angle >= endAngle)
39
+ return;
40
+
41
+ const int detectorU = (blockIdx.x%((iProjU+g_detBlockU-1)/g_detBlockU)) * g_detBlockU + threadIdx.x;
42
+ const int startDetectorV = (blockIdx.x/((iProjU+g_detBlockU-1)/g_detBlockU)) * g_detBlockV;
43
+ int endDetectorV = startDetectorV + g_detBlockV;
44
+ if (endDetectorV > iProjV)
45
+ endDetectorV = iProjV;
46
+
47
+ // We need the length of the central ray and the length of the ray(s) to
48
+ // our detector pixel(s).
49
+
50
+ const float fCentralRayLength = fSrcOrigin + fDetOrigin;
51
+
52
+ const float fU = (detectorU - 0.5f*iProjU + 0.5f) * fDetUSize;
53
+
54
+ const float fT = fCentralRayLength * fCentralRayLength + fU * fU;
55
+
56
+ float fV = (startDetectorV - 0.5f*iProjV + 0.5f) * fDetVSize + fZShift;
57
+
58
+ // Contributions to the weighting factors:
59
+ // fCentralRayLength / fRayLength : the main FDK preweighting factor
60
+ // fSrcOrigin / (fDetUSize * fCentralRayLength)
61
+ // : to adjust the filter to the det width
62
+ // pi / (2 * iProjAngles) : scaling of the integral over angles
63
+
64
+ const float fW2 = fCentralRayLength / (fDetUSize * fSrcOrigin);
65
+ const float fW = fCentralRayLength * fW2 * (M_PI / 2.0f) / (float)iProjAngles;
66
+
67
+ for (int detectorV = startDetectorV; detectorV < endDetectorV; ++detectorV)
68
+ {
69
+ const float fRayLength = sqrtf(fT + fV * fV);
70
+
71
+ const float fWeight = fW / fRayLength;
72
+
73
+ projData[(detectorV*iProjAngles+angle)*projPitch+detectorU] *= fWeight;
74
+
75
+ fV += fDetVSize;
76
+ }
77
+ }
@@ -0,0 +1,271 @@
1
+ /*
2
+ """
3
+ Algorithm by Jonas Graetz.
4
+ Submitted for publication.
5
+
6
+ Please cite :
7
+ reference to be added...
8
+
9
+ """
10
+ */
11
+
12
+ __device__ float3 operator-(const float3& a, const float3& b)
13
+ {
14
+ return make_float3(a.x - b.x, a.y - b.y, a.z - b.z);
15
+ }
16
+ __device__ float dot(const float3& a, const float3& b)
17
+ {
18
+ return a.x * b.x + a.y * b.y + a.z * b.z;
19
+ }
20
+ __device__ float dot4(const float4& a, const float4& b)
21
+ {
22
+ return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
23
+ }
24
+
25
+ inline __device__ int is_in_circle(float x, float y, float center_x, float center_y, int radius2)
26
+ {
27
+ return (((x - center_x) * (x - center_x) + (y - center_y) * (y - center_y)) <=
28
+ radius2);
29
+ }
30
+ __global__ void clip_outer_circle(float* slice, int ny, int nx)
31
+ {
32
+ const int tiy = threadIdx.y;
33
+ const int bidy = blockIdx.y;
34
+ int iy = (bidy * blockDim.y + tiy);
35
+
36
+ const int tix = threadIdx.x;
37
+ const int bidx = blockIdx.x;
38
+ int ix = (bidx * blockDim.x + tix);
39
+
40
+ float center_x = (nx - 1) / 2.0f, center_y = (ny - 1) / 2.0f;
41
+ int radius2 = min(nx / 2, ny / 2);
42
+ radius2 *= radius2;
43
+
44
+ if (ix < nx && iy < ny) {
45
+ if (!is_in_circle(ix, iy, center_x, center_y, radius2)) {
46
+ slice[iy * nx + ix] = 0.0f;
47
+ }
48
+ }
49
+ }
50
+
51
+ __device__ float bilinear(float* data, int width, int height, float x, float y)
52
+ {
53
+ int ix0 = (int)floorf(x);
54
+ int iy0 = (int)floorf(y);
55
+ float fx = x - ix0;
56
+ float fy = y - iy0;
57
+
58
+ int ix1 = ix0 + 1;
59
+ int iy1 = iy0 + 1;
60
+
61
+ ix0 = min(width - 1, max(0, ix0));
62
+ ix1 = min(width - 1, max(0, ix1));
63
+ iy0 = min(height - 1, max(0, iy0));
64
+ iy1 = min(height - 1, max(0, iy1));
65
+
66
+ float v00 = data[iy0 * width + ix0];
67
+ float v01 = data[iy0 * width + ix1];
68
+ float v10 = data[iy1 * width + ix0];
69
+ float v11 = data[iy1 * width + ix1];
70
+
71
+ return (v00 * (1 - fx) + v01 * fx) * (1 - fy) +
72
+ (v10 * (1 - fx) + v11 * fx) * fy;
73
+ }
74
+
75
+ __global__ void backprojector(float* bpsetups,
76
+ float* gridTransforms,
77
+ int reductionFactor,
78
+ int grid_width,
79
+ int grid_height,
80
+ int ngrids,
81
+ float* grids,
82
+ int sino_width,
83
+ int sino_nangles,
84
+ float scale_factor,
85
+ float* sinogram,
86
+ int projectionOffset)
87
+ {
88
+ const int tix = threadIdx.x;
89
+ const int bidx = blockIdx.x;
90
+ int ix = (bidx * blockDim.x + tix);
91
+
92
+ const int tiy = threadIdx.y;
93
+ const int bidy = blockIdx.y;
94
+ int iy = (bidy * blockDim.y + tiy);
95
+
96
+ const int tiz = threadIdx.z;
97
+ const int bidz = blockIdx.z;
98
+ int iz = (bidz * blockDim.z + tiz);
99
+
100
+ const int grid_px = ix;
101
+ const int grid_py = iy;
102
+ const int grid_i = iz;
103
+
104
+ size_t grid_pos =
105
+ (grid_i * ((size_t)grid_height) + grid_px) * ((size_t)grid_width) + grid_py;
106
+
107
+ // if( grid_pos==0) grids[grid_pos] = grid_height;
108
+ // if( grid_pos==1) grids[grid_pos] = grid_width;
109
+ // if( grid_pos==2) grids[grid_pos] = ngrids;
110
+ // if( grid_pos==3) printf(" CU %d sino_nangles %d sino_width %d\n",
111
+ // grid_height* grid_width* ngrids , sino_nangles, sino_width ) ;
112
+
113
+ if ((grid_px < grid_height) && (grid_py < grid_width) && (grid_i < ngrids)) {
114
+ const float3 grid_t1 = make_float3(gridTransforms[grid_i * 6 + 0],
115
+ gridTransforms[grid_i * 6 + 1],
116
+ gridTransforms[grid_i * 6 + 2]);
117
+ const float3 grid_t2 = make_float3(gridTransforms[grid_i * 6 + 3 + 0],
118
+ gridTransforms[grid_i * 6 + 3 + 1],
119
+ gridTransforms[grid_i * 6 + 3 + 2]);
120
+
121
+ const float4 final_p =
122
+ make_float4(0.f,
123
+ grid_t1.x * grid_px + grid_t1.y * grid_py + grid_t1.z,
124
+ grid_t2.x * grid_px + grid_t2.y * grid_py + grid_t2.z,
125
+ 1.f);
126
+
127
+ float val = 0.f;
128
+ int setup_i = 0;
129
+ for (int k = 0; k < reductionFactor; k++) {
130
+ setup_i = grid_i * reductionFactor + k + projectionOffset;
131
+ if (setup_i < sino_nangles) // although the sinogram itself could be
132
+ // read beyond extent, this is not true
133
+ // for the setups-array!
134
+ {
135
+ int bi = setup_i * 4 * 3;
136
+ const float4 ph = make_float4(bpsetups[bi + 0],
137
+ bpsetups[bi + 1],
138
+ bpsetups[bi + 2],
139
+ bpsetups[bi + 3]);
140
+ bi += 8;
141
+ const float4 pw = make_float4(bpsetups[bi + 0],
142
+ bpsetups[bi + 1],
143
+ bpsetups[bi + 2],
144
+ bpsetups[bi + 3]);
145
+
146
+ const float n = 1.f / dot4(final_p, pw);
147
+ const float h = dot4(final_p, ph) * n;
148
+
149
+ int ih0 = (int)floorf(h);
150
+ int ih1 = ih0 + 1;
151
+ float fh = h - ih0;
152
+
153
+ size_t sino_pos = setup_i * ((size_t)sino_width) + ih0;
154
+
155
+ if (ih0 >= 0 && ih0 < sino_width) {
156
+ // if(sino_pos>= sino_width*sino_nangles) printf(" problema
157
+ // 1\n");
158
+ val += sinogram[sino_pos] * (1 - fh);
159
+ }
160
+ if (ih1 >= 0 && ih1 < sino_width) {
161
+ // if(sino_pos+1>= sino_width*sino_nangles) printf(" problema
162
+ // 2 h ih0, ih1, sino_width , sino_nangles, setup_i %e %e %e
163
+ // %d %d %d %d %d\n", ray.x, ray.y, ray.z, ih0, ih1,
164
+ // sino_width , sino_nangles, setup_i);
165
+ val += sinogram[sino_pos + 1] * fh;
166
+ }
167
+ }
168
+ }
169
+ size_t grid_pos =
170
+ (grid_i * ((size_t)grid_height) + grid_px) * ((size_t)grid_width) +
171
+ grid_py;
172
+ grids[grid_pos] = scale_factor * val;
173
+ }
174
+ }
175
+
176
+ __global__ void aggregator(int do_sum,
177
+ const float* newGridTransforms,
178
+ const float* prevGridInverseTransforms,
179
+ const int reductionFactor,
180
+ int new_grid_width,
181
+ int new_grid_height,
182
+ int new_ngrids,
183
+ float* newGrids,
184
+ int prev_grid_width,
185
+ int prev_grid_height,
186
+ int prev_ngrids,
187
+ float* prevGrids)
188
+ {
189
+ const int tix = threadIdx.x;
190
+ const int bidx = blockIdx.x;
191
+ int ix = (bidx * blockDim.x + tix);
192
+
193
+ const int tiy = threadIdx.y;
194
+ const int bidy = blockIdx.y;
195
+ int iy = (bidy * blockDim.y + tiy);
196
+
197
+ const int tiz = threadIdx.z;
198
+ const int bidz = blockIdx.z;
199
+ int iz = (bidz * blockDim.z + tiz);
200
+
201
+ const int new_grid_px = ix;
202
+ const int new_grid_py = iy;
203
+ const int new_grid_i = iz;
204
+
205
+ if ((new_grid_px < new_grid_height) && (new_grid_py < new_grid_width) &&
206
+ (new_grid_i < new_ngrids)) {
207
+ const float3 new_grid_t1 =
208
+ make_float3(newGridTransforms[new_grid_i * 6 + 0],
209
+ newGridTransforms[new_grid_i * 6 + 1],
210
+ newGridTransforms[new_grid_i * 6 + 2]);
211
+
212
+ const float3 new_grid_t2 =
213
+ make_float3(newGridTransforms[new_grid_i * 6 + 3 + 0],
214
+ newGridTransforms[new_grid_i * 6 + 3 + 1],
215
+ newGridTransforms[new_grid_i * 6 + 3 + 2]);
216
+
217
+ const float3 final_p = make_float3(
218
+ new_grid_t1.x * new_grid_px + new_grid_t1.y * new_grid_py + new_grid_t1.z,
219
+ new_grid_t2.x * new_grid_px + new_grid_t2.y * new_grid_py + new_grid_t2.z,
220
+ 1.f);
221
+
222
+ if (isnan(new_grid_t1.x)) {
223
+ return; // inband-signaling for unused grids that shall be skipped
224
+ }
225
+
226
+ float val = 0.f;
227
+ int prev_grid_i;
228
+ float3 prev_grid_ti1, prev_grid_ti2;
229
+ float3 prev_p_tex;
230
+ for (int k = 0; k < reductionFactor; k++) {
231
+ prev_grid_i = new_grid_i * reductionFactor + k;
232
+ if (prev_grid_i < prev_ngrids) {
233
+ prev_grid_ti1 =
234
+ make_float3(prevGridInverseTransforms[prev_grid_i * 6 + 0],
235
+ prevGridInverseTransforms[prev_grid_i * 6 + 1],
236
+ prevGridInverseTransforms[prev_grid_i * 6 + 2]);
237
+
238
+ prev_grid_ti2 =
239
+ make_float3(prevGridInverseTransforms[prev_grid_i * 6 + 3 + 0],
240
+ prevGridInverseTransforms[prev_grid_i * 6 + 3 + 1],
241
+ prevGridInverseTransforms[prev_grid_i * 6 + 3 + 2]);
242
+
243
+ if (isnan(prev_grid_ti1.x)) {
244
+ break;
245
+ }
246
+
247
+ prev_p_tex = make_float3(dot(prev_grid_ti2, final_p),
248
+ dot(prev_grid_ti1, final_p),
249
+ (float)prev_grid_i);
250
+
251
+ val += bilinear(prevGrids + prev_grid_i * ((size_t)prev_grid_height) *
252
+ ((size_t)prev_grid_width),
253
+ prev_grid_width,
254
+ prev_grid_height,
255
+ prev_p_tex.x,
256
+ prev_p_tex.y);
257
+ }
258
+ }
259
+
260
+ size_t new_grid_pos =
261
+ (new_grid_i * ((size_t)new_grid_height) + new_grid_px) *
262
+ ((size_t)new_grid_width) +
263
+ new_grid_py;
264
+
265
+ if (do_sum == 1) {
266
+ newGrids[new_grid_pos] += val;
267
+ } else {
268
+ newGrids[new_grid_pos] = val;
269
+ }
270
+ }
271
+ }
nabu/cuda/utils.py CHANGED
@@ -18,12 +18,6 @@ try:
18
18
  except ImportError as err:
19
19
  __has_pycuda__ = False
20
20
  __pycuda_error_msg__ = str(err)
21
- try:
22
- import skcuda
23
-
24
- __has_cufft__ = True
25
- except ImportError:
26
- __has_cufft__ = False
27
21
 
28
22
  try:
29
23
  import cupy
@@ -1,6 +1,7 @@
1
1
  # import math
2
2
  import logging
3
3
  import numpy as np
4
+ from tqdm import tqdm
4
5
  from numpy.polynomial.polynomial import Polynomial
5
6
  from silx.math.medianfilter import medfilt2d
6
7
  import scipy.fft # pylint: disable=E0611
@@ -17,18 +18,11 @@ except ImportError:
17
18
  plt = None
18
19
  __have_matplotlib__ = False
19
20
 
20
- try:
21
- from tqdm import tqdm
22
-
23
- def progress_bar(x, verbose=True):
24
- if verbose:
25
- return tqdm(x)
26
- else:
27
- return x
28
21
 
29
- except ImportError:
30
-
31
- def progress_bar(x, verbose=True):
22
+ def progress_bar(x, verbose=True):
23
+ if verbose:
24
+ return tqdm(x)
25
+ else:
32
26
  return x
33
27
 
34
28
 
@@ -48,7 +42,6 @@ class AlignmentBase:
48
42
  logger=None,
49
43
  data_type=np.float32,
50
44
  extra_options=None,
51
- cor_options=None,
52
45
  ):
53
46
  """
54
47
  Alignment basic functions.
@@ -73,13 +66,6 @@ class AlignmentBase:
73
66
 
74
67
  self._init_parameters(vert_fft_width, horz_fft_width, verbose, logger, data_type, extra_options=extra_options)
75
68
  self._plot_windows = {}
76
- self._set_cor_options(cor_options)
77
-
78
- def _set_cor_options(self, cor_options):
79
- default_dict = self._default_cor_options.copy()
80
- if cor_options is not None:
81
- default_dict.update(cor_options)
82
- self.cor_options = default_dict
83
69
 
84
70
  def _init_parameters(self, vert_fft_width, horz_fft_width, verbose, logger, data_type, extra_options=None):
85
71
  self.logger = LoggerOrPrint(logger)