Skip to content

Commit a9837b5

Browse files
committed
fix with new api
1 parent 095637c commit a9837b5

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ dependencies = [
3333
"deepdiff>=8.1,<8.7",
3434
"dipy==1.11.*",
3535
"dmri-amico==2.1.*",
36-
"dmri-commit==2.3.*",
36+
"dmri-commit==2.4.*",
3737
"docopt==0.6.*",
3838
"dvc==3.59.*",
3939
"formulaic==0.5.*",

src/scilpy/cli/scil_tractogram_commit.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,11 @@ def _save_results(args, tmp_dir, ext, in_hdf5_file, offsets_list, sub_dir,
234234

235235
# Simplifying output for streamlines and cleaning output directory
236236
streamline_weights = np.loadtxt(os.path.join(commit_results_dir,
237-
'streamline_weights.txt'))
238-
237+
'streamline_weights.txt'))
239238
# Loading the tractogram (we never did yet! Only sent the filename to
240239
# commit). Reminder. If input was a hdf5, we have changed
241240
# args.in_tractogram to our tmp_tractogram saved in tmp_dir.
242-
if ext == '.trk' and args.reference is None:
241+
if ext in ['.trk', '.h5'] and args.reference is None:
243242
args.reference = 'same'
244243
logging.debug('Loading tractogram from {} with reference {}.'
245244
.format(args.in_tractogram, args.reference))
@@ -261,7 +260,7 @@ def _save_results(args, tmp_dir, ext, in_hdf5_file, offsets_list, sub_dir,
261260
'tot_commit_w'
262261
# Reload is needed because of COMMIT handling its file by itself
263262
sft.data_per_streamline[dps_key] = streamline_weights
264-
sft.data_per_streamline[dps_key_tot] = streamline_weights * length_list
263+
sft.data_per_streamline[dps_key_tot] = np.squeeze(streamline_weights) * length_list
265264

266265
if args.keep_whole_tractogram:
267266
output_filename = os.path.join(out_dir, 'tractogram.trk')
@@ -391,7 +390,6 @@ def main():
391390

392391
# Prepare tmp dir for all our intermediate files
393392
tmp_dir = tempfile.TemporaryDirectory()
394-
395393
# === Loading ===
396394
dwi_img = nib.load(args.in_dwi)
397395

@@ -443,8 +441,7 @@ def main():
443441

444442
# Preparation for fitting
445443
commit.core.setup()
446-
mit = commit.Evaluation('.', '.')
447-
444+
mit = commit.Evaluation('.', '.', dictionary_path=tmp_dir.name)
448445
# FIX for very small values during HCP processing
449446
# (based on order of magnitude of signal)
450447
data = dwi_img.get_fdata(dtype=np.float32)
@@ -476,7 +473,7 @@ def main():
476473
return
477474
mit.load_kernels()
478475
use_mask = args.in_tracking_mask is not None
479-
mit.load_dictionary(tmp_dir.name, use_all_voxels_in_mask=use_mask)
476+
mit.load_dictionary(None, use_all_voxels_in_mask=use_mask)
480477
mit.set_threads(args.nbr_processes)
481478
mit.set_verbose(False)
482479

0 commit comments

Comments
 (0)