diffct-mlx 2.0.1__py3-none-any.whl → 2.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.
- diffct/kernels/cone_footprint.py +20 -3
- diffct/kernels/fan_footprint.py +10 -8
- diffct/kernels/parallel_footprint.py +4 -4
- diffct_mlx/__init__.py +3 -1
- diffct_mlx/backend/metal/kernels/cone_beam.py +17 -3
- diffct_mlx/backend/metal/kernels/fan_beam.py +8 -8
- diffct_mlx/backend/metal/kernels/parallel_beam.py +4 -4
- diffct_mlx/operators.py +10 -3
- diffct_mlx/physics/simulate.py +14 -1
- diffct_mlx/reconstruction_algorithms/__init__.py +2 -0
- diffct_mlx/reconstruction_algorithms/_analytic.py +64 -22
- diffct_mlx/reconstruction_algorithms/cases.py +152 -1
- diffct_mlx/reconstruction_algorithms/fbp.py +3 -1
- diffct_mlx/reconstruction_algorithms/fdk.py +3 -1
- {diffct_mlx-2.0.1.dist-info → diffct_mlx-2.2.0.dist-info}/METADATA +61 -26
- {diffct_mlx-2.0.1.dist-info → diffct_mlx-2.2.0.dist-info}/RECORD +18 -18
- {diffct_mlx-2.0.1.dist-info → diffct_mlx-2.2.0.dist-info}/WHEEL +1 -1
- {diffct_mlx-2.0.1.dist-info → diffct_mlx-2.2.0.dist-info}/licenses/LICENSE +0 -0
diffct/kernels/cone_footprint.py
CHANGED
|
@@ -118,7 +118,12 @@ def _cone_3d_footprint_forward_kernel(
|
|
|
118
118
|
fp_u_hi = u0 + half_u
|
|
119
119
|
fp_v_lo = v0 - half_v
|
|
120
120
|
fp_v_hi = v0 + half_v
|
|
121
|
-
|
|
121
|
+
# Mass-conserving footprint amplitude: the output is a voxel-unit line integral
|
|
122
|
+
# averaged over the detector cell, on the same scale as the Siddon projector.
|
|
123
|
+
# A voxel of volume vs^3 spreads over (vs * t)^2 * ray_len / |denom| of detector area.
|
|
124
|
+
ray_len = math.sqrt(rx * rx + ry * ry + rz * rz)
|
|
125
|
+
amp = (voxel_spacing * voxel_spacing / (du * dv)) * t * t * ray_len * abs(inv_denom)
|
|
126
|
+
scaled_val = val * amp
|
|
122
127
|
|
|
123
128
|
for iu in range(iu_min, iu_max + 1):
|
|
124
129
|
pixel_u = (np.float32(iu) - center_u) * du
|
|
@@ -235,6 +240,12 @@ def _cone_3d_footprint_backward_kernel(
|
|
|
235
240
|
fp_v_lo = v0 - half_v
|
|
236
241
|
fp_v_hi = v0 + half_v
|
|
237
242
|
|
|
243
|
+
# Mass-conserving footprint amplitude: the output is a voxel-unit line integral
|
|
244
|
+
# averaged over the detector cell, on the same scale as the Siddon projector.
|
|
245
|
+
# A voxel of volume vs^3 spreads over (vs * t)^2 * ray_len / |denom| of detector area.
|
|
246
|
+
ray_len = math.sqrt(rx * rx + ry * ry + rz * rz)
|
|
247
|
+
amp = (voxel_spacing * voxel_spacing / (du * dv)) * t * t * ray_len * abs(inv_denom)
|
|
248
|
+
|
|
238
249
|
for iu in range(iu_min, iu_max + 1):
|
|
239
250
|
pixel_u = (np.float32(iu) - center_u) * du
|
|
240
251
|
overlap_u = min(pixel_u + _HALF * du, fp_u_hi) - max(pixel_u - _HALF * du, fp_u_lo)
|
|
@@ -247,7 +258,7 @@ def _cone_3d_footprint_backward_kernel(
|
|
|
247
258
|
if overlap_v <= eps:
|
|
248
259
|
continue
|
|
249
260
|
wv = overlap_v / width_v
|
|
250
|
-
accum += d_sino[iview, iu, iv] * wu * wv *
|
|
261
|
+
accum += d_sino[iview, iu, iv] * wu * wv * amp
|
|
251
262
|
|
|
252
263
|
d_vol[ix, iy, iz] = accum
|
|
253
264
|
|
|
@@ -359,6 +370,12 @@ def _cone_3d_footprint_backward_sparse_kernel(
|
|
|
359
370
|
fp_v_lo = v0 - half_v
|
|
360
371
|
fp_v_hi = v0 + half_v
|
|
361
372
|
|
|
373
|
+
# Mass-conserving footprint amplitude: the output is a voxel-unit line integral
|
|
374
|
+
# averaged over the detector cell, on the same scale as the Siddon projector.
|
|
375
|
+
# A voxel of volume vs^3 spreads over (vs * t)^2 * ray_len / |denom| of detector area.
|
|
376
|
+
ray_len = math.sqrt(rx * rx + ry * ry + rz * rz)
|
|
377
|
+
amp = (voxel_spacing * voxel_spacing / (du * dv)) * t * t * ray_len * abs(inv_denom)
|
|
378
|
+
|
|
362
379
|
for iu in range(iu_min, iu_max + 1):
|
|
363
380
|
pixel_u = (np.float32(iu) - center_u) * du
|
|
364
381
|
overlap_u = min(pixel_u + _HALF * du, fp_u_hi) - max(pixel_u - _HALF * du, fp_u_lo)
|
|
@@ -371,6 +388,6 @@ def _cone_3d_footprint_backward_sparse_kernel(
|
|
|
371
388
|
if overlap_v <= eps:
|
|
372
389
|
continue
|
|
373
390
|
wv = overlap_v / width_v
|
|
374
|
-
accum += d_sino[iview, iu, iv] * wu * wv *
|
|
391
|
+
accum += d_sino[iview, iu, iv] * wu * wv * amp
|
|
375
392
|
|
|
376
393
|
d_out[isample] = accum
|
diffct/kernels/fan_footprint.py
CHANGED
|
@@ -76,9 +76,10 @@ def _fan_2d_footprint_forward_kernel(
|
|
|
76
76
|
ray_len = math.sqrt(rx * rx + ry * ry)
|
|
77
77
|
if ray_len <= eps:
|
|
78
78
|
continue
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
# Mass-conserving footprint amplitude: the output is a voxel-unit line integral
|
|
80
|
+
# averaged over the detector cell, on the same scale as the Siddon projector.
|
|
81
|
+
# (local magnification t, oblique detector incidence ray_len / |denom|).
|
|
82
|
+
amp = t * ray_len / (abs(denom) * det_spacing_vox)
|
|
82
83
|
|
|
83
84
|
idet_min = int(math.floor(u0 / det_spacing_vox + center_u - support_u / det_spacing_vox))
|
|
84
85
|
idet_max = int(math.ceil(u0 / det_spacing_vox + center_u + support_u / det_spacing_vox))
|
|
@@ -89,7 +90,7 @@ def _fan_2d_footprint_forward_kernel(
|
|
|
89
90
|
|
|
90
91
|
fp_lo = u0 - half_u
|
|
91
92
|
fp_hi = u0 + half_u
|
|
92
|
-
scaled_val = val *
|
|
93
|
+
scaled_val = val * amp
|
|
93
94
|
|
|
94
95
|
for idet in range(idet_min, idet_max + 1):
|
|
95
96
|
pixel_u = (np.float32(idet) - center_u) * det_spacing_vox
|
|
@@ -160,9 +161,10 @@ def _fan_2d_footprint_backward_kernel(
|
|
|
160
161
|
ray_len = math.sqrt(rx * rx + ry * ry)
|
|
161
162
|
if ray_len <= eps:
|
|
162
163
|
continue
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
# Mass-conserving footprint amplitude: the output is a voxel-unit line integral
|
|
165
|
+
# averaged over the detector cell, on the same scale as the Siddon projector.
|
|
166
|
+
# (local magnification t, oblique detector incidence ray_len / |denom|).
|
|
167
|
+
amp = t * ray_len / (abs(denom) * det_spacing_vox)
|
|
166
168
|
|
|
167
169
|
idet_min = int(math.floor(u0 / det_spacing_vox + center_u - support_u / det_spacing_vox))
|
|
168
170
|
idet_max = int(math.ceil(u0 / det_spacing_vox + center_u + support_u / det_spacing_vox))
|
|
@@ -182,6 +184,6 @@ def _fan_2d_footprint_backward_kernel(
|
|
|
182
184
|
if overlap <= eps:
|
|
183
185
|
continue
|
|
184
186
|
weight = overlap / width_u
|
|
185
|
-
accum += d_sino[iang, idet] * weight *
|
|
187
|
+
accum += d_sino[iang, idet] * weight * amp
|
|
186
188
|
|
|
187
189
|
d_image[iy, ix] = accum
|
|
@@ -37,7 +37,6 @@ def _parallel_2d_footprint_forward_kernel(
|
|
|
37
37
|
u_vec_x = d_det_u_vec[iang, 0]
|
|
38
38
|
u_vec_y = d_det_u_vec[iang, 1]
|
|
39
39
|
|
|
40
|
-
l_phi = _ONE / max(max(abs(dir_x), abs(dir_y)), eps)
|
|
41
40
|
half_u = _HALF * (abs(u_vec_x) + abs(u_vec_y))
|
|
42
41
|
half_u = max(half_u, _HALF * det_spacing_vox)
|
|
43
42
|
width_u = max(half_u + half_u, det_spacing_vox)
|
|
@@ -63,7 +62,9 @@ def _parallel_2d_footprint_forward_kernel(
|
|
|
63
62
|
|
|
64
63
|
fp_lo = u0 - half_u
|
|
65
64
|
fp_hi = u0 + half_u
|
|
66
|
-
|
|
65
|
+
# Mass-conserving footprint amplitude: the output is a voxel-unit line integral
|
|
66
|
+
# averaged over the detector cell, on the same scale as the Siddon projector.
|
|
67
|
+
scaled_val = val / det_spacing_vox
|
|
67
68
|
|
|
68
69
|
for idet in range(idet_min, idet_max + 1):
|
|
69
70
|
pixel_u = (np.float32(idet) - center_u) * det_spacing_vox
|
|
@@ -102,7 +103,6 @@ def _parallel_2d_footprint_backward_kernel(
|
|
|
102
103
|
u_vec_x = d_det_u_vec[iang, 0]
|
|
103
104
|
u_vec_y = d_det_u_vec[iang, 1]
|
|
104
105
|
|
|
105
|
-
l_phi = _ONE / max(max(abs(dir_x), abs(dir_y)), eps)
|
|
106
106
|
half_u = _HALF * (abs(u_vec_x) + abs(u_vec_y))
|
|
107
107
|
half_u = max(half_u, _HALF * det_spacing_vox)
|
|
108
108
|
width_u = max(half_u + half_u, det_spacing_vox)
|
|
@@ -130,6 +130,6 @@ def _parallel_2d_footprint_backward_kernel(
|
|
|
130
130
|
if overlap <= eps:
|
|
131
131
|
continue
|
|
132
132
|
weight = overlap / width_u
|
|
133
|
-
accum += d_sino[iang, idet] * weight
|
|
133
|
+
accum += d_sino[iang, idet] * weight / det_spacing_vox
|
|
134
134
|
|
|
135
135
|
d_image[iy, ix] = accum
|
diffct_mlx/__init__.py
CHANGED
|
@@ -85,6 +85,7 @@ from .reconstruction_algorithms import (
|
|
|
85
85
|
build_cone_3d_case,
|
|
86
86
|
build_measured_cone_3d_case,
|
|
87
87
|
build_npy_cone_3d_case,
|
|
88
|
+
reconstruct_case_fdk,
|
|
88
89
|
make_parallel_2d_operators,
|
|
89
90
|
make_fan_2d_operators,
|
|
90
91
|
make_cone_3d_operators,
|
|
@@ -199,7 +200,7 @@ from .tv_gradients import (
|
|
|
199
200
|
awtv_gradient,
|
|
200
201
|
)
|
|
201
202
|
|
|
202
|
-
__version__ = "2.0
|
|
203
|
+
__version__ = "2.2.0"
|
|
203
204
|
|
|
204
205
|
__all__ = [
|
|
205
206
|
"backend",
|
|
@@ -265,6 +266,7 @@ __all__ = [
|
|
|
265
266
|
"build_cone_3d_case",
|
|
266
267
|
"build_measured_cone_3d_case",
|
|
267
268
|
"build_npy_cone_3d_case",
|
|
269
|
+
"reconstruct_case_fdk",
|
|
268
270
|
"make_parallel_2d_operators",
|
|
269
271
|
"make_fan_2d_operators",
|
|
270
272
|
"make_cone_3d_operators",
|
|
@@ -460,7 +460,11 @@ _CONE_3D_FOOTPRINT_FORWARD_SOURCE = """
|
|
|
460
460
|
float fp_u_hi = u0 + half_u;
|
|
461
461
|
float fp_v_lo = v0 - half_v;
|
|
462
462
|
float fp_v_hi = v0 + half_v;
|
|
463
|
-
|
|
463
|
+
// Mass-conserving footprint amplitude: voxel-unit line integral averaged over the
|
|
464
|
+
// detector cell, on the same scale as the Siddon projector.
|
|
465
|
+
float ray_len = metal::sqrt(rx * rx + ry * ry + rz * rz);
|
|
466
|
+
float amp = (voxel_spacing * voxel_spacing / (du * dv)) * t * t * ray_len * metal::abs(inv_denom);
|
|
467
|
+
float scaled_val = val * amp;
|
|
464
468
|
|
|
465
469
|
for (int iu = iu_min; iu <= iu_max; ++iu) {
|
|
466
470
|
float pixel_u = ((float)iu - center_u) * du;
|
|
@@ -617,6 +621,11 @@ _CONE_3D_FOOTPRINT_BACKWARD_SOURCE = """
|
|
|
617
621
|
float fp_v_lo = v0 - half_v;
|
|
618
622
|
float fp_v_hi = v0 + half_v;
|
|
619
623
|
|
|
624
|
+
// Mass-conserving footprint amplitude: voxel-unit line integral averaged over the
|
|
625
|
+
// detector cell, on the same scale as the Siddon projector.
|
|
626
|
+
float ray_len = metal::sqrt(rx * rx + ry * ry + rz * rz);
|
|
627
|
+
float amp = (voxel_spacing * voxel_spacing / (du * dv)) * t * t * ray_len * metal::abs(inv_denom);
|
|
628
|
+
|
|
620
629
|
for (int iu = iu_min; iu <= iu_max; ++iu) {
|
|
621
630
|
float pixel_u = ((float)iu - center_u) * du;
|
|
622
631
|
float pixel_u_lo = pixel_u - 0.5f * du;
|
|
@@ -632,7 +641,7 @@ _CONE_3D_FOOTPRINT_BACKWARD_SOURCE = """
|
|
|
632
641
|
float overlap_v = metal::min(pixel_v_hi, fp_v_hi) - metal::max(pixel_v_lo, fp_v_lo);
|
|
633
642
|
if (overlap_v <= eps) continue;
|
|
634
643
|
float wv = overlap_v / width_v;
|
|
635
|
-
accum += sino[iview * n_u * n_v + iu * n_v + iv] * wu * wv *
|
|
644
|
+
accum += sino[iview * n_u * n_v + iu * n_v + iv] * wu * wv * amp;
|
|
636
645
|
}
|
|
637
646
|
}
|
|
638
647
|
}
|
|
@@ -770,6 +779,11 @@ _CONE_3D_FOOTPRINT_BACKWARD_SPARSE_SOURCE = """
|
|
|
770
779
|
float fp_v_lo = v0 - half_v;
|
|
771
780
|
float fp_v_hi = v0 + half_v;
|
|
772
781
|
|
|
782
|
+
// Mass-conserving footprint amplitude: voxel-unit line integral averaged over the
|
|
783
|
+
// detector cell, on the same scale as the Siddon projector.
|
|
784
|
+
float ray_len = metal::sqrt(rx * rx + ry * ry + rz * rz);
|
|
785
|
+
float amp = (voxel_spacing * voxel_spacing / (du * dv)) * t * t * ray_len * metal::abs(inv_denom);
|
|
786
|
+
|
|
773
787
|
for (int iu = iu_min; iu <= iu_max; ++iu) {
|
|
774
788
|
float pixel_u = ((float)iu - center_u) * du;
|
|
775
789
|
float pixel_u_lo = pixel_u - 0.5f * du;
|
|
@@ -785,7 +799,7 @@ _CONE_3D_FOOTPRINT_BACKWARD_SPARSE_SOURCE = """
|
|
|
785
799
|
float overlap_v = metal::min(pixel_v_hi, fp_v_hi) - metal::max(pixel_v_lo, fp_v_lo);
|
|
786
800
|
if (overlap_v <= eps) continue;
|
|
787
801
|
float wv = overlap_v / width_v;
|
|
788
|
-
accum += sino[iview * n_u * n_v + iu * n_v + iv] * wu * wv *
|
|
802
|
+
accum += sino[iview * n_u * n_v + iu * n_v + iv] * wu * wv * amp;
|
|
789
803
|
}
|
|
790
804
|
}
|
|
791
805
|
}
|
|
@@ -333,9 +333,9 @@ _FAN_2D_FOOTPRINT_FORWARD_SOURCE = """
|
|
|
333
333
|
|
|
334
334
|
float ray_len = metal::sqrt(rx * rx + ry * ry);
|
|
335
335
|
if (ray_len <= eps) continue;
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
float
|
|
336
|
+
// Mass-conserving footprint amplitude: voxel-unit line integral averaged over the
|
|
337
|
+
// detector cell, on the same scale as the Siddon projector.
|
|
338
|
+
float amp = t * ray_len / (metal::abs(denom) * det_spacing_vox);
|
|
339
339
|
|
|
340
340
|
int idet_min = (int)metal::floor(u0 / det_spacing_vox + center_u - support_u / det_spacing_vox);
|
|
341
341
|
int idet_max = (int)metal::ceil(u0 / det_spacing_vox + center_u + support_u / det_spacing_vox);
|
|
@@ -344,7 +344,7 @@ _FAN_2D_FOOTPRINT_FORWARD_SOURCE = """
|
|
|
344
344
|
|
|
345
345
|
float fp_lo = u0 - half_u;
|
|
346
346
|
float fp_hi = u0 + half_u;
|
|
347
|
-
float scaled_val = val *
|
|
347
|
+
float scaled_val = val * amp;
|
|
348
348
|
|
|
349
349
|
for (int idet = idet_min; idet <= idet_max; ++idet) {
|
|
350
350
|
float pixel_u = ((float)idet - center_u) * det_spacing_vox;
|
|
@@ -431,9 +431,9 @@ _FAN_2D_FOOTPRINT_BACKWARD_SOURCE = """
|
|
|
431
431
|
|
|
432
432
|
float ray_len = metal::sqrt(rx * rx + ry * ry);
|
|
433
433
|
if (ray_len <= eps) continue;
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
float
|
|
434
|
+
// Mass-conserving footprint amplitude: voxel-unit line integral averaged over the
|
|
435
|
+
// detector cell, on the same scale as the Siddon projector.
|
|
436
|
+
float amp = t * ray_len / (metal::abs(denom) * det_spacing_vox);
|
|
437
437
|
|
|
438
438
|
int idet_min = (int)metal::floor(u0 / det_spacing_vox + center_u - support_u / det_spacing_vox);
|
|
439
439
|
int idet_max = (int)metal::ceil(u0 / det_spacing_vox + center_u + support_u / det_spacing_vox);
|
|
@@ -450,7 +450,7 @@ _FAN_2D_FOOTPRINT_BACKWARD_SOURCE = """
|
|
|
450
450
|
float overlap = metal::min(pixel_hi, fp_hi) - metal::max(pixel_lo, fp_lo);
|
|
451
451
|
if (overlap <= eps) continue;
|
|
452
452
|
float weight = overlap / width_u;
|
|
453
|
-
accum += sino[iang * n_det + idet] * weight *
|
|
453
|
+
accum += sino[iang * n_det + idet] * weight * amp;
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
456
|
|
|
@@ -274,7 +274,6 @@ _PARALLEL_2D_FOOTPRINT_FORWARD_SOURCE = """
|
|
|
274
274
|
float u_vec_x = det_u_vec[iang * 2 + 0];
|
|
275
275
|
float u_vec_y = det_u_vec[iang * 2 + 1];
|
|
276
276
|
|
|
277
|
-
float l_phi = 1.0f / metal::max(metal::max(metal::abs(dir_x), metal::abs(dir_y)), eps);
|
|
278
277
|
float half_u = 0.5f * (metal::abs(u_vec_x) + metal::abs(u_vec_y));
|
|
279
278
|
half_u = metal::max(half_u, 0.5f * det_spacing_vox);
|
|
280
279
|
float width_u = metal::max(2.0f * half_u, det_spacing_vox);
|
|
@@ -297,7 +296,9 @@ _PARALLEL_2D_FOOTPRINT_FORWARD_SOURCE = """
|
|
|
297
296
|
|
|
298
297
|
float fp_lo = u0 - half_u;
|
|
299
298
|
float fp_hi = u0 + half_u;
|
|
300
|
-
|
|
299
|
+
// Mass-conserving footprint amplitude: voxel-unit line integral averaged over the
|
|
300
|
+
// detector cell, on the same scale as the Siddon projector.
|
|
301
|
+
float scaled_val = val / det_spacing_vox;
|
|
301
302
|
|
|
302
303
|
for (int idet = idet_min; idet <= idet_max; ++idet) {
|
|
303
304
|
float pixel_u = ((float)idet - center_u) * det_spacing_vox;
|
|
@@ -352,7 +353,6 @@ _PARALLEL_2D_FOOTPRINT_BACKWARD_SOURCE = """
|
|
|
352
353
|
float u_vec_x = det_u_vec[iang * 2 + 0];
|
|
353
354
|
float u_vec_y = det_u_vec[iang * 2 + 1];
|
|
354
355
|
|
|
355
|
-
float l_phi = 1.0f / metal::max(metal::max(metal::abs(dir_x), metal::abs(dir_y)), eps);
|
|
356
356
|
float half_u = 0.5f * (metal::abs(u_vec_x) + metal::abs(u_vec_y));
|
|
357
357
|
half_u = metal::max(half_u, 0.5f * det_spacing_vox);
|
|
358
358
|
float width_u = metal::max(2.0f * half_u, det_spacing_vox);
|
|
@@ -377,7 +377,7 @@ _PARALLEL_2D_FOOTPRINT_BACKWARD_SOURCE = """
|
|
|
377
377
|
float overlap = metal::min(pixel_hi, fp_hi) - metal::max(pixel_lo, fp_lo);
|
|
378
378
|
if (overlap <= eps) continue;
|
|
379
379
|
float weight = overlap / width_u;
|
|
380
|
-
accum += sino[iang * n_det + idet] * weight
|
|
380
|
+
accum += sino[iang * n_det + idet] * weight / det_spacing_vox;
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
|
diffct_mlx/operators.py
CHANGED
|
@@ -280,6 +280,7 @@ class ProjectionOperator(LinearOperator):
|
|
|
280
280
|
n_views: int,
|
|
281
281
|
beam: str | None = None,
|
|
282
282
|
views: Any = None,
|
|
283
|
+
voxel_spacing: float = 1.0,
|
|
283
284
|
):
|
|
284
285
|
self._forward_fn = forward_fn
|
|
285
286
|
self._adjoint_fn = adjoint_fn
|
|
@@ -288,6 +289,11 @@ class ProjectionOperator(LinearOperator):
|
|
|
288
289
|
self.n_views = int(n_views)
|
|
289
290
|
self.beam = beam
|
|
290
291
|
self._views = views
|
|
292
|
+
#: Physical voxel pitch of the domain grid. The projectors return line
|
|
293
|
+
#: integrals in VOXEL units; multiply ``A @ x`` by this to obtain
|
|
294
|
+
#: physical line integrals (mu*mm) — e.g. for comparison against
|
|
295
|
+
#: measured -log data or for the physics/simulation chain.
|
|
296
|
+
self.voxel_spacing = float(voxel_spacing)
|
|
291
297
|
|
|
292
298
|
def _forward(self, x: Array) -> Array:
|
|
293
299
|
return self._forward_fn(x, self._views)
|
|
@@ -316,6 +322,7 @@ class ProjectionOperator(LinearOperator):
|
|
|
316
322
|
n_views=int(n),
|
|
317
323
|
beam=self.beam,
|
|
318
324
|
views=view_indices,
|
|
325
|
+
voxel_spacing=self.voxel_spacing,
|
|
319
326
|
)
|
|
320
327
|
|
|
321
328
|
|
|
@@ -377,7 +384,7 @@ def make_parallel_2d_operator(
|
|
|
377
384
|
|
|
378
385
|
return ProjectionOperator(
|
|
379
386
|
fwd, adj, domain_shape=(ny, nx), range_shape=(n_views, num_detectors),
|
|
380
|
-
n_views=n_views, beam="parallel",
|
|
387
|
+
n_views=n_views, beam="parallel", voxel_spacing=voxel_spacing,
|
|
381
388
|
)
|
|
382
389
|
|
|
383
390
|
|
|
@@ -414,7 +421,7 @@ def make_fan_2d_operator(
|
|
|
414
421
|
|
|
415
422
|
return ProjectionOperator(
|
|
416
423
|
fwd, adj, domain_shape=(ny, nx), range_shape=(n_views, num_detectors),
|
|
417
|
-
n_views=n_views, beam="fan",
|
|
424
|
+
n_views=n_views, beam="fan", voxel_spacing=voxel_spacing,
|
|
418
425
|
)
|
|
419
426
|
|
|
420
427
|
|
|
@@ -457,5 +464,5 @@ def make_cone_3d_operator(
|
|
|
457
464
|
|
|
458
465
|
return ProjectionOperator(
|
|
459
466
|
fwd, adj, domain_shape=(nz, ny, nx), range_shape=(n_views, det_u_count, det_v_count),
|
|
460
|
-
n_views=n_views, beam="cone",
|
|
467
|
+
n_views=n_views, beam="cone", voxel_spacing=voxel_spacing,
|
|
461
468
|
)
|
diffct_mlx/physics/simulate.py
CHANGED
|
@@ -258,6 +258,7 @@ def simulate_scan(
|
|
|
258
258
|
poisson: bool = True,
|
|
259
259
|
seed: int = 0,
|
|
260
260
|
return_counts: bool = False,
|
|
261
|
+
voxel_spacing: float | None = None,
|
|
261
262
|
):
|
|
262
263
|
"""Simulate a realistic scan: phantom -> (beam hardening) -> counts -> sinogram.
|
|
263
264
|
|
|
@@ -268,13 +269,25 @@ def simulate_scan(
|
|
|
268
269
|
ring gain), then Poisson noise, then the negative-log brings it back to an
|
|
269
270
|
attenuation sinogram ready for reconstruction.
|
|
270
271
|
|
|
272
|
+
The projectors return line integrals in VOXEL units; the physics
|
|
273
|
+
(``exp(-p)`` transmission, beam-hardening nonlinearity) needs PHYSICAL
|
|
274
|
+
line integrals, so the projection is rescaled by ``voxel_spacing`` first
|
|
275
|
+
(taken from the operator's metadata when not given). The returned
|
|
276
|
+
sinogram is therefore physical (mu*mm) — like real measured -log data —
|
|
277
|
+
and identical to previous behaviour at ``voxel_spacing = 1``.
|
|
278
|
+
|
|
271
279
|
Returns the attenuation sinogram (default) or the raw photon counts
|
|
272
280
|
(``return_counts=True``).
|
|
273
281
|
"""
|
|
274
282
|
if float(I0) <= 0.0:
|
|
275
283
|
raise ValueError(f"I0 (incident photon count) must be positive, got {I0!r}.")
|
|
284
|
+
if voxel_spacing is None:
|
|
285
|
+
voxel_spacing = float(getattr(operator, "voxel_spacing", 1.0))
|
|
286
|
+
if float(voxel_spacing) <= 0.0:
|
|
287
|
+
raise ValueError(f"voxel_spacing must be positive, got {voxel_spacing!r}.")
|
|
276
288
|
x = xp.array(phantom, dtype=_b.float32)
|
|
277
|
-
|
|
289
|
+
# reference-energy line integrals, rescaled to physical units (mu*mm)
|
|
290
|
+
p = (operator @ x) * float(voxel_spacing)
|
|
278
291
|
if spectrum is not None and material_attenuation is not None:
|
|
279
292
|
p = apply_beam_hardening(p, spectrum, material_attenuation, reference_energy)
|
|
280
293
|
|
|
@@ -25,6 +25,7 @@ from .cases import (
|
|
|
25
25
|
build_fan_2d_case,
|
|
26
26
|
build_measured_cone_3d_case,
|
|
27
27
|
build_npy_cone_3d_case,
|
|
28
|
+
reconstruct_case_fdk,
|
|
28
29
|
build_parallel_2d_case,
|
|
29
30
|
make_cone_3d_operators,
|
|
30
31
|
make_fan_2d_operators,
|
|
@@ -98,6 +99,7 @@ __all__ = [
|
|
|
98
99
|
"build_cone_3d_case",
|
|
99
100
|
"build_measured_cone_3d_case",
|
|
100
101
|
"build_npy_cone_3d_case",
|
|
102
|
+
"reconstruct_case_fdk",
|
|
101
103
|
"make_parallel_2d_operators",
|
|
102
104
|
"make_fan_2d_operators",
|
|
103
105
|
"make_cone_3d_operators",
|
|
@@ -28,10 +28,20 @@ AnalyticalBackProjector = Callable[[Any], Any]
|
|
|
28
28
|
class AnalyticalReconstructionParameters:
|
|
29
29
|
"""Common parameters for analytical reconstruction algorithms."""
|
|
30
30
|
|
|
31
|
+
#: Physical detector pitch along the filter axis. Used as the ramp
|
|
32
|
+
#: filter's ``sample_spacing`` (``|f|/du``): leave at 1.0 for the legacy
|
|
33
|
+
#: DFT-bin convention that the case normalization constants assume; set to
|
|
34
|
+
#: the real pitch for quantitative pipelines.
|
|
31
35
|
detector_spacing: float = 1.0
|
|
32
36
|
voxel_spacing: float = 1.0
|
|
33
37
|
enforce_positivity: bool = True
|
|
34
38
|
normalization_scale: float | None = None
|
|
39
|
+
#: Zero-pad the detector axis to ``pad_factor * n`` before the ramp FFT.
|
|
40
|
+
#: Padding suppresses the circular-convolution wrap-around that depresses
|
|
41
|
+
#: large objects (object-size-DEPENDENT bias, up to 0.40x at 75 % FOV
|
|
42
|
+
#: coverage) — keep the default 2 unless you must reproduce legacy
|
|
43
|
+
#: unpadded results (set 1).
|
|
44
|
+
pad_factor: int = 2
|
|
35
45
|
dtype: Any = field(default_factory=lambda: _b.float32)
|
|
36
46
|
|
|
37
47
|
|
|
@@ -57,18 +67,38 @@ def default_angular_normalization(num_views: int) -> float:
|
|
|
57
67
|
return math.pi / float(num_views)
|
|
58
68
|
|
|
59
69
|
|
|
60
|
-
def _ramp_numpy(sino_np, axis):
|
|
61
|
-
"""CPU reference ramp filter (``2*|fftfreq
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
def _ramp_numpy(sino_np, axis, pad_factor=1, sample_spacing=1.0):
|
|
71
|
+
"""CPU reference ramp filter (``2*|fftfreq|/sample_spacing`` convention).
|
|
72
|
+
|
|
73
|
+
``pad_factor > 1`` zero-pads the detector axis to ``pad_factor * n`` before
|
|
74
|
+
the FFT and crops afterwards. Without padding the ramp's negative side
|
|
75
|
+
lobes wrap around (circular convolution) and depress the interior of
|
|
76
|
+
objects that fill a large fraction of the detector — the bias grows with
|
|
77
|
+
object size (measured: 0.94x/0.74x/0.40x of the true value for objects
|
|
78
|
+
covering 25/50/75 % of the FOV; with 2x padding 0.99x/0.94x/0.90x), so no
|
|
79
|
+
global constant can compensate it. ``sample_spacing`` rescales the DFT-bin
|
|
80
|
+
frequencies to physical units (``|f|/du``) for quantitative pipelines.
|
|
81
|
+
"""
|
|
82
|
+
n = sino_np.shape[axis]
|
|
83
|
+
n_pad = max(int(pad_factor), 1) * n
|
|
84
|
+
if n_pad > n:
|
|
85
|
+
pad_width = [(0, 0)] * sino_np.ndim
|
|
86
|
+
pad_width[axis] = (0, n_pad - n)
|
|
87
|
+
sino_np = np.pad(sino_np, pad_width)
|
|
88
|
+
freqs = np.fft.fftfreq(n_pad)
|
|
89
|
+
ramp = (2.0 * np.abs(freqs) / float(sample_spacing)).astype(np.float32)
|
|
65
90
|
shape = [1] * sino_np.ndim
|
|
66
|
-
shape[axis] =
|
|
91
|
+
shape[axis] = n_pad
|
|
67
92
|
sino_fft = np.fft.fft(sino_np, axis=axis)
|
|
68
|
-
|
|
93
|
+
filtered = np.real(np.fft.ifft(sino_fft * ramp.reshape(shape), axis=axis)).astype(np.float32)
|
|
94
|
+
if n_pad > n:
|
|
95
|
+
index = [slice(None)] * filtered.ndim
|
|
96
|
+
index[axis] = slice(0, n)
|
|
97
|
+
filtered = filtered[tuple(index)]
|
|
98
|
+
return filtered
|
|
69
99
|
|
|
70
100
|
|
|
71
|
-
def _ramp_device(sinogram, axis):
|
|
101
|
+
def _ramp_device(sinogram, axis, pad_factor=1, sample_spacing=1.0):
|
|
72
102
|
"""On-device ramp filter reproducing the ``2*|fftfreq|`` DFT convention.
|
|
73
103
|
|
|
74
104
|
Identical maths to :func:`_ramp_numpy` (same DFT-bin ramp — no ``2*pi`` and
|
|
@@ -77,17 +107,27 @@ def _ramp_device(sinogram, axis):
|
|
|
77
107
|
normalization constant (see ``cases.py``) is unchanged.
|
|
78
108
|
"""
|
|
79
109
|
n = int(sinogram.shape[axis])
|
|
80
|
-
|
|
81
|
-
|
|
110
|
+
n_pad = max(int(pad_factor), 1) * n
|
|
111
|
+
if n_pad > n:
|
|
112
|
+
pad_shape = [int(d) for d in sinogram.shape]
|
|
113
|
+
pad_shape[axis] = n_pad - n
|
|
114
|
+
sinogram = xp.concatenate(
|
|
115
|
+
[sinogram, xp.zeros(pad_shape, dtype=_b.float32)], axis=axis)
|
|
116
|
+
freqs = xp.fft.fftfreq(n_pad)
|
|
117
|
+
ramp = 2.0 * xp.abs(freqs) / float(sample_spacing)
|
|
82
118
|
shape = [1] * sinogram.ndim
|
|
83
|
-
shape[axis] =
|
|
119
|
+
shape[axis] = n_pad
|
|
84
120
|
ramp = xp.reshape(ramp, shape)
|
|
85
121
|
spectrum = xp.fft.fft(sinogram, axis=axis)
|
|
86
|
-
filtered = xp.fft.ifft(spectrum * ramp, axis=axis)
|
|
87
|
-
|
|
122
|
+
filtered = xp.real(xp.fft.ifft(spectrum * ramp, axis=axis))
|
|
123
|
+
if n_pad > n:
|
|
124
|
+
index = [slice(None)] * filtered.ndim
|
|
125
|
+
index[axis] = slice(0, n)
|
|
126
|
+
filtered = filtered[tuple(index)]
|
|
127
|
+
return filtered
|
|
88
128
|
|
|
89
129
|
|
|
90
|
-
def _ramp(sinogram, axis):
|
|
130
|
+
def _ramp(sinogram, axis, pad_factor=1, sample_spacing=1.0):
|
|
91
131
|
"""Ramp filter along ``axis`` — on-device when the backend exposes an FFT.
|
|
92
132
|
|
|
93
133
|
Falls back to the numpy reference (host round-trip) only if the backend has
|
|
@@ -96,31 +136,33 @@ def _ramp(sinogram, axis):
|
|
|
96
136
|
"""
|
|
97
137
|
if getattr(xp, "fft", None) is not None:
|
|
98
138
|
try:
|
|
99
|
-
return _ramp_device(_b.as_array(sinogram, dtype=_b.float32), axis
|
|
139
|
+
return _ramp_device(_b.as_array(sinogram, dtype=_b.float32), axis,
|
|
140
|
+
pad_factor=pad_factor, sample_spacing=sample_spacing)
|
|
100
141
|
except Exception: # pragma: no cover - defensive host fallback
|
|
101
142
|
pass
|
|
102
143
|
dev = _b.device_of(sinogram)
|
|
103
144
|
sino_np = _b.to_numpy(sinogram).astype(np.float32)
|
|
104
|
-
return _b.as_array(_ramp_numpy(sino_np, axis
|
|
145
|
+
return _b.as_array(_ramp_numpy(sino_np, axis, pad_factor=pad_factor,
|
|
146
|
+
sample_spacing=sample_spacing), device=dev)
|
|
105
147
|
|
|
106
148
|
|
|
107
|
-
def ramp_filter_2d(sinogram):
|
|
149
|
+
def ramp_filter_2d(sinogram, pad_factor=1, sample_spacing=1.0):
|
|
108
150
|
"""Apply a ramp filter along the detector axis of a 2D sinogram."""
|
|
109
151
|
sinogram = _b.as_array(sinogram, dtype=_b.float32)
|
|
110
152
|
if sinogram.ndim != 2:
|
|
111
153
|
raise ValueError(f"Expected a 2D sinogram, got shape {tuple(sinogram.shape)!r}.")
|
|
112
|
-
return _ramp(sinogram, 1)
|
|
154
|
+
return _ramp(sinogram, 1, pad_factor=pad_factor, sample_spacing=sample_spacing)
|
|
113
155
|
|
|
114
156
|
|
|
115
|
-
def ramp_filter_3d(sinogram):
|
|
157
|
+
def ramp_filter_3d(sinogram, pad_factor=1, sample_spacing=1.0):
|
|
116
158
|
"""Apply a ramp filter along the detector-u axis of a 3D cone sinogram."""
|
|
117
159
|
sinogram = _b.as_array(sinogram, dtype=_b.float32)
|
|
118
160
|
if sinogram.ndim != 3:
|
|
119
161
|
raise ValueError(f"Expected a 3D sinogram, got shape {tuple(sinogram.shape)!r}.")
|
|
120
|
-
return _ramp(sinogram, 1)
|
|
162
|
+
return _ramp(sinogram, 1, pad_factor=pad_factor, sample_spacing=sample_spacing)
|
|
121
163
|
|
|
122
164
|
|
|
123
|
-
def ramp_filter(sinogram, axis=1):
|
|
165
|
+
def ramp_filter(sinogram, axis=1, pad_factor=1, sample_spacing=1.0):
|
|
124
166
|
"""Apply a ramp filter along an arbitrary detector axis."""
|
|
125
167
|
sinogram = _b.as_array(sinogram, dtype=_b.float32)
|
|
126
168
|
if sinogram.ndim < 2:
|
|
@@ -130,4 +172,4 @@ def ramp_filter(sinogram, axis=1):
|
|
|
130
172
|
axis += sinogram.ndim
|
|
131
173
|
if axis < 0 or axis >= sinogram.ndim:
|
|
132
174
|
raise ValueError(f"Invalid filter axis {axis} for sinogram with ndim={sinogram.ndim}.")
|
|
133
|
-
return _ramp(sinogram, axis)
|
|
175
|
+
return _ramp(sinogram, axis, pad_factor=pad_factor, sample_spacing=sample_spacing)
|
|
@@ -91,6 +91,18 @@ class ReconstructionCase:
|
|
|
91
91
|
fdk_normalization_scale: float | None = None
|
|
92
92
|
fbp_weight: Callable[[Array], Array] | None = None
|
|
93
93
|
fdk_weight: Callable[[Array], Array] | None = None
|
|
94
|
+
#: Physical voxel pitch of the reconstruction grid (mm). UNIT NOTE: the
|
|
95
|
+
#: projectors integrate in voxel units, so iterative reconstruction of a
|
|
96
|
+
#: PHYSICAL sinogram (measured -log data) converges to attenuation *per
|
|
97
|
+
#: voxel*; divide the volume by ``voxel_spacing`` for mu in 1/mm. The
|
|
98
|
+
#: quantitative FDK path below already returns mu in 1/mm directly.
|
|
99
|
+
voxel_spacing: float = 1.0
|
|
100
|
+
#: Quantitative FDK path (physical units): padded physical ramp incl.
|
|
101
|
+
#: per-view angular weights, and a voxel-driven (sid/U)^2-weighted
|
|
102
|
+
#: backprojector. None when the active backend lacks the analytical
|
|
103
|
+
#: helpers (e.g. MLX). Use :func:`reconstruct_case_fdk`.
|
|
104
|
+
fdk_filter: Callable[[Array], Array] | None = None
|
|
105
|
+
fdk_back_project: Callable[[Array], Array] | None = None
|
|
94
106
|
|
|
95
107
|
|
|
96
108
|
@dataclass
|
|
@@ -513,6 +525,107 @@ def make_cone_3d_operators(
|
|
|
513
525
|
return forward_single, back_single, back_project_all
|
|
514
526
|
|
|
515
527
|
|
|
528
|
+
def _quantitative_fdk_operators(src_pos, det_center, det_u_vec, det_v_vec,
|
|
529
|
+
volume_shape, detector_shape, du, dv,
|
|
530
|
+
voxel_spacing, sinogram_scale=1.0):
|
|
531
|
+
"""Build the quantitative FDK trio (cosine weight, filter, backprojector).
|
|
532
|
+
|
|
533
|
+
Physical-units pipeline: cosine pre-weights, per-view trapezoidal angular
|
|
534
|
+
weights (actual source angles — works for non-uniform trajectories),
|
|
535
|
+
zero-padded physical ramp (``|f|/du``), and the voxel-driven
|
|
536
|
+
``(sid_n/U_n)^2``-weighted FDK gather backprojector with its analytical
|
|
537
|
+
``sdd/(2*pi*sid)`` constant. The result is amplitude-calibrated: a
|
|
538
|
+
homogeneous object of attenuation ``mu`` (in 1/mm when the geometry is in
|
|
539
|
+
mm) reconstructs to ``mu`` without any case-specific normalization.
|
|
540
|
+
|
|
541
|
+
``sinogram_scale`` converts the case's sinogram to PHYSICAL line integrals
|
|
542
|
+
(mu*mm): pass ``voxel_spacing`` for raw Siddon projector output (voxel-unit
|
|
543
|
+
integrals) and 1.0 for measured -log data, which is already physical.
|
|
544
|
+
|
|
545
|
+
Returns ``(fdk_weight, fdk_filter, fdk_back_project)`` or ``(None,)*3``
|
|
546
|
+
when the active backend lacks the analytical helpers (e.g. MLX).
|
|
547
|
+
"""
|
|
548
|
+
from .. import analytical as _ana
|
|
549
|
+
|
|
550
|
+
needed = ("ramp_filter_1d", "cone_weighted_backproject",
|
|
551
|
+
"angular_integration_weights")
|
|
552
|
+
if any(getattr(_ana, name, None) is None for name in needed):
|
|
553
|
+
return None, None, None
|
|
554
|
+
import torch # helpers only exist on the torch backend
|
|
555
|
+
|
|
556
|
+
src_t = _b.as_array(src_pos, dtype=_b.float32)
|
|
557
|
+
dc_t = _b.as_array(det_center, dtype=_b.float32)
|
|
558
|
+
duv_t = _b.as_array(det_u_vec, dtype=_b.float32)
|
|
559
|
+
dvv_t = _b.as_array(det_v_vec, dtype=_b.float32)
|
|
560
|
+
|
|
561
|
+
nz, ny, nx = (int(d) for d in volume_shape)
|
|
562
|
+
det_u, det_v = (int(d) for d in detector_shape)
|
|
563
|
+
du = float(du)
|
|
564
|
+
dv = float(dv)
|
|
565
|
+
voxel_spacing = float(voxel_spacing)
|
|
566
|
+
sinogram_scale = float(sinogram_scale)
|
|
567
|
+
|
|
568
|
+
# Cosine pre-weights from the actual mean source-detector distance.
|
|
569
|
+
sdd_mean = float(torch.linalg.norm(dc_t - src_t, dim=1).mean())
|
|
570
|
+
u_coords = (xp.arange(det_u) - det_u / 2) * du
|
|
571
|
+
v_coords = (xp.arange(det_v) - det_v / 2) * dv
|
|
572
|
+
cos_w = sdd_mean / xp.sqrt(
|
|
573
|
+
sdd_mean**2
|
|
574
|
+
+ u_coords.reshape(1, det_u, 1) ** 2
|
|
575
|
+
+ v_coords.reshape(1, 1, det_v) ** 2
|
|
576
|
+
)
|
|
577
|
+
|
|
578
|
+
# Per-view angular integration weights from the actual source angles
|
|
579
|
+
# (trapezoidal; handles non-uniform measured trajectories).
|
|
580
|
+
src_np = _b.to_numpy(src_t).astype(np.float64)
|
|
581
|
+
angles_np = np.unwrap(np.arctan2(src_np[:, 1], src_np[:, 0]))
|
|
582
|
+
angles = torch.as_tensor(angles_np, dtype=torch.float32, device=src_t.device)
|
|
583
|
+
ang_w = _ana.angular_integration_weights(angles, redundant_full_scan=True)
|
|
584
|
+
ang_w = ang_w.reshape(-1, 1, 1)
|
|
585
|
+
|
|
586
|
+
def fdk_weight(raw):
|
|
587
|
+
return raw * cos_w
|
|
588
|
+
|
|
589
|
+
def fdk_filter(weighted):
|
|
590
|
+
scaled = weighted * (ang_w * sinogram_scale)
|
|
591
|
+
return _ana.ramp_filter_1d(scaled, dim=1, sample_spacing=du, pad_factor=2)
|
|
592
|
+
|
|
593
|
+
def fdk_back_project(filtered):
|
|
594
|
+
return _ana.cone_weighted_backproject(
|
|
595
|
+
filtered, src_t, dc_t, duv_t, dvv_t,
|
|
596
|
+
nz, ny, nx, du, dv, voxel_spacing)
|
|
597
|
+
|
|
598
|
+
return fdk_weight, fdk_filter, fdk_back_project
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
def reconstruct_case_fdk(case: ReconstructionCase, *, enforce_positivity: bool = True):
|
|
602
|
+
"""FDK-reconstruct a case, preferring its quantitative path.
|
|
603
|
+
|
|
604
|
+
With ``case.fdk_back_project`` present (torch backend), runs the
|
|
605
|
+
amplitude-calibrated physical pipeline (see
|
|
606
|
+
:func:`_quantitative_fdk_operators`) — the volume is in true attenuation
|
|
607
|
+
units. Otherwise falls back to the legacy calibrated path (Siddon adjoint
|
|
608
|
+
+ ``fdk_normalization_scale``), whose amplitude is only calibrated for the
|
|
609
|
+
synthetic unit-spacing setup.
|
|
610
|
+
"""
|
|
611
|
+
from .fdk import FDKParameters, reconstruct_fdk
|
|
612
|
+
|
|
613
|
+
if case.fdk_back_project is not None:
|
|
614
|
+
params = FDKParameters(normalization_scale=1.0,
|
|
615
|
+
enforce_positivity=enforce_positivity)
|
|
616
|
+
return reconstruct_fdk(
|
|
617
|
+
case.sinogram, case.fdk_back_project, params,
|
|
618
|
+
weight_projections=case.fdk_weight,
|
|
619
|
+
filter_projections=case.fdk_filter)
|
|
620
|
+
if not case.supports_fdk:
|
|
621
|
+
raise ValueError(f"case {case.name!r} does not support FDK")
|
|
622
|
+
params = FDKParameters(normalization_scale=case.fdk_normalization_scale,
|
|
623
|
+
enforce_positivity=enforce_positivity)
|
|
624
|
+
return reconstruct_fdk(
|
|
625
|
+
case.sinogram, case.back_project_all, params,
|
|
626
|
+
weight_projections=case.fdk_weight)
|
|
627
|
+
|
|
628
|
+
|
|
516
629
|
def build_parallel_2d_case(
|
|
517
630
|
*,
|
|
518
631
|
image_shape: tuple[int, int] = (96, 96),
|
|
@@ -676,6 +789,13 @@ def build_cone_3d_case(
|
|
|
676
789
|
)
|
|
677
790
|
|
|
678
791
|
normalization = (math.pi * sid) / (2.0 * sdd * num_views)
|
|
792
|
+
# Quantitative FDK path: the Siddon sinogram is in voxel-unit line
|
|
793
|
+
# integrals, so it is rescaled by voxel_spacing to physical mu*mm.
|
|
794
|
+
q_weight, q_filter, q_back = _quantitative_fdk_operators(
|
|
795
|
+
src_pos, det_center, det_u_vec, det_v_vec,
|
|
796
|
+
(nz, ny, nx), (det_u_count, det_v_count), du, dv, voxel_spacing,
|
|
797
|
+
sinogram_scale=voxel_spacing,
|
|
798
|
+
)
|
|
679
799
|
return ReconstructionCase(
|
|
680
800
|
name="Cone 3D",
|
|
681
801
|
sinogram=sinogram,
|
|
@@ -689,8 +809,11 @@ def build_cone_3d_case(
|
|
|
689
809
|
supports_fdk=True,
|
|
690
810
|
fbp_normalization_scale=normalization,
|
|
691
811
|
fdk_normalization_scale=normalization,
|
|
812
|
+
voxel_spacing=float(voxel_spacing),
|
|
692
813
|
fbp_weight=cone_weight,
|
|
693
|
-
fdk_weight=cone_weight,
|
|
814
|
+
fdk_weight=q_weight if q_weight is not None else cone_weight,
|
|
815
|
+
fdk_filter=q_filter,
|
|
816
|
+
fdk_back_project=q_back,
|
|
694
817
|
)
|
|
695
818
|
|
|
696
819
|
|
|
@@ -858,6 +981,16 @@ def build_measured_cone_3d_case(config: MeasuredConeDataConfig) -> Reconstructio
|
|
|
858
981
|
|
|
859
982
|
reference = None if reference_np is None else xp.array(reference_np, dtype=xp.float32)
|
|
860
983
|
sinogram = xp.array(measured_sino_np, dtype=xp.float32)
|
|
984
|
+
# Quantitative FDK: measured -log data are already physical line
|
|
985
|
+
# integrals (mu*mm), so no sinogram rescale. This is the ONLY FDK path
|
|
986
|
+
# for measured data — the legacy case constant is a synthetic-geometry
|
|
987
|
+
# calibration and does not transfer to real du/voxel/magnification.
|
|
988
|
+
q_weight, q_filter, q_back = _quantitative_fdk_operators(
|
|
989
|
+
src_pos, det_center, det_u_vec, det_v_vec,
|
|
990
|
+
config.volume_shape, (measured_det_u, measured_det_v),
|
|
991
|
+
measured_du, measured_dv, measured_voxel_spacing,
|
|
992
|
+
sinogram_scale=1.0,
|
|
993
|
+
)
|
|
861
994
|
return ReconstructionCase(
|
|
862
995
|
name="Measured Cone 3D",
|
|
863
996
|
sinogram=sinogram,
|
|
@@ -867,6 +1000,11 @@ def build_measured_cone_3d_case(config: MeasuredConeDataConfig) -> Reconstructio
|
|
|
867
1000
|
back_project_all=back_project_all,
|
|
868
1001
|
reference=reference,
|
|
869
1002
|
reference_title=reference_title,
|
|
1003
|
+
supports_fdk=q_back is not None,
|
|
1004
|
+
voxel_spacing=float(measured_voxel_spacing),
|
|
1005
|
+
fdk_weight=q_weight,
|
|
1006
|
+
fdk_filter=q_filter,
|
|
1007
|
+
fdk_back_project=q_back,
|
|
870
1008
|
iterative_projection_subset_count=int(config.iterative_projection_subset_count),
|
|
871
1009
|
iterative_normalized_sart_relaxation=float(config.iterative_normalized_sart_relaxation),
|
|
872
1010
|
iterative_backprojection_scale=(
|
|
@@ -993,6 +1131,14 @@ def build_npy_cone_3d_case(config: NpyProjectionsConfig) -> ReconstructionCase:
|
|
|
993
1131
|
|
|
994
1132
|
iterative_projection_weights = _trajectory_quadrature_weights(src_pos)
|
|
995
1133
|
|
|
1134
|
+
# Quantitative FDK: npy stacks are raw forward-projector output, i.e.
|
|
1135
|
+
# voxel-unit line integrals -> rescale by voxel_spacing to physical mu*mm.
|
|
1136
|
+
q_weight, q_filter, q_back = _quantitative_fdk_operators(
|
|
1137
|
+
src_pos, det_center, det_u_vec, det_v_vec,
|
|
1138
|
+
config.volume_shape, (det_u, det_v), du, dv,
|
|
1139
|
+
float(config.voxel_spacing_mm),
|
|
1140
|
+
sinogram_scale=float(config.voxel_spacing_mm),
|
|
1141
|
+
)
|
|
996
1142
|
return ReconstructionCase(
|
|
997
1143
|
name="NPY Cone 3D",
|
|
998
1144
|
sinogram=xp.array(sino_np, dtype=xp.float32),
|
|
@@ -1000,6 +1146,11 @@ def build_npy_cone_3d_case(config: NpyProjectionsConfig) -> ReconstructionCase:
|
|
|
1000
1146
|
forward_single=forward_single,
|
|
1001
1147
|
back_single=back_single,
|
|
1002
1148
|
back_project_all=back_project_all,
|
|
1149
|
+
supports_fdk=q_back is not None,
|
|
1150
|
+
voxel_spacing=float(config.voxel_spacing_mm),
|
|
1151
|
+
fdk_weight=q_weight,
|
|
1152
|
+
fdk_filter=q_filter,
|
|
1153
|
+
fdk_back_project=q_back,
|
|
1003
1154
|
pocs_iterative_update_method="normalized_sart",
|
|
1004
1155
|
iterative_voxel_sensitivity_normalization=(
|
|
1005
1156
|
str(config.projector_mode).strip().lower() == "footprint"
|
|
@@ -44,7 +44,9 @@ def reconstruct_fbp(
|
|
|
44
44
|
)
|
|
45
45
|
|
|
46
46
|
if filter_projections is None:
|
|
47
|
-
filtered_sinogram = ramp_filter(
|
|
47
|
+
filtered_sinogram = ramp_filter(
|
|
48
|
+
weighted_sinogram, axis=params.filter_axis,
|
|
49
|
+
pad_factor=params.pad_factor, sample_spacing=params.detector_spacing)
|
|
48
50
|
else:
|
|
49
51
|
filtered_sinogram = _as_array(filter_projections(weighted_sinogram), dtype=params.dtype)
|
|
50
52
|
if filtered_sinogram.shape != sinogram.shape:
|
|
@@ -44,7 +44,9 @@ def reconstruct_fdk(
|
|
|
44
44
|
)
|
|
45
45
|
|
|
46
46
|
if filter_projections is None:
|
|
47
|
-
filtered_sinogram = ramp_filter(
|
|
47
|
+
filtered_sinogram = ramp_filter(
|
|
48
|
+
weighted_sinogram, axis=params.filter_axis,
|
|
49
|
+
pad_factor=params.pad_factor, sample_spacing=params.detector_spacing)
|
|
48
50
|
else:
|
|
49
51
|
filtered_sinogram = _as_array(filter_projections(weighted_sinogram), dtype=params.dtype)
|
|
50
52
|
if filtered_sinogram.shape != sinogram.shape:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: diffct-mlx
|
|
3
|
-
Version: 2.0
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Differentiable computed tomography with an auto-selecting backend (Torch/CUDA or Apple MLX)
|
|
5
5
|
Project-URL: Homepage, https://github.com/Linda-SophieSchneider/DiffCT-MLX
|
|
6
6
|
Project-URL: Upstream, https://github.com/sypsyp97/diffct
|
|
@@ -26,8 +26,7 @@ Description-Content-Type: text/markdown
|
|
|
26
26
|
# diffct: Differentiable Computed Tomography Operators
|
|
27
27
|
|
|
28
28
|
> [!NOTE]
|
|
29
|
-
> **
|
|
30
|
-
> It is based on diffct's arbitrary-trajectory (`dev`) line, whose module layout and per-view projector convention match the MLX port. This branch hosts the unified **auto-backend** package `diffct_mlx` (MLX/Metal on Apple Silicon, Torch/numba-CUDA elsewhere) so the same code runs on both. Maintained by [Linda-Sophie Schneider](https://github.com/Linda-SophieSchneider).
|
|
29
|
+
> **[DiffCT-MLX](https://github.com/Linda-SophieSchneider/DiffCT-MLX) — the unified auto-backend package `diffct_mlx`** (MLX/Metal on Apple Silicon, Torch/numba-CUDA elsewhere), so the same code runs on both. The Torch/CUDA engine is adapted from the original [diffct](https://github.com/sypsyp97) by Yipeng Sun (Apache-2.0), based on its arbitrary-trajectory (`dev`) line. Maintained by [Linda-Sophie Schneider](https://github.com/Linda-SophieSchneider).
|
|
31
30
|
> See [ATTRIBUTION.md](ATTRIBUTION.md) for full provenance and license details.
|
|
32
31
|
|
|
33
32
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
@@ -48,13 +47,12 @@ custom). Built for optimization and deep-learning integration.
|
|
|
48
47
|
[Linda-Sophie Schneider](https://github.com/Linda-SophieSchneider) at
|
|
49
48
|
[Linda-SophieSchneider/DiffCT-MLX](https://github.com/Linda-SophieSchneider/DiffCT-MLX).
|
|
50
49
|
|
|
51
|
-
## 🧭
|
|
50
|
+
## 🧭 The unified `diffct_mlx` API
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
**`diffct_mlx`** is a single API that auto-selects its
|
|
54
53
|
compute backend at import — **Torch / numba-CUDA** on NVIDIA GPUs, **Apple MLX**
|
|
55
54
|
on Apple Silicon — so the *same* script runs unchanged on both. It mirrors the
|
|
56
|
-
public API
|
|
57
|
-
(Apple) package name-for-name.
|
|
55
|
+
same public API on both backends name-for-name.
|
|
58
56
|
|
|
59
57
|
```bash
|
|
60
58
|
pip install "diffct-mlx[cuda]" # NVIDIA GPUs (Torch + numba-CUDA)
|
|
@@ -80,11 +78,11 @@ reco = dct.reconstruct_fbp(
|
|
|
80
78
|
|
|
81
79
|
**Parity & status.** FBP/FDK, SART/SIRT, TV-/ASD-/AwTV-POCS, DART, phantoms,
|
|
82
80
|
trajectory generators and the measured-data helpers are all available and were
|
|
83
|
-
verified on NVIDIA GPUs. The **MLX backend** is
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
81
|
+
verified on NVIDIA GPUs. The **MLX backend** is runtime-validated on Apple
|
|
82
|
+
Silicon; its vendored Metal kernels use `mx.custom_function` projectors and
|
|
83
|
+
the same centered Siddon/geometry-gradient conventions as CUDA. The
|
|
84
|
+
backend-neutral `xp` namespace is attribute-identical to the torch one, pinned
|
|
85
|
+
by a static parity test.
|
|
88
86
|
|
|
89
87
|
### Projectors: Siddon vs. separable footprint
|
|
90
88
|
|
|
@@ -117,10 +115,52 @@ evaluation**: `cone_backward_footprint(..., indices=idx)` computes only the give
|
|
|
117
115
|
flattened `(D, H, W)` voxels and returns a 1-D vector (useful for masked / DART
|
|
118
116
|
subproblems).
|
|
119
117
|
|
|
118
|
+
### Quantitative FDK (amplitude-true reconstruction)
|
|
119
|
+
|
|
120
|
+
The legacy case FDK path was a *synthetic-geometry calibration*, not physics:
|
|
121
|
+
an unpadded DFT-bin ramp (circular-convolution wrap-around depresses large
|
|
122
|
+
objects with an object-size-dependent bias — down to 0.40× at 75 % FOV
|
|
123
|
+
coverage), the constant `π·SID/(2·SDD·N)` (only valid for `du = dv = voxel
|
|
124
|
+
= 1`), and the Siddon adjoint (not an FDK backprojector). On measured data
|
|
125
|
+
these stack to ~0.1–0.5× of the true attenuation.
|
|
126
|
+
|
|
127
|
+
The quantitative path fixes all three: cosine pre-weights → per-view
|
|
128
|
+
trapezoidal angular weights (actual source angles, non-uniform trajectories
|
|
129
|
+
included) → zero-padded **physical** ramp (`|f|/du`, `pad_factor=2`) → the
|
|
130
|
+
voxel-driven `(SID/U)²`-weighted FDK gather backprojector with its analytic
|
|
131
|
+
`SDD/(2π·SID)` constant. Verified: a cylinder of known µ at real camera
|
|
132
|
+
geometry (du 0.556 mm, voxel 0.278 mm, magnification 2, object filling 75 %
|
|
133
|
+
of the FOV) reconstructs to **0.99×** the true µ (legacy path: 0.47×).
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
case = dct.build_measured_cone_3d_case(cfg) # supports_fdk=True on CUDA now
|
|
137
|
+
vol_mu = dct.reconstruct_case_fdk(case) # true attenuation units (1/mm)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
All cone cases (synthetic, measured TIFF, npy) carry the quantitative
|
|
141
|
+
operators (`case.fdk_weight` / `fdk_filter` / `fdk_back_project`); sinogram
|
|
142
|
+
units are handled per source (measured −log data are physical; raw Siddon
|
|
143
|
+
projector output is voxel-unit and rescaled by `voxel_spacing`). The ramp
|
|
144
|
+
filter itself now accepts `pad_factor` and `sample_spacing`, and
|
|
145
|
+
`FBPParameters`/`FDKParameters` default to `pad_factor=2`.
|
|
146
|
+
|
|
147
|
+
> **Unit convention.** The projectors integrate in **voxel units**: physical
|
|
148
|
+
> line integrals are `(A @ x) * voxel_spacing`. This holds for both projector
|
|
149
|
+
> modes: since 2.2.0 the footprint kernels are mass-conserving and agree with
|
|
150
|
+
> the Siddon kernels in amplitude (earlier versions scaled footprint output
|
|
151
|
+
> with the detector-cell-to-voxel size ratio). Operators built via
|
|
152
|
+
> `make_*_operator` carry `A.voxel_spacing` as metadata, and the boundaries
|
|
153
|
+
> where physical units matter handle the conversion automatically —
|
|
154
|
+
> `simulate_scan` rescales before the `exp(-p)` / beam-hardening physics (and
|
|
155
|
+
> returns physical, scanner-like sinograms), and the quantitative FDK path
|
|
156
|
+
> encodes it per data source. One consequence to know: **iterative**
|
|
157
|
+
> reconstruction of measured (physical) data converges to attenuation *per
|
|
158
|
+
> voxel*; divide by `case.voxel_spacing` for µ in 1/mm.
|
|
159
|
+
|
|
120
160
|
### Operators, solvers, regularizers, physics & simulation
|
|
121
161
|
|
|
122
|
-
The
|
|
123
|
-
projectors (all GPU-resident, verified on NVIDIA GPUs):
|
|
162
|
+
The unified package provides a composable, differentiable toolkit on top of
|
|
163
|
+
the projectors (all GPU-resident, verified on NVIDIA GPUs):
|
|
124
164
|
|
|
125
165
|
- **Operators** (`diffct_mlx.operators`) — a `LinearOperator` algebra: build a
|
|
126
166
|
projector as `A = dct.make_cone_3d_operator(...)`, then `A @ x`, `A.T @ y`,
|
|
@@ -266,23 +306,18 @@ to ~1e-6, 2-GPU == 1-GPU exact, 2048³ cone-FDK end-to-end with a bounded
|
|
|
266
306
|
working set. This path is CUDA-only (it drives the numba-CUDA kernels
|
|
267
307
|
directly).
|
|
268
308
|
|
|
269
|
-
## 🔀 Branches
|
|
270
|
-
|
|
271
|
-
### `main` — unified auto-backend package
|
|
272
|
-
The unified `diffct_mlx` package described above: one API, two engines
|
|
273
|
-
(Torch/numba-CUDA and MLX/Metal), auto-selected at import. This is the branch
|
|
274
|
-
to use on every platform.
|
|
309
|
+
## 🔀 Branches & releases
|
|
275
310
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
311
|
+
All development happens on **`main`** (the former `cuda` development branch
|
|
312
|
+
has been merged and retired). Versioned releases are tagged and published to
|
|
313
|
+
PyPI via CI (trusted publishing); `gh-pages` hosts the built documentation.
|
|
279
314
|
|
|
280
315
|
Kernels take per-view ``(src_pos, det_center, det_u_vec[, det_v_vec])``
|
|
281
316
|
arrays instead of closed-form ``sdd / sid / beta`` scalars, so **spiral,
|
|
282
317
|
saddle, sinusoidal, laminography, or any user-supplied trajectory** works
|
|
283
318
|
without touching the kernels — on both backends.
|
|
284
319
|
|
|
285
|
-
|
|
320
|
+
If you find any bugs please
|
|
286
321
|
[raise an issue](https://github.com/Linda-SophieSchneider/DiffCT-MLX/issues).
|
|
287
322
|
|
|
288
323
|
## ✨ Features
|
|
@@ -444,7 +479,7 @@ pip install -e .
|
|
|
444
479
|
### Running the tests
|
|
445
480
|
|
|
446
481
|
```bash
|
|
447
|
-
pytest tests/ -q #
|
|
482
|
+
pytest tests/ -q # core suite (backend-specific tests may skip)
|
|
448
483
|
pytest tests/benchmarks/ --benchmark-only # opt-in perf suite
|
|
449
484
|
```
|
|
450
485
|
|
|
@@ -8,18 +8,18 @@ diffct/projectors.py,sha256=tbrwCcsW-tMWK4qbcYMueqIC4gjUPUj88Zb2PorClZI,52223
|
|
|
8
8
|
diffct/utils.py,sha256=qFFjB3mlyHHO-LIzNvcS7OuZ10HDq1S5D2hsabhExgM,9819
|
|
9
9
|
diffct/kernels/__init__.py,sha256=KiMSQmDBtg91Duufi5M7D_XMVQeMptJxVjxrQWS6Q4A,932
|
|
10
10
|
diffct/kernels/cone_beam.py,sha256=Oxsw0GxFdqKOmO0kYFMwUhRdReQJOLJfDyFEJw2fSww,32554
|
|
11
|
-
diffct/kernels/cone_footprint.py,sha256=
|
|
11
|
+
diffct/kernels/cone_footprint.py,sha256=FfI_snSSsJF5ebMmFsglnVJ-1FnHemnYyFUa2LWAY5g,14790
|
|
12
12
|
diffct/kernels/fan_beam.py,sha256=-3cIoGsxc9mIw9CyjKjTd0cSt9qvTg8EVWAnPHRQaFU,15367
|
|
13
|
-
diffct/kernels/fan_footprint.py,sha256=
|
|
13
|
+
diffct/kernels/fan_footprint.py,sha256=o_hw-Z8Z92KR0Ssiam8-HktIZwm7beowpSsqdIwAgvo,6603
|
|
14
14
|
diffct/kernels/parallel_beam.py,sha256=yfueBtQmdaQqQ5f9Zl7m0oHAGIEJ6vnjcaQEGLARV5U,15368
|
|
15
|
-
diffct/kernels/parallel_footprint.py,sha256=
|
|
16
|
-
diffct_mlx/__init__.py,sha256=
|
|
15
|
+
diffct/kernels/parallel_footprint.py,sha256=rK6BpJdWlqgR_cARyyMsi6dgNJxHvyMkKuHP6H96xVA,4868
|
|
16
|
+
diffct_mlx/__init__.py,sha256=N2RtbppyGHFAWaDckEobJ4g3sYY1A4f2KCS70EUf7qY,9308
|
|
17
17
|
diffct_mlx/analytical.py,sha256=PeSErFI7iPzADcjIm4eSjHVWUdQWZW4y_PgaCXe04YA,775
|
|
18
18
|
diffct_mlx/calibration.py,sha256=ey7enNTnwIr_8KvgSoVTWpLjCmvvvTkYGrk4tqw1iT8,4941
|
|
19
19
|
diffct_mlx/filters.py,sha256=qVLbbfZ4GKO62su0pkK9AxyLyw8ME_nJ87CtvjgQF8s,13810
|
|
20
20
|
diffct_mlx/functionals.py,sha256=rwHu2wxjRBael1kSJJjFFU4GDqDO8jZiyq5AU5JY6t0,9185
|
|
21
21
|
diffct_mlx/geometry.py,sha256=_iSSXJDTs18KysM7vV2aFWbKkdP653LqplMwQ7tHGbs,7998
|
|
22
|
-
diffct_mlx/operators.py,sha256=
|
|
22
|
+
diffct_mlx/operators.py,sha256=tiSQeVv_5LD8QrLtbSygIUBTFc15vUxkv7Fg9BFcAHw,16339
|
|
23
23
|
diffct_mlx/projectors.py,sha256=IzzZILzHFzPCQNn8Q-x7N5Soeas3PeK7612ERYtnH9U,3308
|
|
24
24
|
diffct_mlx/real_measured_data_helper.py,sha256=ave4mnbvtGX4ZrPrE8Ut5JwbXpYi9CbFiZVyGmaHREQ,21610
|
|
25
25
|
diffct_mlx/rebinning.py,sha256=dWdznfkUelteohk2G3kV8BERhhLzw8RSD3gsoKWOgM8,15802
|
|
@@ -34,9 +34,9 @@ diffct_mlx/backend/metal/geometry.py,sha256=1DfvS5xsb9B7uppXSwY_yrY2KQm6jH3LTU_W
|
|
|
34
34
|
diffct_mlx/backend/metal/projectors.py,sha256=yj8xJc1gz7clkTkG8hIevglDbNIl17uBaSWK0YNVg70,40969
|
|
35
35
|
diffct_mlx/backend/metal/utils.py,sha256=5QHUR1aB0cZEIKMp5Owh5Np8jMdQAlqLH_88R_DoRHk,1620
|
|
36
36
|
diffct_mlx/backend/metal/kernels/__init__.py,sha256=WjAyLbIqGPJzZLdXU6dgN8Et-JveYGcYi569OFRSUig,1295
|
|
37
|
-
diffct_mlx/backend/metal/kernels/cone_beam.py,sha256=
|
|
38
|
-
diffct_mlx/backend/metal/kernels/fan_beam.py,sha256=
|
|
39
|
-
diffct_mlx/backend/metal/kernels/parallel_beam.py,sha256=
|
|
37
|
+
diffct_mlx/backend/metal/kernels/cone_beam.py,sha256=alZZ4K5bsWRr09uw_P7ocg7EhfowI_WjMlFvgiCydcM,42702
|
|
38
|
+
diffct_mlx/backend/metal/kernels/fan_beam.py,sha256=bZ2iGBNfDsFXv309-hq1JckmuwG7PFgsgyl_psk7Rq0,16848
|
|
39
|
+
diffct_mlx/backend/metal/kernels/parallel_beam.py,sha256=OWo2HhNSIL3xURVIGpQ3zLTWZPrbbN6RxH8I9CcPHHk,14325
|
|
40
40
|
diffct_mlx/orchestration/__init__.py,sha256=wdtvwS6h8WhTfFIJnmVtDL0XCh6XiQ4Sz8d4ysbnmkY,1225
|
|
41
41
|
diffct_mlx/orchestration/out_of_core.py,sha256=Alzx9QH_bCTM0kkG0hRhencMCstpk-UPK4O0m5w0EYg,49510
|
|
42
42
|
diffct_mlx/phantoms/__init__.py,sha256=sGCCVKStcPuyr-MKIedEVdkqT6v0uHFNNoWfeXiYtQ4,296
|
|
@@ -45,24 +45,24 @@ diffct_mlx/phantoms/shepp_logan.py,sha256=UYgWehw_elB5aEuqXrZkc0AtS7CFnolejrhkID
|
|
|
45
45
|
diffct_mlx/physics/__init__.py,sha256=_oUFXO1Kw7zO58jFXUts6vLxhBitGKCObJyoPVnmDPg,2041
|
|
46
46
|
diffct_mlx/physics/corrections.py,sha256=6CA6iYgggUVQYHJgV8tyJSIirsWaz9lNCWy0X9m1jps,7260
|
|
47
47
|
diffct_mlx/physics/pipeline.py,sha256=FYOSZAue6xSMwzAycD5N69DmBMbD3pcBt3b94w2yeVU,4463
|
|
48
|
-
diffct_mlx/physics/simulate.py,sha256=
|
|
48
|
+
diffct_mlx/physics/simulate.py,sha256=KK6UlppTbG8VyXgTNO1cbv_Ke2Dx7rvJxIY2m64hYgY,13071
|
|
49
49
|
diffct_mlx/physics/spectra.py,sha256=PPoZkt8L16hj_BLeJRlu0OM9HP7RoIZjCyL4pvBn8OE,5718
|
|
50
50
|
diffct_mlx/physics/data/spectra.npz,sha256=Aai7GHcalwD0xzyjSQ6S9bcvBwxKg0ZnsaPIjLzN1H0,16764
|
|
51
|
-
diffct_mlx/reconstruction_algorithms/__init__.py,sha256=
|
|
52
|
-
diffct_mlx/reconstruction_algorithms/_analytic.py,sha256=
|
|
51
|
+
diffct_mlx/reconstruction_algorithms/__init__.py,sha256=7_4HgPf0NICmIM_RpeDs7iXvSeswQc7yw_afzjDweMY,3773
|
|
52
|
+
diffct_mlx/reconstruction_algorithms/_analytic.py,sha256=tp5x4B_G1Zhm761QGZMp5gRX9XadcYfCjbUphOQ8fLY,7445
|
|
53
53
|
diffct_mlx/reconstruction_algorithms/_core.py,sha256=eRp4RB6PIKXe4ASgyJRbHb5TFigsEi53iXsSZVoH3Y4,40196
|
|
54
54
|
diffct_mlx/reconstruction_algorithms/_solver.py,sha256=K29fsM1Q5KCR1SU9lDBIVpKWh1mCpS1br6IZTto2ZbQ,6557
|
|
55
55
|
diffct_mlx/reconstruction_algorithms/asd_pocs.py,sha256=c0VOY5rD2nf5bmJvgpErERZbfNTsOqXfmP6Jk053d_o,3639
|
|
56
56
|
diffct_mlx/reconstruction_algorithms/awtv_pocs.py,sha256=tJ5-ywA0IvwwxXDbcBDAzLUzOHR_x3RfGSsz034LVWo,3571
|
|
57
|
-
diffct_mlx/reconstruction_algorithms/cases.py,sha256=
|
|
57
|
+
diffct_mlx/reconstruction_algorithms/cases.py,sha256=NpYq4VK3rtzEu6q8ytMFf8ySbo1AZkbawl-pu1QbDdo,45498
|
|
58
58
|
diffct_mlx/reconstruction_algorithms/dart.py,sha256=hFqRLOogUaQYS2Gmjkq3kyKl6QcKlhKhm3OGH-8nAAA,17352
|
|
59
|
-
diffct_mlx/reconstruction_algorithms/fbp.py,sha256=
|
|
60
|
-
diffct_mlx/reconstruction_algorithms/fdk.py,sha256=
|
|
59
|
+
diffct_mlx/reconstruction_algorithms/fbp.py,sha256=LR2DcfSL-D2xB_XPkC9LjQVbz3w3Pf3VKPm9APJnPg8,2372
|
|
60
|
+
diffct_mlx/reconstruction_algorithms/fdk.py,sha256=2P_Uj0dwCli-uzPYT_OU4wZwe4CFbyNRhZIejGl-z88,2395
|
|
61
61
|
diffct_mlx/reconstruction_algorithms/sart.py,sha256=-v8cQplbprjJe9tZkFRaXcKk-2Na4bQzJefN1Y-tV3E,2113
|
|
62
62
|
diffct_mlx/reconstruction_algorithms/sirt.py,sha256=uMEVwXkozviUZt1hVE09rjX7nJJfN-6DM3vgfJwAAm0,1953
|
|
63
63
|
diffct_mlx/reconstruction_algorithms/solvers.py,sha256=ciGzkNfGVphCkBOlxOPXYhy76Z0HI9gOEh4hWmKgynw,14368
|
|
64
64
|
diffct_mlx/reconstruction_algorithms/tv_pocs.py,sha256=VJGvdtfYBQ4xToIRTPdrj_4YrioPnv8hSTtSC9GoGxE,2772
|
|
65
|
-
diffct_mlx-2.0.
|
|
66
|
-
diffct_mlx-2.0.
|
|
67
|
-
diffct_mlx-2.0.
|
|
68
|
-
diffct_mlx-2.0.
|
|
65
|
+
diffct_mlx-2.2.0.dist-info/METADATA,sha256=BdsAWcG4m1bKtfVFn_gA8ZD7s1e3paHuOC74_yWD4nI,25835
|
|
66
|
+
diffct_mlx-2.2.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
67
|
+
diffct_mlx-2.2.0.dist-info/licenses/LICENSE,sha256=a1fjzGs44LpDnV_LmA2Tzp8z-eJKoNVVdLOnh-F6J6E,11344
|
|
68
|
+
diffct_mlx-2.2.0.dist-info/RECORD,,
|
|
File without changes
|