Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In CompCor, extraction of unit information from image header fails #2456

Closed
eort opened this issue Feb 22, 2018 · 4 comments
Closed

In CompCor, extraction of unit information from image header fails #2456

eort opened this issue Feb 22, 2018 · 4 comments

Comments

@eort
Copy link
Contributor

eort commented Feb 22, 2018

Summary

Hi,
When using fmriprep (1.0.6), I bumped into an error in the confound workflow. For both aCompCor as well as tCompCor the script failed when trying to extract TR information from the header of the input image. After having a look at the part of the code that threw the error, I think the problem is that nipype uses nibabel's get_xyzt_units()to directly extract the information from the image, rather than the header, so that the script crashes with an AttributeError.

Actual behavior

The script excepts with an ValueError, caused by an AttributeError when running the block:

         try:
                    TR = imgseries.header.get_zooms()[3]
                    if imgseries.get_xyzt_units()[1] == 'msec':
                        TR /= 1000
                except (AttributeError, IndexError):
                    TR = 0

                if TR == 0:
                    raise ValueError(
                        '{} cannot detect repetition time from image - '
                          'Set the repetition_time input'.format(self._header))

Expected behavior

The line imgseries.get_xyzt_units()[1] == 'msec' should evaluate to true or false

Please put URL to code or code here (if not too long).
https://github.com/nipy/nipype/blob/master/nipype/algorithms/confounds.py#L535

Platform details:

I ran that code from within fmriprep v1.0.6

I'll send a pull request with a suggested fix.

@effigies
Copy link
Member

Good catch, thanks. Opened #2457.

@effigies
Copy link
Member

Oh, if you're going to submit a PR, feel free. (I didn't read that far before making my edit.)

@eort
Copy link
Contributor Author

eort commented Feb 22, 2018

And I didn't read yours in time, now there are 2 PRs...

@effigies
Copy link
Member

No worries. I closed mine in favor of yours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants