Skip to content

Commit

Permalink
Merge pull request #224 from EmmaRenauld/back_to_master_scilpy
Browse files Browse the repository at this point in the history
Back to master scilpy
  • Loading branch information
EmmaRenauld authored Feb 1, 2024
2 parents 1db1836 + a0e364d commit de48e0a
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 19 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,5 @@ target/
*.swo

# dwi_ml stuff
.ipynb_config/
.ipynb_config/
.ipynb_checkpoints/
3 changes: 2 additions & 1 deletion dwi_ml/data/processing/dwi/dwi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
from dipy.reconst.shm import sph_harm_lookup
import nibabel as nib
import numpy as np

from scilpy.io.utils import validate_sh_basis_choice
from scilpy.reconst.raw_signal import compute_sh_coefficients
from scilpy.reconst.sh import compute_sh_coefficients

eps = 1e-6

Expand Down
3 changes: 2 additions & 1 deletion dwi_ml/data/processing/streamlines/data_augmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from nibabel.streamlines.tractogram import (PerArrayDict, PerArraySequenceDict)
import numpy as np

from scilpy.tracking.tools import resample_streamlines_step_size
from scilpy.tractograms.streamline_operations import \
resample_streamlines_step_size
from scilpy.utils.streamlines import compress_sft


Expand Down
2 changes: 1 addition & 1 deletion dwi_ml/data/processing/streamlines/post_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from scilpy.tractanalysis.tools import \
extract_longest_segments_from_profile as segmenting_func
from scilpy.tractanalysis.uncompress import uncompress
from scilpy.tractograms.uncompress import uncompress

# We could try using nan instead of zeros for non-existing previous dirs...
DEFAULT_UNEXISTING_VAL = torch.zeros((1, 3), dtype=torch.float32)
Expand Down
3 changes: 2 additions & 1 deletion dwi_ml/testing/projects/transformer_visualisation_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

from scilpy.io.streamlines import load_tractogram_with_reference
from scilpy.io.utils import add_reference_arg, add_overwrite_arg, add_bbox_arg
from scilpy.tracking.tools import resample_streamlines_step_size
from scilpy.tractograms.streamline_operations import \
resample_streamlines_step_size
from scilpy.utils.streamlines import compress_sft

from dwi_ml.io_utils import add_logging_arg
Expand Down
6 changes: 3 additions & 3 deletions dwi_ml/tracking/io_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,18 @@ def prepare_seed_generator(parser, args, hdf_handle):
seed_generator = SeedGenerator(seed_data, seed_res, space=ALWAYS_VOX_SPACE,
origin=ALWAYS_CORNER)

if len(seed_generator.seeds_vox) == 0:
if len(seed_generator.seeds_vox_corner) == 0:
parser.error('Seed mask "{}" does not have any voxel with value > 0.'
.format(args.in_seed))

if args.npv:
# Note. Not really nb seed per voxel, just in average.
nbr_seeds = len(seed_generator.seeds_vox) * args.npv
nbr_seeds = len(seed_generator.seeds_vox_corner) * args.npv
elif args.nt:
nbr_seeds = args.nt
else:
# Setting npv = 1.
nbr_seeds = len(seed_generator.seeds_vox)
nbr_seeds = len(seed_generator.seeds_vox_corner)

seed_header = nib.Nifti1Image(seed_data, affine).header

Expand Down
5 changes: 2 additions & 3 deletions dwi_ml/tracking/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,9 @@ def _gpu_simultaneous_tracking(self):
if seed_count + nb_next_seeds > self.nbr_seeds:
nb_next_seeds = self.nbr_seeds - seed_count

next_seeds = np.arange(seed_count, seed_count + nb_next_seeds)

n_seeds = self.seed_generator.get_next_n_pos(
random_generator, indices, next_seeds)
random_generator, indices, which_seed_start=seed_count,
n=nb_next_seeds)

tmp_lines, tmp_seeds = \
self._get_multiple_lines_both_directions(n_seeds)
Expand Down
24 changes: 16 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
# Supported for python 3.10
# Should work for python > 3.8.

# Scilpy and comet_ml both require requests. In comet: >=2.18.*,
# which installs a version >2.28. Adding request version explicitely.
# -------
# Main dependency: scilpy
# Scilpy and comet_ml both require requests. In comet: >=2.18.*,
# which installs a version >2.28. Adding request version explicitely.
# -------
requests==2.28.*
scilpy @ git+https://github.com/scilus/[email protected]


# -------
# Other important dependencies
# -------
bertviz~=1.4.0 # For transformer's visu
torch==1.13.*
tqdm==4.64.*
comet-ml==3.21.*
contextlib2==21.6.0
jupyterlab>=3.6.2 # For transformer's visu
IProgress>=0.4 # For jupyter with tdqm
nested_lookup==0.2.25
nose==1.3.*
scilpy==1.5.post2
nested_lookup==0.2.25 # For lists management

## Necessary but should be installed with scilpy (Last check: 09/2023):
# -------
# Necessary but should be installed with scilpy (Last check: 01/2024):
# -------
future==0.18.*
h5py==3.7.* # h5py must absolutely be >2.4: that's when it became thread-safe
matplotlib==3.6.* # Hint: If matplotlib fails, you may try to install pyQt5.
nibabel==4.0.*
nibabel==5.2.*
numpy==1.23.*
scipy==1.9.*



# --------------- Notes to developers
# If we upgrade torch, verify if code copied in
# models.projects.transformers_from_torch has changed.
Expand Down

0 comments on commit de48e0a

Please sign in to comment.