[Neuroimaging] FmriRealign4D: how to make it write files?

Katie Surrence katiesurrence at gmail.com
Fri Sep 18 20:13:24 CEST 2015


Dear all,

I asked this question on neurostars, but haven't received a reply, so I
thought I'd try here.

When I run a program containing this code snippet:

______________________

for sub in subjects.keys():
    for run in subjects[sub]:
        infile = os.path.join(root, sub, 'func', run, '4D.nii')
        realigner = FmriRealign4d()
        realigner.inputs.in_file = [infile]
        realigner.inputs.tr = 2.2
        realigner.inputs.slice_order = range(0, 34, 2) + range(1, 35, 2)
        realigner.inputs.time_interp = True
        outfile = os.path.join(root, sub, 'func', run, 'ra4D.nii')
        f = open(outfile, 'w')
        f.close()
        realigner._out_file = [outfile]
        parfile = os.path.join(root, sub, 'func', run, 'motpar.txt')
        p = open(parfile, 'w')
        p.close()
        realigner._par_file = [parfile]
        res = realigner.run()

________________

I get a bunch of output to the console to indicate realignment/slice timing
is happening, but the only changes on disk are that my files are created.
They remain at zero bytes.  (Specifying the _out_file and _par_file
attributes and making empty versions of the files were things I tried to
coax it into writing files. My original version did neither of these things
and had the same problem.)

I appreciate any help you can provide.

Best,
Katie

-- 
Katie Surrence, M.S.
Research Coordinator
Social Cognition Laboratory
New York State Psychiatric Institute
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20150918/b1a87bc7/attachment.html>


More information about the Neuroimaging mailing list