diff --git a/CHANGES.txt b/CHANGES.txt index 331bbfcea..378be4518 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 ===== diff --git a/Dockerfile b/Dockerfile index 5edf7d4ed..bc22ad420 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,6 @@ RUN apt-get update && \ curl \ bzip2 \ ca-certificates \ - xvfb \ cython3 \ build-essential \ autoconf \ @@ -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 \ @@ -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" \ diff --git a/mriqc/workflows/anatomical.py b/mriqc/workflows/anatomical.py index 79a391a6f..9bb22284b 100644 --- a/mriqc/workflows/anatomical.py +++ b/mriqc/workflows/anatomical.py @@ -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') @@ -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') @@ -308,6 +310,7 @@ def _getwm(inlist): ]) return workflow + def individual_reports(settings, name='ReportsWorkflow'): """ Encapsulates nodes writing plots diff --git a/mriqc/workflows/functional.py b/mriqc/workflows/functional.py index 1ceba8c04..e9afd5579 100644 --- a/mriqc/workflows/functional.py +++ b/mriqc/workflows/functional.py @@ -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 @@ -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) diff --git a/mriqc/workflows/utils.py b/mriqc/workflows/utils.py index 92dc0c756..08c39f7ab 100644 --- a/mriqc/workflows/utils.py +++ b/mriqc/workflows/utils.py @@ -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): @@ -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