Skip to content

Commit f386cd6

Browse files
committed
saving stats in a file
1 parent c21b966 commit f386cd6

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

nipype/interfaces/afni/preprocess.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,16 +1402,16 @@ class ROIStatsInputSpec(CommandLineInputSpec):
14021402
quiet = traits.Bool(desc='execute quietly',
14031403
argstr='-quiet',
14041404
position=1)
1405-
1406-
terminal_output = traits.Enum('allatonce',
1407-
desc=('Control terminal output:'
1405+
1406+
terminal_output = traits.Enum('allatonce',
1407+
desc=('Control terminal output:'
14081408
'`allatonce` - waits till command is '
14091409
'finished to display output'),
14101410
nohash=True, mandatory=True, usedefault=True)
14111411

14121412

14131413
class ROIStatsOutputSpec(TraitedSpec):
1414-
stats = OutputMultiPath(traits.Float(), desc='output', exists=True)
1414+
stats = File(desc='output tab separated values file', exists=True)
14151415

14161416

14171417
class ROIStats(CommandLine):
@@ -1436,15 +1436,13 @@ class ROIStats(CommandLine):
14361436
output_spec = ROIStatsOutputSpec
14371437

14381438
def aggregate_outputs(self, runtime=None, needed_outputs=None):
1439-
14401439
outputs = self._outputs()
1441-
stats = []
1442-
for line in runtime.stdout.split('\n'):
1443-
if line and not line.startswith("File"):
1444-
values = line.split()
1445-
stats += [float(val) for val in values[2:]]
1446-
1447-
outputs.stats = stats
1440+
output_filename = "roi_stats.csv"
1441+
f = open(output_filename, "w")
1442+
f.write(runtime.stdout)
1443+
f.close()
1444+
1445+
outputs.stats = os.path.abspath(output_filename)
14481446
return outputs
14491447

14501448

0 commit comments

Comments
 (0)