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

Template making with AFNI and NIFTI formats #407

Open
wants to merge 1 commit into
base: dask_master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/python_scripts/afnipy/afni_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,17 @@ def to_afni(self, new_view=''):
self.extension = '' # clear
return

def to_NIFTI(self, ext='.nii.gz'):
"""modify to be NIFTI type, possibly with gz compression"""

# already NIFTI
if self.type == 'NIFTI': return

self.type = 'NIFTI'
self.view = ''
self.extension = ext
return

@property
def bn(self):
"Returns 'basename' regardless of file format: no view or extension."
Expand Down Expand Up @@ -689,12 +700,12 @@ def __init__(self, com, eo="", capture=0, save_hist=1):
# behavior is not performed.
false_vals = ['no','n','f','false',"0"]
mod_request = os.environ.get("NO_CMD_MOD")
no_cmd_modiifcation_requested = bool(
no_cmd_modification_requested = bool(
mod_request and mod_request.lower() not in false_vals
)
#If command line is long, trim it, if possible
l1 = len(self.com)
if no_cmd_modiifcation_requested:
if no_cmd_modification_requested:
# does not modify command to help provide more predictable output
self.trimcom = self.com
elif (l1 > 80):
Expand Down Expand Up @@ -1224,6 +1235,7 @@ def shell_exec2(s, capture=0):
so = []
se = []
else:
print("Probably here before sending shell command")
pipe = SP.Popen(s,shell=True, stdout=SP.PIPE, stderr=SP.PIPE, close_fds=True)
o,e = pipe.communicate() #This won't return until command is over
status = pipe.returncode #NOw get returncode
Expand Down
Loading