Skip to content

Commit 571d4bb

Browse files
committed
Merge branch 'master' of https://github.com/nipy/nipype.git
2 parents f139c9f + d95296e commit 571d4bb

File tree

10 files changed

+143
-52
lines changed

10 files changed

+143
-52
lines changed

.travis.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@ before_install:
1111
# The next couple lines fix a crash with multiprocessing on Travis
1212
- sudo rm -rf /dev/shm
1313
- sudo ln -s /run/shm /dev/shm
14-
- sudo apt-get update -qq
15-
- sudo apt-get install lsb-release
16-
- source /etc/lsb-release
17-
- echo ${DISTRIB_CODENAME}
18-
- wget -O- http://neuro.debian.net/lists/${DISTRIB_CODENAME}.us-nh.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
19-
- sudo apt-key adv --recv-keys --keyserver pgp.mit.edu 2649A5A9
14+
- bash <(wget -q -O- http://neuro.debian.net/_files/neurodebian-travis.sh)
2015
- sudo apt-get update -qq
2116
- sudo apt-get install -qq --no-install-recommends fsl afni
2217
- sudo apt-get install -qq fsl-atlases

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Next release
3939
* ENH: arrange nodes by topological sort with disconnected subgraphs
4040
* ENH: uses the nidm iri namespace for uuids
4141
* ENH: remove old reporting webpage
42+
* ENH: Added support for Vagrant
4243

4344
* API: 'name' is now a positional argument for Workflow, Node, and MapNode constructors
4445
* API: SPM now defaults to SPM8 or SPM12b job format

Vagrantfile

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
VAGRANTFILE_API_VERSION = "2"
2+
3+
$script = <<SCRIPT
4+
5+
# Following section commented out as gridengine requires interactive
6+
# components
7+
# # Install neurodebian repo
8+
# bash <(wget -q -O- http://neuro.debian.net/_files/neurodebian-travis.sh)
9+
#
10+
# # Install grid engine
11+
# sudo apt-get install -qq gridengine-master gridengine-exec gridengine-client gridengine-qmon
12+
# # Configure: http://wiki.unixh4cks.com/index.php/Setting_up_Sun_Grid_Engine_on_Ubuntu
13+
# sudo -u sgeadmin qconf -am vagrant
14+
# qconf -au vagrant users
15+
# qconf -as neuro
16+
# qconf -ahgrp @allhosts
17+
# qconf -aattr hostgroup hostlist neuro @allhosts
18+
# qconf -aq main.q
19+
# qconf -aattr queue hostlist @allhosts main.q
20+
# qconf -aattr queue slots "2, [neuro=3]" main.q
21+
22+
# install anaconda
23+
wget http://repo.continuum.io/miniconda/Miniconda-2.2.2-Linux-x86_64.sh -O miniconda.sh
24+
chmod +x miniconda.sh
25+
./miniconda.sh -b
26+
echo "export PATH=$HOME/anaconda/bin:\\$PATH" >> .bashrc
27+
28+
# install nipype dependencies
29+
$HOME/anaconda/bin/conda install --yes pip numpy scipy nose traits networkx
30+
$HOME/anaconda/bin/conda install --yes dateutil ipython-notebook matplotlib
31+
$HOME/anaconda/bin/pip install nibabel --use-mirrors
32+
$HOME/anaconda/bin/pip install https://github.com/RDFLib/rdflib/archive/master.zip
33+
$HOME/anaconda/bin/pip install https://github.com/satra/prov/archive/enh/rdf.zip
34+
$HOME/anaconda/bin/pip install https://github.com/nipy/nipype/archive/master.zip
35+
SCRIPT
36+
37+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
38+
39+
config.vm.define :engine do |engine_config|
40+
41+
engine_config.vm.box = "gridneuro"
42+
#engine_config.vm.box_url = "http://files.vagrantup.com/precise64.box"
43+
engine_config.vm.box_url = "https://dl.dropboxusercontent.com/u/363467/precise64_neuro.box"
44+
engine_config.vm.network :forwarded_port, guest: 80, host: 8080
45+
46+
#engine_config.vm.network :public_network, :bridge => 'en0: Wi-Fi (AirPort)'
47+
engine_config.vm.network :private_network, ip: "192.168.100.20"
48+
engine_config.vm.hostname = 'neuro'
49+
#engine_config.vm.synced_folder "../software", "/software"
50+
#engine_config.vm.synced_folder "../data", "/data"
51+
52+
engine_config.vm.provider :virtualbox do |vb|
53+
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "50"]
54+
vb.customize ["modifyvm", :id, "--ioapic", "on"]
55+
vb.customize ["modifyvm", :id, "--memory", "4096"]
56+
vb.customize ["modifyvm", :id, "--cpus", "4"]
57+
end
58+
59+
engine_config.vm.provision "shell", :privileged => false, inline: $script
60+
end
61+
end

doc/links_names.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
.. _nibabel: http://nipy.org/nibabel/
1616
.. _nipype: http://nipy.org/nipype/
1717
.. _ConnectomeViewer: http://www.connectomeviewer.org/viewer/
18+
.. _NeuroDebian: http://neuro.debian.net/
1819

1920
.. Documentation tools
2021
.. _graphviz: http://www.graphviz.org/
@@ -73,6 +74,8 @@
7374
.. _pythonxy: http://www.pythonxy.com/
7475
.. _EPD: http://www.enthought.com/products/epd.php
7576
.. _Traits: http://code.enthought.com/projects/traits/
77+
.. _Anaconda: https://store.continuum.io/cshop/anaconda/
78+
.. _Canopy: https://www.enthought.com/products/canopy/
7679

7780
.. Python imaging projects
7881
.. _PyMVPA: http://www.pymvpa.org
@@ -98,6 +101,9 @@
98101
.. _xcode: http://developer.apple.com/TOOLS/xcode
99102
.. _mingw: http://www.mingw.org
100103
.. _macports: http://www.macports.org/
104+
.. _Vagrant: http://www.vagrantup.com/
105+
.. _Docker: http://www.docker.io/
106+
.. _Virtualbox: https://www.virtualbox.org/
101107

102108
.. Functional imaging labs
103109
.. _`functional imaging laboratory`: http://www.fil.ion.ucl.ac.uk

doc/quickstart.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Downloading and installing
1111
:maxdepth: 1
1212

1313
users/install
14+
users/vagrant
1415

1516
Beginner's guide
1617
================

doc/users/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
:maxdepth: 2
1212

1313
install
14+
vagrant
1415

1516
interface_tutorial
1617
caching_tutorial

doc/users/install.rst

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,12 @@ manager.
4545
Mac OS X
4646
~~~~~~~~
4747

48-
The easiest way to get nipype running on Mac OS X is to install EPD_ and then add
49-
nibabel and nipype by executing::
48+
The easiest way to get nipype running on Mac OS X is to install Anaconda_ or
49+
Canopy_ and then add nibabel and nipype by executing::
5050

5151
easy_install nibabel
5252
easy_install nipype
5353

54-
If you are running a 64 bit version of EPD, you will need to compile
55-
ETS. Instructions for a 64-bit boot mode are available:
56-
https://gist.github.com/845545
57-
58-
5954
From source
6055
~~~~~~~~~~~
6156

@@ -131,7 +126,7 @@ Dateutil 1.5 -
131126

132127
.. note::
133128

134-
Full distributions such as pythonxy_ or EPD_ provide the above packages,
129+
Full distributions such as Anaconda_ or Canopy_ provide the above packages,
135130
except Nibabel_.
136131

137132
Strong Recommendations

doc/users/vagrant.rst

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
.. _debug:
2+
3+
======================
4+
Running Nipype in a VM
5+
======================
6+
7+
.. tip::
8+
9+
Creating the Vagrant VM as described below requires an active internet
10+
connection.
11+
12+
Container technologies (Vagrant_, Docker_) allow creating and manipulating
13+
lightweight virtual environments. The Nipype_ source now contains a Vagrantfile
14+
to launch a Vagrant_ VM.
15+
16+
Requirements:
17+
18+
* Vagrant_
19+
* Virtualbox_
20+
21+
After you have installed Vagrant and Virtualbox, you simply need to download the
22+
latest Nipype source and unzip/tar/compress it. Go into your terminal and switch
23+
to the nipype source directory. Make sure the Vagrantfile is in the directory.
24+
Now you can execute::
25+
26+
vagrant up
27+
28+
This will launch and provision the virtual machine.
29+
30+
The default virtual machine is built using Ubuntu Precise 64, linked to the
31+
NeuroDebian_ source repo and contains a 2 node Grid Engine for cluster
32+
execution.
33+
34+
The machine has a default IP address of `192.168.100.20` . From the vagrant
35+
startup directory you can log into the machine using::
36+
37+
vagrant ssh
38+
39+
Now you can install your favorite software using::
40+
41+
sudo apt-get install fsl afni
42+
43+
Also note that the directory in which you call `vagrant up` will be mounted
44+
under `/vagrant` inside the virtual machine. You can also copy the Vagrantfile
45+
or modify it in order to mount a different directory/directories.
46+
47+
Please read through Vagrant_ documentation on other features. The python
48+
environment is built using a `miniconda <http://repo.continuum.io/miniconda/>`_
49+
distribution. Hence `conda` can be used to do your python package management
50+
inside the VM.
51+
52+
.. include:: ../links_names.txt

nipype/interfaces/afni/preprocess.py

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
from nipype.utils.filemanip import fname_presuffix
2020
from .base import AFNICommand, AFNICommandInputSpec,\
2121
AFNICommandOutputSpec
22-
from nipype.interfaces.base import CommandLineInputSpec, CommandLine
22+
from nipype.interfaces.base import CommandLineInputSpec, CommandLine,\
23+
OutputMultiPath
2324

2425
warn = warnings.warn
2526
warnings.filterwarnings('always', category=UserWarning)
@@ -1443,7 +1444,7 @@ def aggregate_outputs(self, runtime=None, needed_outputs=None):
14431444
return outputs
14441445

14451446

1446-
class ROIStatsInputSpec(AFNICommandInputSpec):
1447+
class ROIStatsInputSpec(CommandLineInputSpec):
14471448
in_file = File(desc='input file to 3dROIstats',
14481449
argstr='%s',
14491450
position=-1,
@@ -1465,12 +1466,18 @@ class ROIStatsInputSpec(AFNICommandInputSpec):
14651466
argstr='-quiet',
14661467
position=1)
14671468

1469+
terminal_output = traits.Enum('allatonce',
1470+
desc=('Control terminal output:'
1471+
'`allatonce` - waits till command is '
1472+
'finished to display output'),
1473+
nohash=True, mandatory=True, usedefault=True)
1474+
14681475

14691476
class ROIStatsOutputSpec(TraitedSpec):
1470-
stats = File(desc='output', exists=True)
1477+
stats = File(desc='output tab separated values file', exists=True)
14711478

14721479

1473-
class ROIStats(AFNICommand):
1480+
class ROIStats(CommandLine):
14741481
"""Display statistics over masked regions
14751482
14761483
For complete details, see the `3dROIstats Documentation.
@@ -1492,37 +1499,13 @@ class ROIStats(AFNICommand):
14921499
output_spec = ROIStatsOutputSpec
14931500

14941501
def aggregate_outputs(self, runtime=None, needed_outputs=None):
1495-
14961502
outputs = self._outputs()
1503+
output_filename = "roi_stats.csv"
1504+
f = open(output_filename, "w")
1505+
f.write(runtime.stdout)
1506+
f.close()
14971507

1498-
outfile = os.path.join(os.getcwd(), 'stat_result.json')
1499-
1500-
if runtime is None:
1501-
try:
1502-
stats = load_json(outfile)['stat']
1503-
except IOError:
1504-
return self.run().outputs
1505-
else:
1506-
stats = []
1507-
for line in runtime.stdout.split('\n'):
1508-
if line:
1509-
values = line.split()
1510-
if len(values) > 1:
1511-
stats.append([float(val) for val in values])
1512-
else:
1513-
stats.extend([float(val) for val in values])
1514-
1515-
if len(stats) == 1:
1516-
stats = stats[0]
1517-
of = os.path.join(os.getcwd(), 'TS.1D')
1518-
f = open(of, 'w')
1519-
1520-
for st in stats:
1521-
f.write(str(st) + '\n')
1522-
f.close()
1523-
save_json(outfile, dict(stat=of))
1524-
outputs.stats = of
1525-
1508+
outputs.stats = os.path.abspath(output_filename)
15261509
return outputs
15271510

15281511

nipype/interfaces/afni/tests/test_auto_ROIStats.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,17 @@ def test_ROIStats_inputs():
55
input_map = dict(ignore_exception=dict(nohash=True,
66
usedefault=True,
77
),
8-
out_file=dict(name_source=['in_file'],
9-
name_template='%s_afni',
10-
argstr='-prefix %s',
11-
),
128
args=dict(argstr='%s',
139
),
1410
mask=dict(position=3,
1511
argstr='-mask %s',
1612
),
17-
outputtype=dict(),
1813
quiet=dict(position=1,
1914
argstr='-quiet',
2015
),
2116
terminal_output=dict(mandatory=True,
2217
nohash=True,
18+
usedefault=True,
2319
),
2420
environ=dict(nohash=True,
2521
usedefault=True,

0 commit comments

Comments
 (0)