Skip to content

Commit

Permalink
update bidsvalidator
Browse files Browse the repository at this point in the history
  • Loading branch information
PeerHerholz committed Aug 12, 2020
1 parent 8865235 commit 62e4616
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 46 deletions.
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generated by Neurodocker version 0.5.0
# Timestamp: 2019-11-08 16:38:08 UTC
# Timestamp: 2020-08-12 21:15:26 UTC
#
# Thank you for using Neurodocker. If you discover any issues
# or ways to improve this software, please submit an issue or
Expand Down Expand Up @@ -52,7 +52,7 @@ RUN apt-get update -qq \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN bash -c 'curl -sL https://deb.nodesource.com/setup_8.x | bash - && apt-get install -y nodejs && apt-get install -y npm'
RUN bash -c 'curl -sL https://deb.nodesource.com/setup_10.x | bash - && apt-get install -y nodejs && apt-get install -y npm'

RUN sed -i '$isource /etc/fsl/fsl.sh' $ND_ENTRYPOINT

Expand All @@ -63,7 +63,7 @@ ENV FSLDIR="/usr/share/fsl/5.0" \
LD_LIBRARY_PATH="/usr/lib/fsl/5.0:" \
FSLTCLSH="/usr/bin/tclsh" \
FSLWISH="/usr/bin/wish" \
PATH="/usr/lib/fsl/5.0:/Users/peerherholz/abin:/usr/local/antsbin/bin:/Applications/MATLAB_R2014a.app/bin:/Applications/freesurfer/bin:/Applications/freesurfer/fsfast/bin:/Applications/freesurfer/tktools:/usr/local/fsl/bin:/Applications/freesurfer/mni/bin:/usr/local/fsl/bin:/Users/peerherholz/anaconda3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/workbench/bin_macosx64:/usr/local/texlive/2019/bin/x86_64-darwin"
PATH="/usr/lib/fsl/5.0:/Users/peerherholz/anaconda3/bin:/Users/peerherholz/anaconda3/condabin:/Users/peerherholz/abin:/usr/local/antsbin/bin:/Applications/MATLAB_R2014a.app/bin:/Applications/freesurfer/bin:/Applications/freesurfer/fsfast/bin:/usr/local/fsl/bin:/Applications/freesurfer/mni/bin:/usr/local/fsl/bin:/Users/peerherholz/anaconda3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/workbench/bin_macosx64:/usr/local/texlive/2019/bin/x86_64-darwin"

ENV CONDA_DIR="/opt/miniconda-latest" \
PATH="/opt/miniconda-latest/bin:$PATH"
Expand Down Expand Up @@ -109,7 +109,7 @@ ENV MRIDEFACER_DATA_DIR="/mridefacer/data"

RUN bash -c 'rm -r /usr/share/fsl/data/atlases && rm -r /usr/share/fsl/data/first && rm -r /usr/share/fsl/data/possum'

RUN bash -c 'npm install -g bids-validator@1.2.3'
RUN bash -c 'npm install -g bids-validator@1.5.4'

RUN bash -c 'mkdir /home/mri-deface-detector && cd /home/mri-deface-detector && npm install sharp --unsafe-perm && npm install -g mri-deface-detector --unsafe-perm && cd ~'

Expand Down Expand Up @@ -150,7 +150,7 @@ RUN echo '{ \
\n ], \
\n [ \
\n "run_bash", \
\n "curl -sL https://deb.nodesource.com/setup_8.x | bash - && apt-get install -y nodejs && apt-get install -y npm" \
\n "curl -sL https://deb.nodesource.com/setup_10.x | bash - && apt-get install -y nodejs && apt-get install -y npm" \
\n ], \
\n [ \
\n "add_to_entrypoint", \
Expand All @@ -166,7 +166,7 @@ RUN echo '{ \
\n "LD_LIBRARY_PATH": "/usr/lib/fsl/5.0:", \
\n "FSLTCLSH": "/usr/bin/tclsh", \
\n "FSLWISH": "/usr/bin/wish", \
\n "PATH": "/usr/lib/fsl/5.0:/Users/peerherholz/abin:/usr/local/antsbin/bin:/Applications/MATLAB_R2014a.app/bin:/Applications/freesurfer/bin:/Applications/freesurfer/fsfast/bin:/Applications/freesurfer/tktools:/usr/local/fsl/bin:/Applications/freesurfer/mni/bin:/usr/local/fsl/bin:/Users/peerherholz/anaconda3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/workbench/bin_macosx64:/usr/local/texlive/2019/bin/x86_64-darwin" \
\n "PATH": "/usr/lib/fsl/5.0:/Users/peerherholz/anaconda3/bin:/Users/peerherholz/anaconda3/condabin:/Users/peerherholz/abin:/usr/local/antsbin/bin:/Applications/MATLAB_R2014a.app/bin:/Applications/freesurfer/bin:/Applications/freesurfer/fsfast/bin:/usr/local/fsl/bin:/Applications/freesurfer/mni/bin:/usr/local/fsl/bin:/Users/peerherholz/anaconda3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/workbench/bin_macosx64:/usr/local/texlive/2019/bin/x86_64-darwin" \
\n } \
\n ], \
\n [ \
Expand Down Expand Up @@ -220,7 +220,7 @@ RUN echo '{ \
\n ], \
\n [ \
\n "run_bash", \
\n "npm install -g bids-validator@1.2.3" \
\n "npm install -g bids-validator@1.5.4" \
\n ], \
\n [ \
\n "run_bash", \
Expand Down
66 changes: 57 additions & 9 deletions Singularity
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generated by Neurodocker version 0.5.0
# Timestamp: 2019-11-08 16:38:11 UTC
# Timestamp: 2020-08-12 21:15:27 UTC
#
# Thank you for using Neurodocker. If you discover any issues
# or ways to improve this software, please submit an issue or
Expand Down Expand Up @@ -40,10 +40,15 @@ apt-get install -y -q --no-install-recommends \
fsl-complete \
git \
num-utils \
gcc
gcc \
g++ \
curl \
build-essential
apt-get clean
rm -rf /var/lib/apt/lists/*

bash -c 'curl -sL https://deb.nodesource.com/setup_10.x | bash - && apt-get install -y nodejs && apt-get install -y npm'

sed -i '$isource /etc/fsl/fsl.sh' $ND_ENTRYPOINT

export PATH="/opt/miniconda-latest/bin:$PATH"
Expand All @@ -68,8 +73,8 @@ sync && conda clean --all && sync
bash -c "source activate bidsonym
pip install --no-cache-dir \
'deepdefacer' \
'nobrainer' \
'tensorflow'"
'tensorflow' \
'scikit-image'"
rm -rf ~/.cache/pip/*
sync
sed -i '$isource activate bidsonym' $ND_ENTRYPOINT
Expand All @@ -79,14 +84,26 @@ bash -c 'source activate bidsonym && git clone https://github.com/poldracklab/py

bash -c 'source activate bidsonym && git clone https://github.com/nipy/quickshear.git && cd quickshear && python setup.py install && cd -'

bash -c 'source activate bidsonym && git clone https://github.com/neuronets/nobrainer.git && cd nobrainer && python setup.py install && cd -'

bash -c 'mkdir -p /opt/nobrainer/models && cd /opt/nobrainer/models && curl -LJO https://github.com/neuronets/nobrainer-models/releases/download/0.1/brain-extraction-unet-128iso-model.h5 && cd ~ '

bash -c 'git clone https://github.com/mih/mridefacer'

bash -c 'rm -r /usr/share/fsl/data/atlases && rm -r /usr/share/fsl/data/first && rm -r /usr/share/fsl/data/possum'

bash -c 'npm install -g [email protected]'

bash -c 'mkdir /home/mri-deface-detector && cd /home/mri-deface-detector && npm install sharp --unsafe-perm && npm install -g mri-deface-detector --unsafe-perm && cd ~'

bash -c 'git clone https://github.com/miykael/gif_your_nifti && cd gif_your_nifti && source activate bidsonym && python setup.py install'

bash -c 'chmod a+x /home/bm/bidsonym/fs_data/mri_deface'

bash -c 'source activate bidsonym && cd /home/bm && pip install -e .'

cd /tmp/

echo '{
\n "pkg_manager": "apt",
\n "instructions": [
Expand All @@ -107,10 +124,17 @@ echo '{
\n "fsl-complete",
\n "git",
\n "num-utils",
\n "gcc"
\n "gcc",
\n "g++",
\n "curl",
\n "build-essential"
\n ]
\n ],
\n [
\n "run_bash",
\n "curl -sL https://deb.nodesource.com/setup_10.x | bash - && apt-get install -y nodejs && apt-get install -y npm"
\n ],
\n [
\n "add_to_entrypoint",
\n "source /etc/fsl/fsl.sh"
\n ],
Expand All @@ -124,7 +148,7 @@ echo '{
\n "LD_LIBRARY_PATH": "/usr/lib/fsl/5.0:",
\n "FSLTCLSH": "/usr/bin/tclsh",
\n "FSLWISH": "/usr/bin/wish",
\n "PATH": "/usr/lib/fsl/5.0:/Users/peerherholz/abin:/usr/local/antsbin/bin:/Applications/MATLAB_R2014a.app/bin:/Applications/freesurfer/bin:/Applications/freesurfer/fsfast/bin:/Applications/freesurfer/tktools:/usr/local/fsl/bin:/Applications/freesurfer/mni/bin:/usr/local/fsl/bin:/Users/peerherholz/anaconda3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/workbench/bin_macosx64:/usr/local/texlive/2019/bin/x86_64-darwin"
\n "PATH": "/usr/lib/fsl/5.0:/Users/peerherholz/anaconda3/bin:/Users/peerherholz/anaconda3/condabin:/Users/peerherholz/abin:/usr/local/antsbin/bin:/Applications/MATLAB_R2014a.app/bin:/Applications/freesurfer/bin:/Applications/freesurfer/fsfast/bin:/usr/local/fsl/bin:/Applications/freesurfer/mni/bin:/usr/local/fsl/bin:/Users/peerherholz/anaconda3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/workbench/bin_macosx64:/usr/local/texlive/2019/bin/x86_64-darwin"
\n }
\n ],
\n [
Expand All @@ -139,8 +163,8 @@ echo '{
\n ],
\n "pip_install": [
\n "deepdefacer",
\n "nobrainer",
\n "tensorflow"
\n "tensorflow",
\n "scikit-image"
\n ],
\n "create_env": "bidsonym",
\n "activate": true
Expand All @@ -156,6 +180,14 @@ echo '{
\n ],
\n [
\n "run_bash",
\n "source activate bidsonym && git clone https://github.com/neuronets/nobrainer.git && cd nobrainer && python setup.py install && cd -"
\n ],
\n [
\n "run_bash",
\n "mkdir -p /opt/nobrainer/models && cd /opt/nobrainer/models && curl -LJO https://github.com/neuronets/nobrainer-models/releases/download/0.1/brain-extraction-unet-128iso-model.h5 && cd ~ "
\n ],
\n [
\n "run_bash",
\n "git clone https://github.com/mih/mridefacer"
\n ],
\n [
Expand All @@ -169,6 +201,18 @@ echo '{
\n "rm -r /usr/share/fsl/data/atlases && rm -r /usr/share/fsl/data/first && rm -r /usr/share/fsl/data/possum"
\n ],
\n [
\n "run_bash",
\n "npm install -g [email protected]"
\n ],
\n [
\n "run_bash",
\n "mkdir /home/mri-deface-detector && cd /home/mri-deface-detector && npm install sharp --unsafe-perm && npm install -g mri-deface-detector --unsafe-perm && cd ~"
\n ],
\n [
\n "run_bash",
\n "git clone https://github.com/miykael/gif_your_nifti && cd gif_your_nifti && source activate bidsonym && python setup.py install"
\n ],
\n [
\n "copy",
\n [
\n ".",
Expand Down Expand Up @@ -197,6 +241,10 @@ echo '{
\n }
\n ],
\n [
\n "workdir",
\n "/tmp/"
\n ],
\n [
\n "entrypoint",
\n "/neurodocker/startup.sh bidsonym"
\n ]
Expand All @@ -214,7 +262,7 @@ export POSSUMDIR="/usr/share/fsl/5.0"
export LD_LIBRARY_PATH="/usr/lib/fsl/5.0:"
export FSLTCLSH="/usr/bin/tclsh"
export FSLWISH="/usr/bin/wish"
export PATH="/usr/lib/fsl/5.0:/Users/peerherholz/abin:/usr/local/antsbin/bin:/Applications/MATLAB_R2014a.app/bin:/Applications/freesurfer/bin:/Applications/freesurfer/fsfast/bin:/Applications/freesurfer/tktools:/usr/local/fsl/bin:/Applications/freesurfer/mni/bin:/usr/local/fsl/bin:/Users/peerherholz/anaconda3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/workbench/bin_macosx64:/usr/local/texlive/2019/bin/x86_64-darwin"
export PATH="/usr/lib/fsl/5.0:/Users/peerherholz/anaconda3/bin:/Users/peerherholz/anaconda3/condabin:/Users/peerherholz/abin:/usr/local/antsbin/bin:/Applications/MATLAB_R2014a.app/bin:/Applications/freesurfer/bin:/Applications/freesurfer/fsfast/bin:/usr/local/fsl/bin:/Applications/freesurfer/mni/bin:/usr/local/fsl/bin:/Users/peerherholz/anaconda3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/workbench/bin_macosx64:/usr/local/texlive/2019/bin/x86_64-darwin"
export CONDA_DIR="/opt/miniconda-latest"
export PATH="/opt/miniconda-latest/bin:$PATH"
export MRIDEFACER_DATA_DIR="/mridefacer/data"
Expand Down
2 changes: 1 addition & 1 deletion bidsonym/run_deeid.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
run_brain_extraction_nb, run_brain_extraction_bet, validate_input_dir)
from bids import BIDSLayout


def get_parser():

__version__ = open(os.path.join(os.path.dirname(os.path.realpath(__file__)),
Expand Down Expand Up @@ -97,7 +98,6 @@ def run_deeid():
"This refers to:")
print(list_part_prob)


list_check_meta = args.check_meta

list_field_del = args.del_meta
Expand Down
4 changes: 4 additions & 0 deletions bidsonym/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,7 @@ def deface_t2w(image, warped_mask, outfile):
masked_brain = Nifti1Image(outdata, infile_img.get_affine(),
infile_img.get_header())
masked_brain.to_filename(outfile)




65 changes: 36 additions & 29 deletions generate_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ generate_docker() {
--base neurodebian:stretch-non-free \
--pkg-manager apt \
--install fsl-complete git num-utils gcc g++ curl build-essential\
--run-bash "curl -sL https://deb.nodesource.com/setup_8.x | bash - && apt-get install -y nodejs && apt-get install -y npm"\
--run-bash "curl -sL https://deb.nodesource.com/setup_10.x | bash - && apt-get install -y nodejs && apt-get install -y npm"\
--add-to-entrypoint "source /etc/fsl/fsl.sh" \
--env FSLDIR=/usr/share/fsl/5.0 \
FSLOUTPUTTYPE=NIFTI_GZ \
Expand All @@ -35,7 +35,7 @@ generate_docker() {
--run-bash "git clone https://github.com/mih/mridefacer" \
--env MRIDEFACER_DATA_DIR=/mridefacer/data \
--run-bash "rm -r /usr/share/fsl/data/atlases && rm -r /usr/share/fsl/data/first && rm -r /usr/share/fsl/data/possum" \
--run-bash "npm install -g bids-validator@1.2.3" \
--run-bash "npm install -g bids-validator@1.5.4" \
--run-bash "mkdir /home/mri-deface-detector && cd /home/mri-deface-detector && npm install sharp --unsafe-perm && npm install -g mri-deface-detector --unsafe-perm && cd ~" \
--run-bash "git clone https://github.com/miykael/gif_your_nifti && cd gif_your_nifti && source activate bidsonym && python setup.py install" \
--copy . /home/bm \
Expand All @@ -49,34 +49,41 @@ generate_docker() {

generate_singularity() {
docker run --rm kaczmarj/neurodocker:0.5.0 generate singularity \
--base neurodebian:stretch-non-free \
--pkg-manager apt \
--install fsl-complete git num-utils gcc \
--add-to-entrypoint "source /etc/fsl/fsl.sh" \
--env FSLDIR=/usr/share/fsl/5.0 \
FSLOUTPUTTYPE=NIFTI_GZ \
FSLMULTIFILEQUIT=TRUE \
POSSUMDIR=/usr/share/fsl/5.0 \
LD_LIBRARY_PATH=/usr/lib/fsl/5.0:$LD_LIBRARY_PATH \
FSLTCLSH=/usr/bin/tclsh \
FSLWISH=/usr/bin/wish \
PATH=/usr/lib/fsl/5.0:$PATH \
--base neurodebian:stretch-non-free \
--pkg-manager apt \
--install fsl-complete git num-utils gcc g++ curl build-essential\
--run-bash "curl -sL https://deb.nodesource.com/setup_10.x | bash - && apt-get install -y nodejs && apt-get install -y npm"\
--add-to-entrypoint "source /etc/fsl/fsl.sh" \
--env FSLDIR=/usr/share/fsl/5.0 \
FSLOUTPUTTYPE=NIFTI_GZ \
FSLMULTIFILEQUIT=TRUE \
POSSUMDIR=/usr/share/fsl/5.0 \
LD_LIBRARY_PATH=/usr/lib/fsl/5.0:$LD_LIBRARY_PATH \
FSLTCLSH=/usr/bin/tclsh \
FSLWISH=/usr/bin/wish \
PATH=/usr/lib/fsl/5.0:$PATH \
--miniconda \
conda_install="python=3.6 numpy nipype nibabel pandas" \
pip_install='deepdefacer nobrainer tensorflow' \
create_env='bidsonym' \
activate=true \
--run-bash "source activate bidsonym && git clone https://github.com/poldracklab/pydeface.git && cd pydeface && python setup.py install && cd -" \
--run-bash "source activate bidsonym && git clone https://github.com/nipy/quickshear.git && cd quickshear && python setup.py install && cd -" \
--run-bash "git clone https://github.com/mih/mridefacer" \
--env MRIDEFACER_DATA_DIR=/mridefacer/data \
--run-bash "rm -r /usr/share/fsl/data/atlases && rm -r /usr/share/fsl/data/first && rm -r /usr/share/fsl/data/possum" \
--copy . /home/bm \
--run-bash "chmod a+x /home/bm/bidsonym/fs_data/mri_deface" \
--run-bash "source activate bidsonym && cd /home/bm && pip install -e ." \
--copy example_data /home/bidsonym/example_data \
--env IS_DOCKER=1 \
--entrypoint "/neurodocker/startup.sh bidsonym"
conda_install="python=3.6 numpy nipype nibabel pandas" \
pip_install='deepdefacer tensorflow scikit-image' \
create_env='bidsonym' \
activate=true \
--run-bash "source activate bidsonym && git clone https://github.com/poldracklab/pydeface.git && cd pydeface && python setup.py install && cd -" \
--run-bash "source activate bidsonym && git clone https://github.com/nipy/quickshear.git && cd quickshear && python setup.py install && cd -" \
--run-bash "source activate bidsonym && git clone https://github.com/neuronets/nobrainer.git && cd nobrainer && python setup.py install && cd -" \
--run-bash "mkdir -p /opt/nobrainer/models && cd /opt/nobrainer/models && curl -LJO https://github.com/neuronets/nobrainer-models/releases/download/0.1/brain-extraction-unet-128iso-model.h5 && cd ~ " \
--run-bash "git clone https://github.com/mih/mridefacer" \
--env MRIDEFACER_DATA_DIR=/mridefacer/data \
--run-bash "rm -r /usr/share/fsl/data/atlases && rm -r /usr/share/fsl/data/first && rm -r /usr/share/fsl/data/possum" \
--run-bash "npm install -g [email protected]" \
--run-bash "mkdir /home/mri-deface-detector && cd /home/mri-deface-detector && npm install sharp --unsafe-perm && npm install -g mri-deface-detector --unsafe-perm && cd ~" \
--run-bash "git clone https://github.com/miykael/gif_your_nifti && cd gif_your_nifti && source activate bidsonym && python setup.py install" \
--copy . /home/bm \
--run-bash "chmod a+x /home/bm/bidsonym/fs_data/mri_deface" \
--run-bash "source activate bidsonym && cd /home/bm && pip install -e ." \
--copy example_data /home/bidsonym/example_data \
--env IS_DOCKER=1 \
--workdir '/tmp/' \
--entrypoint "/neurodocker/startup.sh bidsonym"
}

# generate files
Expand Down

0 comments on commit 62e4616

Please sign in to comment.