Skip to content

Commit 7621cfb

Browse files
committed
[FIX] ValueError: invalid literal for int()
While creating the ICA-AROMA reports.
1 parent 915af89 commit 7621cfb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

niworkflows/viz/utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,9 +538,10 @@ def plot_melodic_components(melodic_dir, in_file, tr=None,
538538
width_ratios=[1, 1, 1, 4, 0.001, 1, 1, 1, 4, ],
539539
height_ratios=[1.1, 1] * n_rows)
540540

541+
noise_components = None
541542
if noise_components_file:
542-
with open(noise_components_file) as cf:
543-
noise_components = [int(c) for c in cf.read().split(",")]
543+
noise_components = np.loadtxt(noise_components_file,
544+
dtype=int, delimiter=',', ndmin=1)
544545

545546
for i, img in enumerate(
546547
iter_img(os.path.join(melodic_dir, "melodic_IC.nii.gz"))):
@@ -549,7 +550,7 @@ def plot_melodic_components(melodic_dir, in_file, tr=None,
549550
row = int(i / 2)
550551
l_row = row * 2
551552

552-
if noise_components_file:
553+
if noise_components:
553554
if (i + 1) in noise_components:
554555
color_title = color_time = color_power = 'r'
555556
else:

0 commit comments

Comments
 (0)