dwidenoise: Patch2Self reference on the ds005134 slab
Browse files
dwidenoise/validation/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# dwidenoise validation: Patch2Self reference on the ds005134 slab
|
| 2 |
+
|
| 3 |
+
| File | Content |
|
| 4 |
+
| --- | --- |
|
| 5 |
+
| `sub-01_dir-AP_desc-slabpatch2self_dwi.nii.gz` | Patch2Self output of the noddi example slab, float32, 67 × 92 × 10 × 137 |
|
| 6 |
+
|
| 7 |
+
## Input
|
| 8 |
+
|
| 9 |
+
`noddi/examples/sub-01_dir-AP_desc-slab_dwi.nii.gz` with its `.bval` in this dataset
|
| 10 |
+
(OpenNeuro ds005134 sub-01, CC0; see `noddi/examples/README.md`). The input is not copied here.
|
| 11 |
+
Input SHA-256: `1e7c8461d9bfc3c80633f930dc1df16d892a6bfd5e15db4c5a2be9d021e48d00`.
|
| 12 |
+
Volumes: 13 b0, 12 × b500, 48 × b1000, 64 × b2000.
|
| 13 |
+
|
| 14 |
+
## Method
|
| 15 |
+
|
| 16 |
+
Patch2Self (Fadnavis et al., NeurIPS 2020), DIPY version 1 with patch radius 0: each volume
|
| 17 |
+
is predicted by ordinary least squares with an intercept from the other volumes of its group,
|
| 18 |
+
fitted over all voxels (no mask) and applied to all voxels. The b0 volumes (bval <= 50) and
|
| 19 |
+
the DWI volumes are two separate groups. No intensity shift, no clipping.
|
| 20 |
+
|
| 21 |
+
Software: DIPY 1.12.1, scikit-learn 1.9.1, NumPy 2.5.4, Python 3.12.13, Linux x86-64.
|
| 22 |
+
The input was read as float64 (`get_fdata(dtype=np.float64)`), computed in float64, and cast
|
| 23 |
+
to float32 for this file (largest rounding change 3.1e-5). The NIfTI header is the input's
|
| 24 |
+
header with the data type set to float32 and slope 1, intercept 0.
|
| 25 |
+
|
| 26 |
+
```python
|
| 27 |
+
from dipy.denoise.patch2self import patch2self
|
| 28 |
+
from sklearn import linear_model
|
| 29 |
+
from sklearn.base import BaseEstimator
|
| 30 |
+
|
| 31 |
+
linear_model.BaseEstimator = BaseEstimator # see note 1
|
| 32 |
+
model = linear_model.Ridge(alpha=1e-10, copy_X=True)
|
| 33 |
+
den = patch2self(data, bvals, model=model, b0_threshold=50, version=1, patch_radius=0)
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
### Notes
|
| 37 |
+
|
| 38 |
+
1. DIPY 1.12.1 accepts a model instance only when it is an instance of
|
| 39 |
+
`sklearn.linear_model.BaseEstimator`. scikit-learn 1.9 does not export that name, so the
|
| 40 |
+
alias is set to `sklearn.base.BaseEstimator` before the call. This changes nothing else.
|
| 41 |
+
2. The model is given explicitly because `model="ols"` in DIPY 1.12.1 makes
|
| 42 |
+
`Ridge(alpha=1e-10, copy_X=False)`. With `copy_X=False`, scikit-learn centres the regressor
|
| 43 |
+
array in place during `fit`, and version 1 then calls `predict` on the centred array. Each
|
| 44 |
+
output volume then has a constant error equal to `mean(X) . w` (about 46 signal units on
|
| 45 |
+
this data; RMSE / raw noise 5.4 on the simulation). The fit itself is the same: the
|
| 46 |
+
`model="ols"` output plus that per-volume constant equals this file's float64 values to
|
| 47 |
+
4e-14 of the signal range. Version 3 (the DIPY default) is not affected.
|
| 48 |
+
3. An independent float64 implementation (Gram matrix of the volumes in one pass, Cholesky
|
| 49 |
+
solve per volume, `spec.py` in the dwidenoise port) reproduces the float64 values to
|
| 50 |
+
2.3e-14 of the signal range (largest absolute difference 1.4e-11).
|
| 51 |
+
|
| 52 |
+
## Checksums
|
| 53 |
+
|
| 54 |
+
`SHA256SUMS` lists the files in this directory. Upload under `dwidenoise/validation/` and pin
|
| 55 |
+
the commit in the app's manifest.
|
dwidenoise/validation/SHA256SUMS
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
c2de8805d3102e946b016de5697857c899691d2990fc7a402bcac2777d80dde3 sub-01_dir-AP_desc-slabpatch2self_dwi.nii.gz
|
| 2 |
+
668e064dd5987bbd68bc109290aab210cc632a492deeec88e866dd2dc76d034d README.md
|
dwidenoise/validation/sub-01_dir-AP_desc-slabpatch2self_dwi.nii.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c2de8805d3102e946b016de5697857c899691d2990fc7a402bcac2777d80dde3
|
| 3 |
+
size 30444645
|