Open darya-chyzhyk opened 8 years ago
This is very weird. Can you run this in your terminal?
python -c 'import nibabel; print(nibabel.__version__)'
1.3.0
In version 1.3, the header is img._header
and not img.header
.
A safe workaround is to use img.get_header()
.
+1. Somebody wants to take on this ?
On Tue, Aug 9, 2016 at 11:14 AM, Alexandre Abraham <notifications@github.com
wrote:
In version 1.3, the header is img._header and not img.header.
A safe workaround is to use img.get_header().
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/neurospin/pypreprocess/issues/246#issuecomment-238497968, or mute the thread https://github.com/notifications/unsubscribe-auth/AAms1IVPh0ngw84k_gd1GOa0iH_E0Wnbks5qeETagaJpZM4Jf3HJ .
Elvis Dohmatob, sent from my potato... http://dohmatob.blogspot.fr/, https://team.inria.fr/parietal/elvis/, https://github.com/dohmatob
The deletete_orientation function has to be rewritten from scratch. It looks horrible, and can break in a 1000 different ways.
On Tue, Aug 9, 2016 at 11:15 AM, Elvis Dohmatob gmdopp@gmail.com wrote:
+1. Somebody wants to take on this ?
On Tue, Aug 9, 2016 at 11:14 AM, Alexandre Abraham < notifications@github.com> wrote:
In version 1.3, the header is img._header and not img.header.
A safe workaround is to use img.get_header().
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/neurospin/pypreprocess/issues/246#issuecomment-238497968, or mute the thread https://github.com/notifications/unsubscribe-auth/AAms1IVPh0ngw84k_gd1GOa0iH_E0Wnbks5qeETagaJpZM4Jf3HJ .
Elvis Dohmatob, sent from my potato... http://dohmatob.blogspot.fr/, https://team.inria.fr/parietal/elvis/, https://github.com/dohmatob
Elvis Dohmatob, sent from my potato... http://dohmatob.blogspot.fr/, https://team.inria.fr/parietal/elvis/, https://github.com/dohmatob
@dohmatob the function does not seem that bad to me... Can you be more precise?
Mainly design issues.
N.B.: I understand that who ever implemented this function inherited from a very bad code base from me.
On Tue, Aug 9, 2016 at 11:32 AM, Alexandre Abraham <notifications@github.com
wrote:
@dohmatob https://github.com/dohmatob the function does not seem that bad to me... Can you be more precise?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/neurospin/pypreprocess/issues/246#issuecomment-238502203, or mute the thread https://github.com/notifications/unsubscribe-auth/AAms1NkRozaK374EpMtI3m3K1FKvG1spks5qeEkRgaJpZM4Jf3HJ .
Elvis Dohmatob, sent from my potato... http://dohmatob.blogspot.fr/, https://team.inria.fr/parietal/elvis/, https://github.com/dohmatob
The neverending issue!
The error appear when using delete orientation option
Should orientation meta-date be stripped-off image headers ? deleteorient = True
Executing node d703e8c3dea596ceef853fee8927d1f3 in dir: /home/darya/Documents/Inria/data/ADNIDOD_example/results/0006315/cache_dir/nipype_mem/nipype-interfaces-spm-preprocess-Realign/d703e8c3dea596ceef853fee8927d1f3
Traceback (most recent call last):
File "preprocess_example.py", line 49, in
Multiprocessing exception:
...........................................................................
/home/darya/Documents/github/adnidod_preprocess/preprocess_example.py in
........................................................................... /home/darya/.local/lib/python2.7/site-packages/pypreprocess/nipype_preproc_spm_utils.py in do_subjects_preproc(subject_factory=[{'drift_model': 'Cosine', 'scratch': '/home/dary...e/results/0003107', 'warpable': ['anat', 'func']}, {'drift_model': 'Cosine', 'scratch': '/home/dary...e/results/0006315', 'warpable': ['anat', 'func']}], session_ids=None, *preproc_params={'TA': 'TR (1 - 1 / nslices)', 'TR': 3.0, 'anat_write_voxel_sizes': [1.0, 1.0, 1.0], 'caching': True, 'coreg_anat_to_func': False, 'coregister': True, 'coregister_reslice': False, 'coregister_software': 'spm', 'dartel': False, 'dataset_description': '\n
This ADNIDOD resting-state fMRI study includ...x 3 mm\n
This ADNIDOD resting-state fMRI study includ...x 3 mm\n
...........................................................................
/home/darya/anaconda2/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.py in call(self=Parallel(n_jobs=2), iterable=<generator object
Sub-process traceback:
RuntimeError Tue Jan 17 11:29:32 2017
PID: 17303 Python 2.7.12: /home/darya/anaconda2/bin/python
...........................................................................
/home/darya/anaconda2/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.py in call(self= This ADNIDOD resting-state fMRI study includ...x 3 mm\n This ADNIDOD resting-state fMRI study includ...x 3 mm\n
...........................................................................
/home/darya/.local/lib/python2.7/site-packages/pypreprocess/nipype_preproc_spm_utils.py in do_subject_preproc(subject_data={'report_preproc_filename': '/home/darya/Documen...9091_I387201.nii'], 'warpable': ['anat', 'func']}, deleteorient=True, slice_timing=True, slice_order='ascending', interleaved=True, ref_slice=1, TR=3.0, TA='TR * (1 - 1 / nslices)', slice_timing_software='spm', realign=True, realign_reslice=False, register_to_mean=True, realign_software='spm', coregister=True, coregister_reslice=False, coreg_anat_to_func=False, coregister_software='spm', segment=True, normalize=True, dartel=False, fwhm=[0.0, 0.0, 0.0], anat_fwhm=[0.0, 0.0, 0.0], func_write_voxel_sizes=[3.0, 3.0, 3.0], anat_write_voxel_sizes=[1.0, 1.0, 1.0], smooth_software='spm', hardlink_output=True, report=True, tsdiffana=True, parent_results_gallery= All preprocessing was done using <a href="htt... been applied to the functional images.', prepreproc_undergone='', caching=True, **kwargs={'dataset_description': '\n This ADNIDOD resting-state fMRI study includ...x 3 mm\n
........................................................................... /home/darya/.local/lib/python2.7/site-packages/pypreprocess/nipype_preproc_spm_utils.py in _do_subject_realign(subject_data={'report_preproc_filename': '/home/darya/Documen...9091_I387201.nii'], 'warpable': ['anat', 'func']}, reslice=False, register_to_mean=True, caching=True, report=True, software='spm', spm_dir=None, matlab_exec=None, spm_mcr=None, hardlink_output=True, kwargs={}) 313 realign = spm.Realign().run 314 315 # run node 316 realign_result = realign( 317 in_files=subject_data.func, register_to_mean=register_to_mean, --> 318 jobtype=jobtype, kwargs) jobtype = 'estwrite' kwargs = {} 319 320 # failed node 321 if realign_result.outputs is None: 322 subject_data.failed = True
...........................................................................
/home/darya/anaconda2/lib/python2.7/site-packages/nipype/caching/memory.py in call(self=PipeFunc(nipype.interfaces.spm.preprocess.Realig...DOD_example/results/0003107/cache_dir/nipype_mem), **kwargs={'in_files': ['/home/darya/Documents/Inria/data/ADNIDOD_example...br_raw_20130927141408560_4967_S199091_I387201.nii'], 'jobtype': 'estwrite', 'register_to_mean': True})
81 node = Node(interface, name=job_name)
82 node.base_dir = os.path.join(self.base_dir, dir_name)
83
84 cwd = os.getcwd()
85 try:
---> 86 out = node.run()
out = undefined
node.run =
...........................................................................
/home/darya/anaconda2/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py in run(self=d67dadf29f94905cbe5dfc3508fe6568, updatehash=False)
389 self.write_report(report_type='preexec', cwd=outdir)
390 savepkl(op.join(outdir, '_node.pklz'), self)
391 savepkl(op.join(outdir, '_inputs.pklz'),
392 self.inputs.get_traitsfree())
393 try:
--> 394 self._run_interface()
self._run_interface =
...........................................................................
/home/darya/anaconda2/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py in _run_interface(self=d67dadf29f94905cbe5dfc3508fe6568, execute=True, updatehash=False)
499 def _run_interface(self, execute=True, updatehash=False):
500 if updatehash:
501 return
502 old_cwd = os.getcwd()
503 os.chdir(self.output_dir())
--> 504 self._result = self._run_command(execute)
self._result =
...........................................................................
/home/darya/anaconda2/lib/python2.7/site-packages/nipype/pipeline/engine/nodes.py in _run_command(self=d67dadf29f94905cbe5dfc3508fe6568, execute=True, copyfiles=True)
625 fd = open(cmdfile, 'wt')
626 fd.writelines(cmd + "\n")
627 fd.close()
628 logger.info('Running: %s' % cmd)
629 try:
--> 630 result = self._interface.run()
result =
...........................................................................
/home/darya/anaconda2/lib/python2.7/site-packages/nipype/interfaces/base.py in run(self=
...........................................................................
/home/darya/anaconda2/lib/python2.7/site-packages/nipype/interfaces/base.py in _run_wrapper(self=
...........................................................................
/home/darya/anaconda2/lib/python2.7/site-packages/nipype/interfaces/spm/base.py in _run_interface(self=
...........................................................................
/home/darya/anaconda2/lib/python2.7/site-packages/nipype/interfaces/base.py in run(self=
...........................................................................
/home/darya/anaconda2/lib/python2.7/site-packages/nipype/interfaces/base.py in _run_wrapper(self=
...........................................................................
/home/darya/anaconda2/lib/python2.7/site-packages/nipype/interfaces/matlab.py in _run_interface(self=
...........................................................................
/home/darya/anaconda2/lib/python2.7/site-packages/nipype/interfaces/base.py in raise_exception(self=
RuntimeError: Command: /usr/local/bin/spm12 run script /home/darya/Documents/Inria/data/ADNIDOD_example/results/0003107/cache_dir/nipype_mem/nipype-interfaces-spm-preprocess-Realign/d67dadf29f94905cbe5dfc3508fe6568/pyscript_realign.m Standard output: Warning: Unable to open display ':1'. You will not be able to display graphics on the screen. SPM12 (6914): /usr/local/src/spm12/spm12_mcr/spm12
/ )( ( \/ )
_ \ )_/ ) ( Statistical Parametric Mapping
(/() (/\/_) SPM12 - http://www.fil.ion.ucl.ac.uk/spm/
Warning: Unknown extension: 'script'
In spm_jobman>load_jobs at 334 In spm_jobman at 143 In spm_standalone at 33 Warning: No batch job found in 'script' In spm_jobman>load_jobs at 343 In spm_jobman at 143 In spm_standalone at 33 Execution failed: scriptExecuting spm_jobman at 17-Jan-2017 11:29:25:
MATLAB Version 7.10.0.499 (R2010a) MATLAB License Number: unknown Operating System: Linux 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 Java VM Version: Java 1.6.0_12-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Version 7.10 (R2010a) MATLAB Compiler Version 4.13 (R2010a) Signal Processing Toolbox Version 6.13 (R2010a) SPM version: SPM12 Release: 6914 SPM path: /usr/local/src/spm12/spm12_mcr/spm12/spm.m
Running job #1
Running 'Realign: Estimate & Reslice'
SPM12: spm_realign (v6070) 11:29:28 - 17/01/2017
Failed 'Realign: Estimate & Reslice' Error using ==> colon Maximum variable size allowed by the program is exceeded. In file "/usr/local/src/spm12/spm12_mcr/spm12/spm_realign.m" (???), function "smooth_vol" at line 421. In file "/usr/local/src/spm12/spm12_mcr/spm12/spm_realign.m" (???), function "realign_series" at line 234. In file "/usr/local/src/spm12/spm12_mcr/spm12/spm_realign.m" (???), function "spm_realign" at line 136. In file "/usr/local/src/spm12/spm12_mcr/spm12/config/spm_run_realign.m" (???), function "spm_run_realign" at line 31.
The following modules did not run: Failed: Realign: Estimate & Reslice
Running job #2
Running 'Realign: Estimate & Reslice'
SPM12: spm_realign (v6070) 11:29:31 - 17/01/2017
Failed 'Realign: Estimate & Reslice' Error using ==> colon Maximum variable size allowed by the program is exceeded. In file "/usr/local/src/spm12/spm12_mcr/spm12/spm_realign.m" (???), function "smooth_vol" at line 421. In file "/usr/local/src/spm12/spm12_mcr/spm12/spm_realign.m" (???), function "realign_series" at line 234. In file "/usr/local/src/spm12/spm12_mcr/spm12/spm_realign.m" (???), function "spm_realign" at line 136. In file "/usr/local/src/spm12/spm12_mcr/spm12/config/spm_run_realign.m" (???), function "spm_run_realign" at line 31.
The following modules did not run: Failed: Realign: Estimate & Reslice
Execution failed: /home/darya/Documents/Inria/data/ADNIDOD_example/results/0003107/cache_dir/nipype_mem/nipype-interfaces-spm-preprocess-Realign/d67dadf29f94905cbe5dfc3508fe6568/pyscript_realign.mBye for now...
Standard error: MATLAB code threw an exception: Job execution failed. The full log of this run can be found in MATLAB command window, starting with the lines (look for the line showing the exact #job as displayed in this error message)
Running job #1
File:
Name: MATLABbatch system
Line: 0
Return code: 0 Interface MatlabCommand failed to run. Interface Realign failed to run.
When "deleteorient = True" there is an error:
........................................................................... /usr/lib/python2.7/dist-packages/IPython/init.py in start_ipython(argv=None, _kwargs={}) 113 kwargs : various, optional 114 Any other kwargs will be passed to the Application constructor, 115 such as
config
. 116 """ 117 from IPython.terminal.ipapp import launch_new_instance --> 118 return launch_new_instance(argv=argv, _kwargs) launch_new_instance = <bound method MetaHasTraits.launch_instance of <class 'IPython.terminal.ipapp.TerminalIPythonApp'>> argv = None kwargs = {} 119 120 def start_kernel(argv=None, **kwargs): 121 """Launch a normal IPython kernel instance (as opposed to embedded) 122........................................................................... /usr/lib/python2.7/dist-packages/IPython/config/application.py in launch_instance(cls=<class 'IPython.terminal.ipapp.TerminalIPythonApp'>, argv=None, kwargs={}) 541 If a global instance already exists, this reinitializes and starts it 542 """ 543 try: 544 app = cls.instance(kwargs) 545 app.initialize(argv) --> 546 app.start() app.start = <bound method TerminalIPythonApp.start of>
547 except ImportError as e:
548 from IPython.utils import py3compat
549 ipy = "ipython3" if py3compat.PY3 else "ipython"
550 if "IPython.qt" in str(e) or "qt.console.qtconsoleapp" in str(e):
........................................................................... /usr/lib/python2.7/dist-packages/IPython/terminal/ipapp.py in start(self=)
357 if self.subapp is not None:
358 return self.subapp.start()
359 # perform any prexec steps:
360 if self.interact:
361 self.log.debug("Starting IPython's mainloop...")
--> 362 self.shell.mainloop()
self.shell.mainloop = <bound method TerminalInteractiveShell.mainloop ...nteractiveshell.TerminalInteractiveShell object>>
363 else:
364 self.log.debug("IPython not interactive...")
365
366
........................................................................... /usr/lib/python2.7/dist-packages/IPython/terminal/interactiveshell.py in mainloop(self=, display_banner=None)
431
432 with nested(self.builtin_trap, self.display_trap):
433
434 while 1:
435 try:
--> 436 self.interact(display_banner=display_banner)
self.interact = <bound method TerminalInteractiveShell.interact ...nteractiveshell.TerminalInteractiveShell object>>
display_banner = None
437 #self.interact_with_readline()
438 # XXX for testing of a readline-decoupled repl loop, call
439 # interact_with_readline above
440 break
........................................................................... /usr/lib/python2.7/dist-packages/IPython/terminal/interactiveshell.py in interact(self=, display_banner=False)
550 if (self.SyntaxTB.last_syntax_error and
551 self.autoedit_syntax):
552 self.edit_syntax_error()
553 if not more:
554 source_raw = self.input_splitter.source_raw_reset()[1]
--> 555 self.run_cell(source_raw, store_history=True)
self.run_cell = <bound method TerminalInteractiveShell.run_cell ...nteractiveshell.TerminalInteractiveShell object>>
source_raw = u'run preprocess.py\n'
556 hlen_b4_cell = \
557 self._replace_rlhist_multiline(source_raw, hlen_b4_cell)
558
559 # Turn off the exit flag, so the mainloop can be restarted if desired
........................................................................... /usr/lib/python2.7/dist-packages/IPython/core/interactiveshell.py in run_cell(self=, raw_cell=u'run preprocess.py\n', store_history=True, silent=False, shell_futures=True)
2655
2661
2656 code_ast = self.transform_ast(code_ast) 2657
2658 interactivity = "none" if silent else self.ast_node_interactivity 2659 self.run_ast_nodes(code_ast.body, cell_name, -> 2660 interactivity=interactivity, compiler=compiler) interactivity = 'last_expr' compiler =
2662 # Execute any registered post-execution functions. 2663 # unless we are silent 2664 post_exec = [] if silent else self._post_execute.iteritems()
........................................................................... /usr/lib/python2.7/dist-packages/IPython/core/interactiveshell.py in run_ast_nodes(self=, nodelist=[<_ast.Expr object>], cell_name='', interactivity='last', compiler=)
2765 return True
2766
2767 for i, node in enumerate(to_run_interactive):
2768 mod = ast.Interactive([node])
2769 code = compiler(mod, cell_name, "single")
-> 2770 if self.run_code(code):
self.run_code = <bound method TerminalInteractiveShell.run_code ...nteractiveshell.TerminalInteractiveShell object>>
code = <code object at 0x7f5363f280b0, file "", line 1>
2771 return True
2772
2773 # Flush softspace
2774 if softspace(sys.stdout, 0):
........................................................................... /usr/lib/python2.7/dist-packages/IPython/core/interactiveshell.py in run_code(self=, code_obj=<code object at 0x7f5363f280b0, file "", line 1>)
2815 outflag = 1 # happens in more places, so it's easier as default
2816 try:
2817 try:
2818 self.hooks.pre_run_code_hook()
2819 #rprint('Running code', repr(code_obj)) # dbg
-> 2820 exec code_obj in self.user_global_ns, self.user_ns
code_obj = <code object at 0x7f5363f280b0, file "", line 1>
self.user_global_ns = {'BASE_DIR': '/volatile/darya/Documents/experiments/preprocessing_adnidod/data_2_subj', 'In': ['', u"get_ipython().magic(u'run preprocess.py')", u"get_ipython().magic(u'run preprocess.py')", u'import nibabel', u'nibabel.version', u"get_ipython().magic(u'run preprocess.py')", u"get_ipython().magic(u'run preprocess.py')", u"getipython().magic(u'run preprocess.py')"], 'Out': {4: '1.3.0'}, '': '1.3.0', '4': '1.3.0', '': '', '': '', 'builtin': <module 'builtin' (built-in)>, 'builtins': <module 'builtin' (built-in)>, 'doc': 'Automatically created module for IPython interactive environment', ...}
self.user_ns = {'BASE_DIR': '/volatile/darya/Documents/experiments/preprocessing_adnidod/data_2_subj', 'In': ['', u"get_ipython().magic(u'run preprocess.py')", u"get_ipython().magic(u'run preprocess.py')", u'import nibabel', u'nibabel.version', u"get_ipython().magic(u'run preprocess.py')", u"get_ipython().magic(u'run preprocess.py')", u"getipython().magic(u'run preprocess.py')"], 'Out': {4: '1.3.0'}, '': '1.3.0', '4': '1.3.0', '': '', '': '', 'builtin': <module 'builtin' (built-in)>, 'builtins': <module 'builtin' (built-in)>, 'doc': 'Automatically created module for IPython interactive environment', ...}
2821 finally:
2822 # Reset our crash handler in place
2823 sys.excepthook = old_excepthook
2824 except SystemExit:
........................................................................... /volatile/darya/Documents/experiments/preprocessing_adnidod/ in ()
----> 1
2
3
4
5
6 get_ipython().magic(u'run preprocess.py')
7
8
9
10
........................................................................... /usr/lib/python2.7/dist-packages/IPython/core/interactiveshell.py in magic(self=, arg_s=u'run preprocess.py')
2160 compound statements.
2161 """
2162 # TODO: should we issue a loud deprecation warning here?
2163 magicname, , magic_arg_s = arg_s.partition(' ')
2164 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2165 return self.run_line_magic(magic_name, magic_arg_s)
self.run_line_magic = >
magic_name = u'run'
magic_arg_s = u'preprocess.py'
2166
2167 #-------------------------------------------------------------------------
2168 # Things related to macros
2169 #-------------------------------------------------------------------------
........................................................................... /usr/lib/python2.7/dist-packages/IPython/core/interactiveshell.py in run_line_magic(self=, magic_name=u'run', line=u'preprocess.py')
2081 kwargs = {}
2082 # Grab local namespace if we need it:
2083 if getattr(fn, "needs_local_scope", False):
2084 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2085 with self.builtin_trap:
-> 2086 result = fn(args,*kwargs)
result = undefined
fn = <bound method ExecutionMagics.run of >
args = [u'preprocess.py']
kwargs = {}
2087 return result
2088
2089 def run_cell_magic(self, magic_name, line, cell):
2090 """Execute the given cell magic.
........................................................................... /volatile/darya/Documents/experiments/preprocessing_adnidod/ in run(self=, parameter_s=u'preprocess.py', runner=None, file_finder=)
1
----> 2
3
4
5 # -- coding: utf-8 --
6 """Implementation of execution-related magic functions.
7 """
8 #-----------------------------------------------------------------------------
9 # Copyright (c) 2012 The IPython Development Team.
10 #
11 # Distributed under the terms of the Modified BSD License.
12 #
13 # The full license is in the file COPYING.txt, distributed with this software.
14 #-----------------------------------------------------------------------------
........................................................................... /usr/lib/python2.7/dist-packages/IPython/core/magic.py in(f=, _a=(, u'preprocess.py', None, ), _k={})
186 validate_type(magic_kind)
187
188 # This is a closure to capture the magic_kind. We could also use a class,
189 # but it's overkill for just that one bit of state.
190 def magic_deco(arg):
--> 191 call = lambda f, _a, _k: f(_a, *_k)
f =
a = (, u'preprocess.py', None, )
k = {}
192
193 if callable(arg):
194 # "Naked" decorator call (just @foo, no args)
195 func = arg
........................................................................... /usr/lib/python2.7/dist-packages/IPython/core/magics/execution.py in run(self=, parameter_s=u'preprocess.py', runner=>, file_finder=)
632 except (KeyError):
633 nruns = 1
634 self._run_with_timing(run, nruns)
635 else:
636 # regular execution
--> 637 run()
run =
638
639 if 'i' in opts:
640 self.shell.user_ns['name'] = namesave
641 else:
........................................................................... /usr/lib/python2.7/dist-packages/IPython/core/magics/execution.py in run() 618 if runner is None: 619 runner = self.shell.safe_execfile 620 621 def run(): 622 runner(filename, prog_ns, prog_ns, --> 623 exit_ignore=exit_ignore) 624 625 if 't' in opts: 626 # timed execution 627 try:
........................................................................... /usr/lib/python2.7/dist-packages/IPython/core/interactiveshell.py in safe_execfile(self=, fname=u'/volatile/darya/Documents/experiments/preprocessing_adnidod/preprocess.py', _where=({'BASE_DIR': '/volatile/darya/Documents/experiments/preprocessing_adnidod/data_2_subj', 'builtins': {'ArithmeticError': <type 'exceptions.ArithmeticError'>, 'AssertionError': <type 'exceptions.AssertionError'>, 'AttributeError': <type 'exceptions.AttributeError'>, 'BaseException': <type 'exceptions.BaseException'>, 'BufferError': <type 'exceptions.BufferError'>, 'BytesWarning': <type 'exceptions.BytesWarning'>, 'DeprecationWarning': <type 'exceptions.DeprecationWarning'>, 'EOFError': <type 'exceptions.EOFError'>, 'Ellipsis': Ellipsis, 'EnvironmentError': <type 'exceptions.EnvironmentError'>, ...}, 'file': u'preprocess.py', 'name': 'main', 'nonzero': <function >, 'package': None, 'do_subjects_preproc': , 'fetch_spm_auditory': , 'generate_subject_stats_report': , 'jobfile': 'adnidod_config.ini', ...}, {'BASE_DIR': '/volatile/darya/Documents/experiments/preprocessing_adnidod/data_2_subj', 'builtins': {'ArithmeticError': <type 'exceptions.ArithmeticError'>, 'AssertionError': <type 'exceptions.AssertionError'>, 'AttributeError': <type 'exceptions.AttributeError'>, 'BaseException': <type 'exceptions.BaseException'>, 'BufferError': <type 'exceptions.BufferError'>, 'BytesWarning': <type 'exceptions.BytesWarning'>, 'DeprecationWarning': <type 'exceptions.DeprecationWarning'>, 'EOFError': <type 'exceptions.EOFError'>, 'Ellipsis': Ellipsis, 'EnvironmentError': <type 'exceptions.EnvironmentError'>, ...}, 'file': u'preprocess.py', 'name': 'main', 'nonzero': <function >, 'package': None, 'do_subjects_preproc': , 'fetch_spm_auditory': , 'generate_subject_stats_report': , 'jobfile': 'adnidod_config.ini', ...}), _kw={'exit_ignore': False, 'raise_exceptions': False})
2485 # Python inserts the script's directory into sys.path
2486 dname = os.path.dirname(fname)
2487
2488 with prepended_to_syspath(dname):
2489 try:
-> 2490 py3compat.execfile(fname,where)
fname = u'/volatile/darya/Documents/experiments/preprocessing_adnidod/preprocess.py'
where = ({'BASE_DIR': '/volatile/darya/Documents/experiments/preprocessing_adnidod/data_2_subj', 'builtins': {'ArithmeticError': <type 'exceptions.ArithmeticError'>, 'AssertionError': <type 'exceptions.AssertionError'>, 'AttributeError': <type 'exceptions.AttributeError'>, 'BaseException': <type 'exceptions.BaseException'>, 'BufferError': <type 'exceptions.BufferError'>, 'BytesWarning': <type 'exceptions.BytesWarning'>, 'DeprecationWarning': <type 'exceptions.DeprecationWarning'>, 'EOFError': <type 'exceptions.EOFError'>, 'Ellipsis': Ellipsis, 'EnvironmentError': <type 'exceptions.EnvironmentError'>, ...}, 'file': u'preprocess.py', 'name': 'main', 'nonzero': <function >, 'package': None, 'do_subjects_preproc': , 'fetch_spm_auditory': , 'generate_subject_stats_report': , 'jobfile': 'adnidod_config.ini', ...}, {'BASE_DIR': '/volatile/darya/Documents/experiments/preprocessing_adnidod/data_2_subj', 'builtins': {'ArithmeticError': <type 'exceptions.ArithmeticError'>, 'AssertionError': <type 'exceptions.AssertionError'>, 'AttributeError': <type 'exceptions.AttributeError'>, 'BaseException': <type 'exceptions.BaseException'>, 'BufferError': <type 'exceptions.BufferError'>, 'BytesWarning': <type 'exceptions.BytesWarning'>, 'DeprecationWarning': <type 'exceptions.DeprecationWarning'>, 'EOFError': <type 'exceptions.EOFError'>, 'Ellipsis': Ellipsis, 'EnvironmentError': <type 'exceptions.EnvironmentError'>, ...}, 'file': u'preprocess.py', 'name': 'main', 'nonzero': <function >, 'package': None, 'do_subjects_preproc': , 'fetch_spm_auditory': , 'generate_subject_stats_report': , 'jobfile': 'adnidod_config.ini', ...})
2491 except SystemExit as status:
2492 # If the call was made with 0 or None exit status (sys.exit(0)
2493 # or sys.exit() ), don't bother showing a traceback, as both of
2494 # these are considered normal by the OS:
........................................................................... /usr/lib/python2.7/dist-packages/IPython/utils/py3compat.py in execfile(fname=u'/volatile/darya/Documents/experiments/preprocessing_adnidod/preprocess.py', where=({'BASE_DIR': '/volatile/darya/Documents/experiments/preprocessing_adnidod/data_2_subj', 'builtins': {'ArithmeticError': <type 'exceptions.ArithmeticError'>, 'AssertionError': <type 'exceptions.AssertionError'>, 'AttributeError': <type 'exceptions.AttributeError'>, 'BaseException': <type 'exceptions.BaseException'>, 'BufferError': <type 'exceptions.BufferError'>, 'BytesWarning': <type 'exceptions.BytesWarning'>, 'DeprecationWarning': <type 'exceptions.DeprecationWarning'>, 'EOFError': <type 'exceptions.EOFError'>, 'Ellipsis': Ellipsis, 'EnvironmentError': <type 'exceptions.EnvironmentError'>, ...}, 'file': u'preprocess.py', 'name': 'main', 'nonzero': <function>, 'package': None, 'do_subjects_preproc': , 'fetch_spm_auditory': , 'generate_subject_stats_report': , 'jobfile': 'adnidod_config.ini', ...}, {'BASE_DIR': '/volatile/darya/Documents/experiments/preprocessing_adnidod/data_2_subj', 'builtins': {'ArithmeticError': <type 'exceptions.ArithmeticError'>, 'AssertionError': <type 'exceptions.AssertionError'>, 'AttributeError': <type 'exceptions.AttributeError'>, 'BaseException': <type 'exceptions.BaseException'>, 'BufferError': <type 'exceptions.BufferError'>, 'BytesWarning': <type 'exceptions.BytesWarning'>, 'DeprecationWarning': <type 'exceptions.DeprecationWarning'>, 'EOFError': <type 'exceptions.EOFError'>, 'Ellipsis': Ellipsis, 'EnvironmentError': <type 'exceptions.EnvironmentError'>, ...}, 'file': u'preprocess.py', 'name': 'main', 'nonzero': <function >, 'package': None, 'do_subjects_preproc': , 'fetch_spm_auditory': , 'generate_subject_stats_report': , 'jobfile': 'adnidod_config.ini', ...}))
199 def execfile(fname, where):
200 if isinstance(fname, unicode):
201 filename = fname.encode(sys.getfilesystemencoding())
202 else:
203 filename = fname
--> 204 builtin.execfile(filename, *where)
filename = '/volatile/darya/Documents/experiments/preprocessing_adnidod/preprocess.py'
where = ({'BASE_DIR': '/volatile/darya/Documents/experiments/preprocessing_adnidod/data_2_subj', 'builtins': {'ArithmeticError': <type 'exceptions.ArithmeticError'>, 'AssertionError': <type 'exceptions.AssertionError'>, 'AttributeError': <type 'exceptions.AttributeError'>, 'BaseException': <type 'exceptions.BaseException'>, 'BufferError': <type 'exceptions.BufferError'>, 'BytesWarning': <type 'exceptions.BytesWarning'>, 'DeprecationWarning': <type 'exceptions.DeprecationWarning'>, 'EOFError': <type 'exceptions.EOFError'>, 'Ellipsis': Ellipsis, 'EnvironmentError': <type 'exceptions.EnvironmentError'>, ...}, 'file': u'preprocess.py', 'name': 'main', 'nonzero': <function >, 'package': None, 'do_subjects_preproc': , 'fetch_spm_auditory': , 'generate_subject_stats_report': , 'jobfile': 'adnidod_config.ini', ...}, {'BASE_DIR': '/volatile/darya/Documents/experiments/preprocessing_adnidod/data_2_subj', 'builtins': {'ArithmeticError': <type 'exceptions.ArithmeticError'>, 'AssertionError': <type 'exceptions.AssertionError'>, 'AttributeError': <type 'exceptions.AttributeError'>, 'BaseException': <type 'exceptions.BaseException'>, 'BufferError': <type 'exceptions.BufferError'>, 'BytesWarning': <type 'exceptions.BytesWarning'>, 'DeprecationWarning': <type 'exceptions.DeprecationWarning'>, 'EOFError': <type 'exceptions.EOFError'>, 'Ellipsis': Ellipsis, 'EnvironmentError': <type 'exceptions.EnvironmentError'>, ...}, 'file': u'preprocess.py', 'name': 'main', 'nonzero': <function >, 'package': None, 'do_subjects_preproc': , 'fetch_spm_auditory': , 'generate_subject_stats_report': , 'jobfile': 'adnidod_config.ini', ...})
205
206
207
208
........................................................................... /volatile/darya/Documents/experiments/preprocessing_adnidod/preprocess.py in()
26 # directory that contains the files
27 BASE_DIR = '/volatile/darya/Documents/experiments/preprocessing_adnidod/data_2_subj'
28 jobfile = 'adnidod_config.ini' #("")
29
30 # preprocess the data
---> 31 results = do_subjects_preproc(jobfile, dataset_dir=BASE_DIR)
32
33
34
35
........................................................................... /volatile/darya/.local/lib/python2.7/site-packages/pypreprocess/nipype_preproc_spm_utils.py in do_subjects_preproc(subject_factory=[{'onset': [None], 'anat': '/volatile/darya/Docum...ipype_results': {}, 'warpable': ['anat', 'func']}, {'onset': [None], 'anat': '/volatile/darya/Docum...ipype_results': {}, 'warpable': ['anat', 'func']}], session_ids=None, _preproc_params={'TA': 'TR * (1 - 1 / nslices)', 'TR': 3.0, 'anat_write_voxel_sizes': [1.0, 1.0, 1.0], 'caching': True, 'coreg_anat_to_func': False, 'coregister': True, 'coregister_reslice': False, 'coregister_software': 'spm', 'dartel': False, 'dataset_description': '\nShape : 64 x 64 x 48 \n\n', ...})
1709 if k in preproc_params:
1710 backup_params[k] = preproc_params.pop(k)
1711
1712 # run classic preproc
1713 subjects = Parallel(n_jobs=n_jobs)(delayed(do_subject_preproc)(
-> 1714 subject_data, _preproc_params) for subject_data in subjects)
subject_data = {'onset': [None], 'anat': '/volatile/darya/Docum...ipype_results': {}, 'warpable': ['anat', 'func']}
preproc_params = {'TA': 'TR * (1 - 1 / nslices)', 'TR': 3.0, 'anat_write_voxel_sizes': [1.0, 1.0, 1.0], 'caching': True, 'coreg_anat_to_func': False, 'coregister': True, 'coregister_reslice': False, 'coregister_software': 'spm', 'dartel': False, 'dataset_description': '\n
This ADNIDOD resting-state fMRI study includ...x 3 mm\n
This ADNIDOD resting-state fMRI study includ...x 3 mm\n
........................................................................... /usr/lib/python2.7/dist-packages/joblib/parallel.py in call(self=Parallel(n_jobs=2), iterable=<generator object>)
655 if pre_dispatch == "all" or n_jobs == 1:
656 # The iterable was consumed all at once by the above for loop.
657 # No need to wait for async callbacks to trigger to
658 # consumption.
659 self._iterating = False
--> 660 self.retrieve()
self.retrieve = <bound method Parallel.retrieve of Parallel(n_jobs=2)>
661 # Make sure that we get a last message telling us we are done
662 elapsed_time = time.time() - self._start_time
663 self._print('Done %3i out of %3i | elapsed: %s finished',
664 (len(self._output),
PID: 11724 Python 2.7.6: /usr/bin/python ........................................................................... /volatile/darya/.local/lib/python2.7/site-packages/pypreprocess/nipype_preproc_spm_utils.pyc in do_subject_preproc(subject_data={'onset': [None], 'anat': '/volatile/darya/Docum...ipype_results': {}, 'warpable': ['anat', 'func']}, deleteorient=True, slice_timing=True, slice_order='ascending', interleaved=True, ref_slice=1, TR=3.0, TA='TR * (1 - 1 / nslices)', slice_timing_software='spm', realign=True, realign_reslice=False, register_to_mean=True, realign_software='spm', coregister=True, coregister_reslice=False, coreg_anat_to_func=False, coregister_software='spm', segment=True, normalize=True, dartel=False, fwhm=0.0, anat_fwhm=0.0, func_write_voxel_sizes=[3.0, 3.0, 3.0], anat_write_voxel_sizes=[1.0, 1.0, 1.0], smooth_software='spm', hardlink_output=True, report=True, tsdiffana=True, parent_results_gallery=, last_stage=True, preproc_undergone=None, prepreproc_undergone='', caching=True, **kwargs={'dataset_description': '\nShape : 64 x 64 x 48 \n\n', 'dataset_dir': '/volatile/darya/Documents/experiments/preprocessing_adnidod/data_2_subj', 'dataset_id': '/volatile/darya/Documents/experiments/preprocessing_adnidod/data_2_subj', 'matlab_exec': None, 'newsegment': False, 'output_modulated_tpms': False, 'spm_dir': None})
1224 else:
1225 assert isinstance(subject_data, SubjectData), (
1226 "subject_datta must be SubjectData instance or dict, "
1227 "got %s" % type(subject_data))
1228
-> 1229 subject_data.sanitize(deleteorient=deleteorient, niigz2nii=True)
1230 subject_data.failed = False
1231
1232 # use EPI template for anat if anat is None
1233 if subject_data.anat is None:
This ADNIDOD resting-state fMRI study includ...x 3 mm\n
........................................................................... /volatile/darya/.local/lib/python2.7/site-packages/pypreprocess/subject_data.pyc in sanitize(self={'onset': [None], 'anat': '/volatile/darya/Docum...ipype_results': {}, 'warpable': ['anat', 'func']}, deleteorient=True, niigz2nii=True) 388 # .dcm, .ima -> .nii 389 self._dcm2nii() 390 391 # delete orientation meta-data 392 if deleteorient: --> 393 self._delete_orientation() 394 395 # .nii.gz -> .nii extraction for SPM & co. 396 if niigz2nii: 397 self._niigz2nii()
........................................................................... /volatile/darya/.local/lib/python2.7/site-packages/pypreprocess/subject_data.pyc in _delete_orientation(self={'onset': [None], 'anat': '/volatile/darya/Docum...ipype_results': {}, 'warpable': ['anat', 'func']}) 167 warnings.warn("'%s' attribute of is None! Skipping" % attr) 168 break 169 else: 170 self.func = [mem.cache(delete_orientation)( 171 self.func[sess], self.session_output_dirs[sess]) --> 172 for sess in range(self.n_sessions)] 173 174 # deleteorient for anat 175 if self.anat is not None: 176 self.anat = mem.cache(delete_orientation)(
........................................................................... /usr/lib/python2.7/dist-packages/joblib/memory.pyc in call(self=MemorizedFunc(func=<function delete_orientation ...od/data_2_subj_results/0003107/cache_dir/joblib'), *args=('/volatile/darya/Documents/experiments/preprocess...br_raw_20130927141408560_4967_S199091_I387201.nii', '/volatile/darya/Documents/experiments/preprocessing_adnidod/data_2_subj_results/0003107/func'), *kwargs={}) 476 return MemorizedResult(self.cachedir, self.func, argument_hash, 477 metadata=metadata, verbose=self._verbose - 1, 478 timestamp=self.timestamp) 479 480 def call(self, args, **kwargs): --> 481 return self._cached_call(args, kwargs)[0] 482 483 def reduce(self): 484 """ We don't store the timestamp when pickling, to avoid the hash 485 depending from it.
........................................................................... /usr/lib/python2.7/dist-packages/joblib/memory.pyc in _cached_call(self=MemorizedFunc(func=<function delete_orientation ...od/data_2_subj_results/0003107/cache_dir/joblib'), args=('/volatile/darya/Documents/experiments/preprocess...br_raw_20130927141408560_4967_S199091_I387201.nii', '/volatile/darya/Documents/experiments/preprocessing_adnidod/data_2_subj_results/0003107/func'), kwargs={}) 423 if self.verbose > 10: 424 , name = get_func_name(self.func) 425 self.warn('Computing func %s, argument hash %s in ' 426 'directory %s' 427 % (name, argument_hash, output_dir)) --> 428 out, metadata = self.call(_args, *_kwargs) 429 if self.mmap_mode is not None: 430 # Memmap the output at the first call to be consistent with 431 # later calls 432 out = _load_output(output_dir, _get_func_fullname(self.func),
........................................................................... /usr/lib/python2.7/dist-packages/joblib/memory.pyc in call(self=MemorizedFunc(func=<function delete_orientation ...od/data_2_subj_results/0003107/cache_dir/joblib'), *args=('/volatile/darya/Documents/experiments/preprocess...br_raw_20130927141408560_4967_S199091_I387201.nii', '/volatile/darya/Documents/experiments/preprocessing_adnidod/data_2_subj_results/0003107/func'), *kwargs={}) 668 """ 669 start_time = time.time() 670 outputdir, = self._get_output_dir(args, *kwargs) 671 if self._verbose > 0: 672 print(format_call(self.func, args, kwargs)) --> 673 output = self.func(_args, _kwargs) 674 self._persist_output(output, output_dir) 675 duration = time.time() - start_time 676 metadata = self._persist_input(output_dir, duration, args, kwargs) 677
........................................................................... /volatile/darya/.local/lib/python2.7/site-packages/pypreprocess/io_utils.pyc in delete_orientation(imgs=['/volatile/darya/Documents/experiments/preprocess...br_raw_20130927141408560_4967_S199091_I387201.nii'], output_dir='/volatile/darya/Documents/experiments/preprocessing_adnidod/data_2_subj_results/0003107/func', output_tag='') 329 output_img = os.path.join(output_dir, 330 output_tag + os.path.basename(img)) 331 new_img = nibabel.load(img) 332 new_img.set_sform(np.zeros((4, 4))) 333 new_img.set_qform(np.eye(4)) --> 334 new_img.header['dim_info'] = 0 335 nibabel.save(new_img, output_img) 336 output_imgs.append(output_img) 337 338 if not_list:
AttributeError: 'Nifti1Image' object has no attribute 'header'