Fmriprep: [URGENT] Degenerate derivatives

Created on 27 Apr 2018  路  5Comments  路  Source: nipreps/fmriprep

Since #1001 was merged in, the bold derivatives (at least the space-MNI... ones) are broken.

My intuition is that these changes on the Datasink introduced some problem https://github.com/poldracklab/fmriprep/compare/744de95e8c21...677c55647547#diff-7bf7d3ca48aa501c95ee753280fb3ee1

If I track back the files to the node that feeds the datasink, they look okay.

bug

All 5 comments

@mgxd can you/would you like to submit a fix?

I think if we do ext.endswith('.gz') and not fname.endswith('.gz'), that would work, but I guess we should actually make a smarter copy, like:

def copy_any(src, dst):
    src_gz = src.endswith('.gz')
    dst_gz = dst.endswith('.gz')
    if src_gz == dst_gz:
        copy(src, dst)
    src_open = gzip.open if src_gz else open
    dst_open = gzip.open if dst_gz else open
    with src_open(src, 'rb') as f_in:
        with dst_open(dst, 'wb') as f_out:
            copyfileobj(f_in, f_out)

And if we want to permit hardlinks, nipype's utils.filemanip.copyfile would be a good alternative to shutil.copy.

Closed via #1077

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ptubiolo37 picture ptubiolo37  路  4Comments

ritcheym picture ritcheym  路  3Comments

ins0mniac2 picture ins0mniac2  路  5Comments

manishsaggar1 picture manishsaggar1  路  5Comments

oesteban picture oesteban  路  4Comments