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

Add CLI for transforming files (and minor nsd_mapdata.py tweak) #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kjamison
Copy link

Tweak mapdata to bypass nsdpath and accept transform file

@kjamison kjamison changed the title Add CLI for transforming files (with nsd_mapdata.py tweak) Add CLI for transforming files (and minor nsd_mapdata.py tweak) Mar 15, 2021
@iancharest
Copy link
Collaborator

Hey that's a great idea!
Perhaps it would be useful to modify the setup file with an entry point for the console?

entry_points={
        'console_scripts': [
            'nsdmapdata = nsdmapcli:main',
        ],
    },

Otherwise the code looks good and should be useful indeed. Maybe worth adding an example of how to use it straight from the console?

e.g. if we make the change to the setup script, then it would be :

nsdmapdata -h

to get some help on how to use?

@kjamison
Copy link
Author

Updated accordingly (See the updated commit) Wasn't sure where to include the example usage, but it would be something like:
nsdmapdata --sourcespace MNI --targetspace func1pt8 --inputfile atlas_in_MNI.nii.gz --outputfile atlas_in_subj01.nii.gz --interptype nearest --nsdlocation <mynsdfolder> --subjix 1
or
nsdmapdata --sourcespace MNI --targetspace func1pt8 --inputfile atlas_in_MNI.nii.gz --outputfile atlas_in_subj01.nii.gz --interptype nearest --transformfile <mynsdfolder>/ppdata/subj01/transforms/MNI-to-func1pt8.nii.gz

@kjamison
Copy link
Author

Oh I see you just meant the help info. Currently that looks like:

$ nsdmapdata -h
usage: nsdmapdata [-h] --sourcespace SOURCESPACE --targetspace TARGETSPACE
                  --inputfile INPUTFILE --outputfile OUTPUTFILE
                  [--nsdlocation BASEDIR] [--subjix SUBJIX]
                  [--interptype {nearest,linear,cubic,wta,surfacewta}]
                  [--badval BADVAL] [--outputclass OUTPUTCLASS]
                  [--fsdir FSDIR] [--transformfile TRANSFORMFILE]

Transform NSD data from the command line

optional arguments:
  -h, --help            show this help message and exit
  --sourcespace SOURCESPACE
                        One of the volume/surface space options below
  --targetspace TARGETSPACE
                        One of the volume/surface space options below
  --inputfile INPUTFILE
                        Input file in <sourcespace>
  --outputfile OUTPUTFILE
                        Output file in <targetspace>
  --nsdlocation BASEDIR
                        Directory containing ppdata/, etc
  --subjix SUBJIX       NSD subject index 1-8
  --interptype {nearest,linear,cubic,wta,surfacewta}
                        default: 'cubic'. See nsd_mapdata.py for wta details
  --badval BADVAL
  --outputclass OUTPUTCLASS
  --fsdir FSDIR
  --transformfile TRANSFORMFILE
                        Manually-specified transformation file (ignores
                        --nsdlocation and --subjix)

--sourcespace and --targetspace options include: anat0pt5, anat0pt8, anat1pt0,
func1pt0, func1pt8, MNI, [lh,rh].white, [lh,rh].pial, [lh,rh].layerB1,
[lh,rh].layerB2, [lh,rh].layerB3, fsaverage

@iancharest iancharest self-requested a review March 16, 2021 16:58
Copy link
Collaborator

@iancharest iancharest left a comment

Choose a reason for hiding this comment

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

This look good. I will push new version to pip soon.

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.

2 participants