Skip to content

Commit

Permalink
Merge pull request #232 from oesteban/fix/icaaroma-reports
Browse files Browse the repository at this point in the history
[FIX] ValueError: invalid literal for int()
  • Loading branch information
oesteban authored May 3, 2018
2 parents 915af89 + a477b17 commit 340ceea
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions niworkflows/viz/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,10 @@ def plot_melodic_components(melodic_dir, in_file, tr=None,
width_ratios=[1, 1, 1, 4, 0.001, 1, 1, 1, 4, ],
height_ratios=[1.1, 1] * n_rows)

noise_components = None
if noise_components_file:
with open(noise_components_file) as cf:
noise_components = [int(c) for c in cf.read().split(",")]
noise_components = np.loadtxt(noise_components_file,
dtype=int, delimiter=',', ndmin=1)

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

if noise_components_file:
if (i + 1) in noise_components:
color_title = color_time = color_power = 'r'
else:
color_title = color_time = color_power = 'g'
else:
color_title = 'k'
color_time = current_palette[0]
color_power = current_palette[1]
# Set default colors
color_title = 'k'
color_time = current_palette[0]
color_power = current_palette[1]

if noise_components.size > 0:
# If a noise components list is provided, assign red/green
color_title = color_time = color_power = (
'r' if (i + 1) in noise_components else 'g')

data = img.get_data()
for j in range(3):
Expand Down

0 comments on commit 340ceea

Please sign in to comment.