Skip to content

Fix small bug/typo in misc.CreateNifti #1781

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

Merged
merged 2 commits into from
Feb 16, 2017
Merged

Conversation

alexsavio
Copy link
Contributor

Hi,

I've found a bug in misc.CreateNifti while running Camino tractography workflows.
This seems to fix it.

Cheers,
Alex

@codecov-io
Copy link

codecov-io commented Jan 16, 2017

Current coverage is 69.86% (diff: 100%)

Merging #1781 into master will increase coverage by 0.02%

@@             master      #1781   diff @@
==========================================
  Files          1047       1048     +1   
  Lines         52050      52083    +33   
  Methods           0          0          
  Messages          0          0          
  Branches       7661       7662     +1   
==========================================
+ Hits          36349      36386    +37   
+ Misses        14123      14118     -5   
- Partials       1578       1579     +1   

Powered by Codecov. Last update f11a457...4890e9a

@@ -245,7 +245,7 @@ def _run_interface(self, runtime):
else:
affine = None

with open(self.inputs.header_file, 'rb') as data_file:
with open(self.inputs.data_file, 'rb') as data_file:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this interface seems to only work with hdr/img pair files. in that space, shouldn't this be the header_file?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @alexsavio is right, here. These two lines were originally:

data = hdr.data_from_fileobj(open(self.inputs.data_file, 'rb'))

Copy link
Contributor Author

@alexsavio alexsavio Jan 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @effigies. @satra, my workflows were working until I got this update, it only worked when I added this fix. A Nipype Camino tractography example also uses CreateNifti, it probably won't work without this fix. I was thinking on adding a test, but I would need Analyze files, somehow. Any hint?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can generate them with nibabel easily enough. e.g.

analyze = nb.AnalyzeImage(np.zeros((3,4,5,6)), np.eye(4))
analyze.to_filename('test.hdr')  # Should create test.hdr/test.img

@alexsavio
Copy link
Contributor Author

Hi, This PR is ready for review. Thanks!

@satra satra merged commit 038b143 into nipy:master Feb 16, 2017
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

Successfully merging this pull request may close these issues.

4 participants