Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Reading freesurfer stats files correctly#1152

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
simkarwin wants to merge7 commits intonipy:master
base:master
Choose a base branch
Loading
fromsimkarwin:master

Conversation

@simkarwin
Copy link

No description provided.

there was a problem with reading the stats files
@effigies
Copy link
Member

A couple thoughts:

  1. Why a class with only static methods? I think flat functions would make more sense and be consistent with this module.

  2. Is it possible to do what you want with plain numpy? Pandas is a very heavy dependency that we are unlikely to make an installation requirement.

@simkarwin
Copy link
Author

The code has been revised regard to your comments

@codecov
Copy link

codecovbot commentedDec 10, 2022
edited
Loading

Codecov Report

Attention: Patch coverage is35.71429% with9 lines in your changes missing coverage. Please review.

Project coverage is 95.33%. Comparing base(276f786) to head(02334f4).

Files with missing linesPatch %Lines
nibabel/freesurfer/io.py35.71%9 Missing⚠️
Additional details and impacted files
@@            Coverage Diff             @@##           master    #1152      +/-   ##==========================================- Coverage   95.36%   95.33%   -0.03%==========================================  Files         207      207                Lines       29680    29694      +14       Branches     4992     4996       +4     ==========================================+ Hits        28305    28310       +5- Misses        935      944       +9  Partials      440      440

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

Copy link
Member

@effigieseffigies left a comment

Choose a reason for hiding this comment

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

Thanks for this. I've made a couple comments.

A larger question is whether this is intended to be for any stats files in FreeSurfer, or just the ones generated bymris_anatomical_stats? We might want to do some detecting of the kind of stats in order to correctly build a dtype. I imagine a column header -> dtype lookup table would not be too difficult to construct.

What do you think?

Examples
--------
>>> stats_a2009, column_names = read_stats_file(r'lh.aparc.a2009s.stats')
Copy link
Member

Choose a reason for hiding this comment

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

If we're going to have example code, it needs to run. We could drop an example file innibabel/tests/data/ and access it with

fromnibabel.testingimporttest_datastats_a2009=read_stats_file(test_data(fname='lh.aparc.a2009s.stats'))

simkarwinand others added4 commitsApril 5, 2023 03:53
Co-authored-by: Chris Markiewicz <effigies@gmail.com>
Co-authored-by: Chris Markiewicz <effigies@gmail.com>
Comment on lines +662 to +666
stats_left,columns_left=read_stats_file(file_path.replace('rh','lh'))
stats_right,columns_right=read_stats_file(file_path.replace('lh','rh'))
stats_both_hemispheres=np.concatenate((stats_left,stats_right[:,1:]),axis=1)
column_names= [col_name+'_left'forcol_nameincolumns_left]+ [col_name+'_right'forcol_namein
columns_right[1:]]
Copy link
Member

Choose a reason for hiding this comment

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

You're no longer returning column names. I think you can usenumpy.lib.recfunctions.join_by to do what you want.

I would also use the following pattern for doctests:

    ..testsetup::        >>>import os        >>>from nibabel.testingimport get_test_data        >>>cwd= os.getcwd()        >>>os.chdir(get_test_data())    >>>stats_a2009= read_stats_file_both_hemispheres(r'lh.aparc.a2009s.stats')    ..testcleanup::        >>>os.chdir(cwd)

@effigies
Copy link
Member

@simkarwin Sorry about the long radio silence. Any interest in finishing this up?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@effigieseffigieseffigies left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@simkarwin@effigies

[8]ページ先頭

©2009-2025 Movatter.jp