How to convert nipype object to python list

Hi all,

I plan to use nipype to get the voxel intensity of cope images via nipype.interfaces.fsl.utils.ImageStats. The goal is to compare stats/cope*.nii.gz with reg_standard/stats/cope*.nii.gz as suggested in Mumford’s blog (in step 7). It seems to ensure two images are exactly same I need to use fslinfo -a to list all intensities. So I use ImageStats(in_file, op_string=’-a’), and this returns me with a nipype object. I swonder how to convert it to python list or dictionary that I can easily compre? I am new to nipype so maybe I am using this in a wrong way. Thus any suggestion and help would be great appreaciated!

Best,
Shengjie

If I’m understanding correctly, you are doing:

results = ImageStats(in_file, op_string=’-a’)

But ImageStats() is an interface, which is a definition of a task. To run it, use:

stats = ImageStats(in_file, op_string=’-a’)
results = stats.run()
results.output

Thank you so much for your answer! This is exactly what I want.