diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 000000000..4d3d87f13 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,86 @@ +name: Documentation + +on: + push: + +permissions: + contents: write + +concurrency: + group: docs-${{ github.ref }} + cancel-in-progress: false + +env: + FORCE_COLOR: 1 + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v6 + + - name: Install dependencies + run: uv sync --group doc + + - name: Install just + uses: extractions/setup-just@v3 + + - name: Restore TorchIO cached data + id: cache-torchio-data-restore + uses: actions/cache/restore@v4 + with: + path: ~/.cache/torchio + key: ${{ runner.os }}-torchio-data + + - name: Build docs + run: just build-docs + + - name: Save TorchIO cached data + if: steps.cache-torchio-data-restore.outputs.cache-hit != 'true' + id: cache-torchio-data-save + uses: actions/cache@v4 + with: + path: ~/.cache/torchio + key: ${{ steps.cache-torchio-data-restore.outputs.cache-primary-key }} + + # Uploade to smokeshow if not on main branch + - name: Upload docs to smokeshow + if: github.ref != 'refs/heads/main' + run: | + rm ./docs/build/html/_images/*.gif + rm ./docs/build/html/_images/*.png + uvx smokeshow upload ./docs/build/html + + # Upload to GitHub Pages if on main branch + - name: Upload artifacts using actions/upload-pages-artifact + if: github.ref == 'refs/heads/main' + id: deployment + uses: actions/upload-pages-artifact@v3 + with: + path: ./docs/build/html + + deploy: + if: github.ref == 'refs/heads/main' + + needs: build + + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + + runs-on: ubuntu-latest + + # Deploy to the github-pages environment + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/docs/source/data/image.rst b/docs/source/data/image.rst index bc170940e..45e358315 100644 --- a/docs/source/data/image.rst +++ b/docs/source/data/image.rst @@ -41,6 +41,7 @@ structure. .. autoclass:: ScalarImage + :members: .. autoclass:: LabelMap diff --git a/pyproject.toml b/pyproject.toml index 9e64d326e..5c36185cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,6 +75,7 @@ dev = [ "pre-commit-uv==4.1.4", ] doc = [ + "distinctipy==1.3.4", "einops==0.8.0", "furo==2024.8.6", "matplotlib==3.9.4", diff --git a/src/torchio/transforms/preprocessing/spatial/to_canonical.py b/src/torchio/transforms/preprocessing/spatial/to_canonical.py index 75ee1bd98..22503fc98 100644 --- a/src/torchio/transforms/preprocessing/spatial/to_canonical.py +++ b/src/torchio/transforms/preprocessing/spatial/to_canonical.py @@ -22,6 +22,3 @@ class ToCanonical(ToOrientation): .. _NiBabel docs about image orientation: https://nipy.org/nibabel/image_orientation.html """ - - def __init__(self, **kwargs): - super().__init__('RAS', **kwargs)