Skip to content

Commit

Permalink
doc and test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentBeaud committed Dec 17, 2024
1 parent d51543d commit ba80d07
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
10 changes: 6 additions & 4 deletions scilpy/tractanalysis/fibertube_scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ def fibertube_density(sft, samples_per_voxel_axis, verbose=False):
Estimates the per-voxel volumetric density of a set of fibertubes. In other
words, how much space is occupied by fibertubes and how much is emptiness.
Works by building a binary mask segmenting voxels that contain at least
a single fibertube. Then, valid voxels are finely sampled and we count the
number of samples that landed within a fibertube. For each voxel, this
number is then divided by its total amount of samples.
1. Segments voxels that contain at least a single fibertube.
2. Valid voxels are finely sampled and we count the number of samples that
landed within a fibertube. For each voxel, this number is then divided by
its total amount of samples.
3. By doing the same steps for samples that landed within 2 or more
fibertubes, we can create a density map of the fibertube collisions.
Parameters
----------
Expand Down
10 changes: 6 additions & 4 deletions scripts/scil_fibertube_compute_density.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
Estimates the per-voxel volumetric density of a set of fibertubes. In other
words, how much space is occupied by fibertubes and how much is emptiness.
Works by building a binary mask segmenting voxels that contain at least
a single fibertube. Then, valid voxels are finely sampled and we count the
number of samples that landed within a fibertube. For each voxel, this
number is then divided by its total amount of samples.
1. Segments voxels that contain at least a single fibertube.
2. Valid voxels are finely sampled and we count the number of samples that
landed within a fibertube. For each voxel, this number is then divided by
its total amount of samples.
3. By doing the same steps for samples that landed within 2 or more
fibertubes, we can create a density map of the fibertube collisions.
See also:
- docs/source/documentation/fibertube_tracking.rst
Expand Down
11 changes: 10 additions & 1 deletion scripts/tests/test_fibertube_compute_density.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,23 @@ def test_help_option(script_runner):
assert ret.success


def test_execution(script_runner, monkeypatch):
def test_execution_density(script_runner, monkeypatch):
monkeypatch.chdir(os.path.expanduser(tmp_dir.name))
init_data()
ret = script_runner.run('scil_fibertube_compute_density.py',
'fibertubes.trk',
'--out_density_map', 'density_map.nii.gz',
'--out_density_measures',
'density_measures.json',
'-f')
assert ret.success


def test_execution_collisions(script_runner, monkeypatch):
monkeypatch.chdir(os.path.expanduser(tmp_dir.name))
init_data()
ret = script_runner.run('scil_fibertube_compute_density.py',
'fibertubes.trk',
'--out_collision_map', 'collision_map.nii.gz',
'--out_collision_measures',
'collision_measures.json',
Expand Down

0 comments on commit ba80d07

Please sign in to comment.