diff --git a/ci_cd_config/.build-pages-ci.yml b/ci_cd_config/.build-pages-ci.yml index 8b0f586ddeb16ebce24e4c9a0b52c49c23dc10d9..9b3756b4520f6f058045b28e0f01f250227a1a5d 100644 --- a/ci_cd_config/.build-pages-ci.yml +++ b/ci_cd_config/.build-pages-ci.yml @@ -8,7 +8,7 @@ image: registry.ethz.ch/ibt-cmr/mri_simulation/cmrsim:pages before_script: - mkdir /cmrsim_docs - - git clone https://doc-token:${CMRSIM_DOC_TOKEN}@gitlab.ethz.ch/jweine/cmrsim_doc.git /cmrsim_doc + - git clone https://doc-token:${CMRSIM_DOC_TOKEN}@gitlab.ethz.ch/ibt-cmr/utility/cmrsim_doc.git /cmrsim_doc script: - pip install cmrseq --extra-index-url https://__token__:${CMRSEQ_PACKAGE_TOKEN}@gitlab.ethz.ch/api/v4/projects/30300/packages/pypi/simple - pip install cmrsim==${VERSION} --extra-index-url https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ethz.ch/api/v4/projects/23798/packages/pypi/simple @@ -24,9 +24,15 @@ - cd docs/source - python format_analytic.py; python format_datasets.py; python format_trajectory.py; python format_bloch.py; python format_utils.py - cd ..; make clean; make html; cd .. - artifacts: - paths: - - docs/build/html/* + after_script: + - cd /cmrsim_doc + - git status + - git checkout -b doc_build_${VERSION} + - git config --global user.email "gitlab_runner@ethz.ch" + - git config --global user.name "Gitlab-Runner" + - git add . + - git commit -m ${VERSION} + - git push --set-upstream origin doc_build_${VERSION} when: manual # Build documentation for release diff --git a/ci_cd_config/.build-tagged-containers-ci.yml b/ci_cd_config/.build-tagged-containers-ci.yml index b7914b9cae8146214e52b02928df2a89f61c0d2c..768ae03ee13905e500ec8abcdbbd8795fcf2f836 100644 --- a/ci_cd_config/.build-tagged-containers-ci.yml +++ b/ci_cd_config/.build-tagged-containers-ci.yml @@ -3,28 +3,27 @@ ## NOTE: The containers do not contain the latest cmrsim installation, but only all dependencies # Template for building the docker images: + .docker-build: stage: build_dist image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] - variables: - VERSION: $CI_COMMIT_TAG + rules: + - if: '$CI_COMMIT_TAG != null && ($CI_COMMIT_BRANCH == "development" || $CI_COMMIT_BRANCH == "master")' + variables: + VERSION: $CI_COMMIT_TAG + - if: '$CI_COMMIT_TAG == null && ($CI_COMMIT_BRANCH == "development" || $CI_COMMIT_BRANCH == "master")' + variables: + VERSION: "dev" before_script: - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json script: - echo $VERSION - echo $CI_REGISTRY_IMAGE/$IMAGE_NAME:$VERSION - - cp dist/cmrsim-$VERSION-*.whl /builds/jweine/cmrsim/docker/cmrsim-latest-py3-none-any.whl - - cd /builds/jweine/cmrsim/docker - - /kaniko/executor --context ./ --dockerfile ./Dockerfile_${IMAGE_NAME} --destination $CI_REGISTRY_IMAGE/$IMAGE_NAME:$VERSION --destination $CI_REGISTRY_IMAGE/$IMAGE_NAME:latest --cache=false + - cd ./docker + - /kaniko/executor --context ./ --dockerfile ./Dockerfile_${IMAGE_NAME} --destination $CI_REGISTRY_IMAGE/$IMAGE_NAME:$VERSION --cache=false when: manual - needs: - - python_build_tag - only: - - tags - except: - - branches docker-build-cpu: extends: .docker-build @@ -40,6 +39,5 @@ docker-build-juptyer: extends: .docker-build variables: IMAGE_NAME: jupyter - needs: - - docker-build-gpu + diff --git a/docker/Dockerfile_cpu b/docker/Dockerfile_cpu index 41a6579092dfffff4aff7d8200ba4106b320129a..677676623a26b934879d8f2f59d337ec8222c4a2 100644 --- a/docker/Dockerfile_cpu +++ b/docker/Dockerfile_cpu @@ -15,15 +15,8 @@ RUN apt-get install -y libx11-6 libgl1-mesa-dev libxrender-dev RUN pip3 install h5py scipy tqdm deprecated RUN pip3 install pyvista ffmpeg ipyvtklink panel -# Install cmrseq for sequence definitions. Latest version whl needs to be provided in context +# Install cmrseq for sequence definitions. RUN pip install cmrseq # Install cmrsim RUN pip install cmrsim - -## -# Environment -## -ENV LD_LIBRARY_PATH /usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH -RUN echo $LD_LIBRARY_PATH -ENV PATH /opt/conda/bin:$PATH diff --git a/docker/Dockerfile_gpu b/docker/Dockerfile_gpu index d14f4e2cf15f35e687b8e5c3fa809c26d0344715..8eb7c7a0adf3e62beeb936d6670a4ecd06162fc3 100644 --- a/docker/Dockerfile_gpu +++ b/docker/Dockerfile_gpu @@ -9,10 +9,28 @@ LABEL Description="This Docker image is meant to start MR simulations with the C # Pyvista dependecies RUN apt-get -y update -RUN apt-get install -y libx11-6 libgl1-mesa-dev libxrender-dev +RUN apt-get install -y -RUN pip3 install h5py scipy tqdm deprecated -RUN pip3 install pyvista ffmpeg ipyvtklink panel +# Install pyvista and dependencies +RUN apt-get update -y \ + && apt-get install -yq --no-install-recommends \ + libfontconfig1 libxrender1 libosmesa6 +RUN apt install -y libgl1-mesa-glx libxrender1 libx11-6 libgl1-mesa-dev libxrender-dev xvfb + +RUN apt-get clean && rm -rf /var/lib/apt/lists/* + +RUN pip install pyvista +RUN pip install cmocean colorcet imageio imageio-ffmpeg ipygany ipyvtklink jupyter-server-proxy +RUN pip install matplotlib meshio panel pythreejs +RUN pip install trame trame-client>=2.4.2 trame-server>=2.7.1 trame-vtk>=2.0.17 trimesh + +#RUN pip uninstall vtk -y +#RUN pip install --no-cache-dir https://github.com/pyvista/pyvista-wheels/raw/main/vtk_osmesa-9.2.5-cp39-cp39-linux_x86_64.whl + +#RUN pip install vtk pyvista ffmpeg + +# Install other packages +RUN pip install h5py scipy tqdm phantominator # Install cmrseq for sequence definitions. RUN pip install cmrseq @@ -26,4 +44,3 @@ RUN pip install cmrsim ENV LD_LIBRARY_PATH /usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH RUN echo $LD_LIBRARY_PATH -ENV PATH /opt/conda/bin:$PATH diff --git a/docker/Dockerfile_jupyter b/docker/Dockerfile_jupyter index 599357abcf7c9a494fb93698d2875f944ec0d1b5..40e575032b889eb4718df1313b9a746cac4779af 100644 --- a/docker/Dockerfile_jupyter +++ b/docker/Dockerfile_jupyter @@ -1,30 +1,37 @@ -## docker build -t registry.ethz.ch/jweine/cmrsim/jupyter:latest -f ./Dockerfile_jupyter . -FROM registry.ethz.ch/jweine/cmrsim/gpu:latest +## docker build -t registry.ethz.ch/ibt-cmr/mri_simulation/cmrsim/jupyter:latest -f ./Dockerfile_jupyter . +FROM jupyter/tensorflow-notebook:ubuntu-22.04 # maintainter from IBT LABEL maintainers="Jonathan Weine (Jonathan@biomed.ee.ethz.ch)" LABEL Description="This Docker image is meant to start MR simulations with the CMRsim package" +USER root +RUN apt update -y && apt install -y libgl1-mesa-glx xvfb +USER jovyan + # Set up jupyter lab with interactive plots and variable inspector -RUN apt-get -y update -RUN pip3 install jupyterlab -RUN pip3 install ipympl==0.8.8 matplotlib==3.5 -RUN apt-get install -y curl -RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -E -RUN apt-get install -y nodejs -RUN jupyter labextension install @jupyter-widgets/jupyterlab-manager -RUN jupyter labextension install jupyter-matplotlib +RUN pip install jupyterlab-git +RUN pip install ipympl matplotlib ipyfilechooser RUN pip install lckr-jupyterlab-variableinspector +RUN pip install ipyvtklink panel +RUN pip install trame trame-client>=2.4.2 trame-server>=2.7.1 trame-vtk>=2.0.17 trimesh + +# Install other packages +RUN pip install h5py scipy tqdm phantominator + +# Install cmrseq for sequence definitions. +RUN pip install cmrseq -# Install pyvista and dependencies -RUN apt install -y libgl1-mesa-glx libxrender1 xvfb -RUN pip install vtk pyvista phantominator +# Install cmrsim +RUN pip install cmrsim -RUN apt-get install -y git -RUN apt-get install apt-transport-https ca-certificates -y -RUN update-ca-certificates +# Must match Tf2.12 -> CUDA 11 cudnn 8 +RUN conda install -c anaconda cudnn -y -## Environment ## -ENV LD_LIBRARY_PATH /usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH -RUN echo $LD_LIBRARY_PATH +# allow jupyterlab for ipyvtk +ENV JUPYTER_ENABLE_LAB=yes +ENV PYVISTA_TRAME_SERVER_PROXY_PREFIX='/proxy/' +ENV LD_LIBRARY_PATH /opt/conda/lib:$LD_LIBRARY_PATH +ENV PATH /opt/conda/lib:$PATH +#docker push registry.ethz.ch/ibt-cmr/mri_simulation/cmrsim/jupyter:latest \ No newline at end of file diff --git a/docs/source/_static/notebook_thumbnails/breathing_motion_module.gif b/docs/source/_static/notebook_thumbnails/breathing_motion_module.gif new file mode 100644 index 0000000000000000000000000000000000000000..0a67cdcdbdd623485b723ba8c18ea2b501cb9c0f Binary files /dev/null and b/docs/source/_static/notebook_thumbnails/breathing_motion_module.gif differ diff --git a/docs/source/_static/switcher.json b/docs/source/_static/switcher.json index 1fa97f39a96d8d4ad3a416c23c7222d3bd8326a4..0afc7641d3441fc2b84a2a93ac175721bdf9553e 100644 --- a/docs/source/_static/switcher.json +++ b/docs/source/_static/switcher.json @@ -5,9 +5,19 @@ "url": "https://people.ee.ethz.ch/~jweine/cmrsim/dev/" }, { - "name": "0.25 (latest)", + "name": "0.27", + "version": "v0.27", + "url": "https://people.ee.ethz.ch/~jweine/cmrsim/latest/" + }, + { + "name": "0.26", + "version": "v0.26", + "url": "https://people.ee.ethz.ch/~jweine/cmrsim/0.26/" + }, + { + "name": "0.25", "version": "v0.25", - "url": "https://people.ee.ethz.ch/~jweine/cmrsim/latest/" + "url": "https://people.ee.ethz.ch/~jweine/cmrsim/0.25/" }, { "name": "0.24", @@ -23,10 +33,5 @@ "name": "0.22", "version": "v0.22", "url": "https://people.ee.ethz.ch/~jweine/cmrsim/0.22/" - }, - { - "name": "0.21", - "version": "v0.21", - "url": "https://people.ee.ethz.ch/~jweine/cmrsim/0.20/" } ] \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index e8ff8bed79162ad65f0737c115763626970bd399..fed60e675a5a63c04aa3c541381f5374b48c0478 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -127,7 +127,7 @@ html_theme_options = { "version_match": version_match }, "navbar_start": ["navbar-logo", "version-switcher"], - "page_sidebar_items": ["page-toc", "class_page_toc"], + "secondary_sidebar_items": ["page-toc", "class_page_toc"], } # Add any paths that contain custom static files (such as style sheets) here, @@ -150,7 +150,6 @@ autodoc_default_options = { 'imported-members': False, 'autoclass_content': 'both', 'autodoc_class_signature': 'mixed' - } nbsphinx_thumbnails = { @@ -167,6 +166,7 @@ nbsphinx_thumbnails = { 'example_gallery/trajectory_modules/flow_trajectory_module': '_static/notebook_thumbnails/trajectory_laminar_flow.png', 'example_gallery/trajectory_modules/turbulent_flow': '_static/notebook_thumbnails/trajectory_turbulent_flow.png', 'example_gallery/trajectory_modules/taylor_trajectories': '_static/notebook_thumbnails/taylor_trajectories.gif', + 'example_gallery/trajectory_modules/breathing_motion_module': '_static/notebook_thumbnails/breathing_motion_module.gif', 'example_gallery/trajectory_modules/cardiac_mesh_pod': '_static/notebook_thumbnails/pod_trajectory.png', 'example_gallery/trajectory_modules/contracting_cardiac_mesh_with_random_disp': '_static/notebook_thumbnails/trajectory_bulk_and_diffusion.gif', # Analytic diff --git a/docs/source/examples.rst b/docs/source/examples.rst index fb3e4cb3c6251dced7436f8d193ad5a9bdd2713f..8be034d2fc79ce85c508f477d8fce56a9a4a8291 100644 --- a/docs/source/examples.rst +++ b/docs/source/examples.rst @@ -41,6 +41,10 @@ Trajectory Modules .. nbgallery:: example_gallery/trajectory_modules/taylor_trajectories + .. card:: Periodic Breathing motion + + .. nbgallery:: example_gallery/trajectory_modules/breathing_motion_module + .. card:: Proper orthogonal decomposition .. nbgallery:: example_gallery/trajectory_modules/cardiac_mesh_pod