🔨Building and 🧪testing the container
Building¶
Once your scripts are ready, you can build the container by calling ./do_build.sh
. The recommendation is for your containers to be tested locally before they are uploaded to grand-challenge.org. Uploading a container always takes time and it's best to keep grand-challenge.org out of your development loop.
Testing¶
The templated algorithm provides a testing script (do_test_run.sh
). We'll utilize that for writing a small pytest test.
In our example, we restructured the test
folder by placing the first retinal fundus image from the test set of the DRIVE challenge. The test/input/
folder should contain the raw inputs:
test
└── input
├── age-in-months.json
└── images
└── color-fundus
└── 3a7e206e-544c-4027-8008-a185a1eee34c.mha
We further conjure a Python script that automatically tests the algorithm for our use case.
import subprocess
from pathlib import Path
OUTPUT_DIR = Path("test") / "output"
def test_do_test_run():
# Step 1: Run the shell script using subprocess
result = subprocess.run(["./do_test_run.sh"], capture_output=True, text=True)
# Step 2: Check if the script executed successfully
assert result.returncode == 0, f"Script failed with error: {result.stderr}"
# Step:3 Verify the output got created
expected_output = OUTPUT_DIR / "images" / "binary-vessel-segmentation" / "output.mha"
assert expected_output.exists()
You can invoke the testing script by calling python test.py
assuming you have pytest
installed.
One can extend the test script to also look at the content of the output and verify if if, for instance, has the correct voxel value ranges.
đź’ˇ If you already have exported containers in your working directory, you can add *.tar.gz
files into a .dockerignore
file to make your builds much faster. This speeds up your development and testing processes.
⚠️Docker Desktop for Windows 10 does not have GPU support. You would need Windows 11 and WSL2 with Ubuntu 18.04 for GPU support with Docker. Note that this does not compromise your building and exporting processes. It only hampers your testing process. You can avoid this by testing with CPU-only mode if possible. Make sure to remove the --gpus=all
flag. Otherwise, you will have to test your container by running it on an Ubuntu environment if you need GPU access.