Skip to content

Commit

Permalink
Merge pull request #669 from chrisfilo/enh/afni_update
Browse files Browse the repository at this point in the history
AFNI update
  • Loading branch information
oesteban authored Nov 19, 2017
2 parents 40a8222 + f1bba17 commit 61b7a32
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 12 deletions.
6 changes: 5 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
0.9.10
======

* [FIX] Updated AFNI to 17.3.03. Resolves errors regarding opening display by 3dSkullStrip (#669)

0.9.9
=====

* [ENH] Update nipype to fix $DISPLAY problem of AFNI's 3dSkullStrip


0.9.8
=====

Expand Down
35 changes: 27 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ RUN apt-get update && \
curl \
bzip2 \
ca-certificates \
xvfb \
cython3 \
build-essential \
autoconf \
Expand All @@ -20,12 +19,11 @@ RUN apt-get update && \
apt-key add /root/.neurodebian.gpg && \
(apt-key adv --refresh-keys --keyserver hkp://ha.pool.sks-keyservers.net 0xA5D32F012649A5A9 || true)

# Installing Neurodebian packages (FSL, AFNI, git)
# Installing Neurodebian packages (FSL, git)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
fsl-core \
fsl-mni152-templates \
afni
fsl-mni152-templates

ENV FSLDIR=/usr/share/fsl/5.0 \
FSLOUTPUTTYPE=NIFTI_GZ \
Expand All @@ -34,12 +32,33 @@ ENV FSLDIR=/usr/share/fsl/5.0 \
LD_LIBRARY_PATH=/usr/lib/fsl/5.0:$LD_LIBRARY_PATH \
FSLTCLSH=/usr/bin/tclsh \
FSLWISH=/usr/bin/wish \
AFNI_MODELPATH=/usr/lib/afni/models \
AFNI_IMSAVE_WARNINGS=NO \
AFNI_TTATLAS_DATASET=/usr/share/afni/atlases \
AFNI_PLUGINPATH=/usr/lib/afni/plugins \
PATH=/usr/lib/fsl/5.0:/usr/lib/afni/bin:$PATH

# Installing AFNI (version 17_3_03 archived on OSF)
RUN apt-get update -qq && apt-get install -yq --no-install-recommends ed gsl-bin libglu1-mesa-dev libglib2.0-0 libglw1-mesa \
libgomp1 libjpeg62 libxm4 netpbm tcsh xfonts-base xvfb && \
libs_path=/usr/lib/x86_64-linux-gnu && \
if [ -f $libs_path/libgsl.so.19 ]; then \
ln $libs_path/libgsl.so.19 $libs_path/libgsl.so.0; \
fi && \
echo "Install libxp (not in all ubuntu/debian repositories)" && \
apt-get install -yq --no-install-recommends libxp6 \
|| /bin/bash -c " \
curl --retry 5 -o /tmp/libxp6.deb -sSL http://mirrors.kernel.org/debian/pool/main/libx/libxp/libxp6_1.0.2-2_amd64.deb \
&& dpkg -i /tmp/libxp6.deb && rm -f /tmp/libxp6.deb" && \
echo "Install libpng12 (not in all ubuntu/debian repositories" && \
apt-get install -yq --no-install-recommends libpng12-0 \
|| /bin/bash -c " \
curl -o /tmp/libpng12.deb -sSL http://mirrors.kernel.org/debian/pool/main/libp/libpng/libpng12-0_1.2.49-1%2Bdeb7u2_amd64.deb \
&& dpkg -i /tmp/libpng12.deb && rm -f /tmp/libpng12.deb" && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
mkdir -p /opt/afni && \
curl -o afni.tar.gz -sSLO "https://files.osf.io/v1/resources/fvuh8/providers/osfstorage/5a0dd9a7b83f69027512a12b" && \
tar zxv -C /opt/afni --strip-components=1 -f afni.tar.gz && \
rm -rf afni.tar.gz
ENV PATH=/opt/afni:$PATH

# Installing and setting up ANTs
RUN mkdir -p /opt/ants && \
curl -sSL "https://github.com/stnava/ANTs/releases/download/v2.1.0/Linux_Ubuntu14.04.tar.bz2" \
Expand Down
7 changes: 5 additions & 2 deletions mriqc/workflows/anatomical.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
from ..interfaces import (StructuralQC, ArtifactMask, ReadSidecarJSON,
ConformImage, ComputeQI2, IQMFileSink, RotationMask)
from ..utils.misc import check_folder
from .utils import get_fwhmx
WFLOGGER = logging.getLogger('mriqc.workflow')


Expand Down Expand Up @@ -241,8 +242,9 @@ def compute_iqms(settings, modality='T1w', name='ComputeIQMs'):
}

# AFNI check smoothing
fwhm = pe.Node(afni.FWHMx(combine=True, detrend=True), name='smoothness')
# fwhm.inputs.acf = True # add when AFNI >= 16
fwhm_interface = get_fwhmx()

fwhm = pe.Node(fwhm_interface, name='smoothness')

# Harmonize
homog = pe.Node(Harmonize(), name='harmonize')
Expand Down Expand Up @@ -308,6 +310,7 @@ def _getwm(inlist):
])
return workflow


def individual_reports(settings, name='ReportsWorkflow'):
"""
Encapsulates nodes writing plots
Expand Down
4 changes: 3 additions & 1 deletion mriqc/workflows/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from niworkflows.nipype.interfaces import utility as niu
from niworkflows.nipype.interfaces import afni, ants, fsl

from .utils import get_fwhmx
from .. import DEFAULTS, logging
from ..interfaces import ReadSidecarJSON, FunctionalQC, Spikes, IQMFileSink
from ..utils.misc import check_folder, reorient_and_discard_non_steady
Expand Down Expand Up @@ -222,7 +223,8 @@ def compute_iqms(settings, name='ComputeIQMs'):
mem_gb=biggest_file_gb * 3)

# AFNI quality measures
fwhm = pe.Node(afni.FWHMx(combine=True, detrend=True), name='smoothness')
fwhm_interface = get_fwhmx()
fwhm = pe.Node(fwhm_interface, name='smoothness')
# fwhm.inputs.acf = True # add when AFNI >= 16
outliers = pe.Node(afni.OutlierCount(fraction=True, out_file='outliers.out'),
name='outliers', mem_gb=biggest_file_gb * 2.5)
Expand Down
12 changes: 12 additions & 0 deletions mriqc/workflows/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# @Last modified by: oesteban
"""Helper functions for the workflows"""
from __future__ import print_function, division, absolute_import, unicode_literals
from distutils.version import StrictVersion
from niworkflows.nipype.interfaces import afni
from builtins import range

def _tofloat(inlist):
Expand Down Expand Up @@ -160,3 +162,13 @@ def slice_wise_fft(in_file, ftmask=None, spike_thres=3., out_prefix=None):
np.savetxt(out_spikes, spikes_list, fmt=b'%d', delimiter=b'\t', header='TR\tZ')

return len(spikes_list), out_spikes, out_fft

def get_fwhmx():
fwhm_args = {"combine": True,
"detrend": True}
afni_version = StrictVersion('%s.%s.%s' % afni.Info.version())
if afni_version >= StrictVersion("2017.2.3"):
fwhm_args['args'] = '-ShowMeClassicFWHM'
fwhm_args['acf'] = True
fwhm_interface = afni.FWHMx(**fwhm_args)
return fwhm_interface

0 comments on commit 61b7a32

Please sign in to comment.