Instructions for Developers
How to build the Docker image locally
Go to the clone directory of your fork and run the following command in the terminal
cd pacsifier make -B build-docker
Note
The tag of the version of the image is generated from the git tag thanks to the versioneer.py library.
How to install PACSIFIER locally
PACSIFIER relies on the DCMTK tools for DICOM network communication. It can be easily installed on Ubuntu with the following command:
apt-get install dcmtk
For other operating systems, please refer to the DCMTK documentation.
Install the Python environment with
PACSIFIERand its dependencies.It is recommended to use a virtual environment, which can be created using venv or conda. For convenience, a minimal
condaenvironment is provided in theenvironmentdirectory of the repository. It can be installed as follows:conda env create -f environment/environment_minimal_202401.yml conda activate pacsifier_minimal
If you prefer to use
venv, you can create a virtual environment and activate it as follows:python3 -m venv venv source venv/bin/activate
Important
PACSIFIER requires a Python environment with python>=3.10.
Once the virtual environment is activated, install
PACSIFIERalong with all its Python dependencies (including dependencies to build the documentation and to test the package):pip install -e .[all]
or on some shells where brackets need escaping:
pip install -e .\[all\]
How to build the documentation locally
Go to the cloned repository and run the following make command:
make -B build-docs
This will re-install PACSIFIER’s python package, clean any existing documentation, and build the documentation in the docs/_build/html directory.
The built HTML files of the documentation, including its main page (index.html), can be found in the docs/_build/html directory, and can be opened in your favorite browser.
How to run the tests via the Docker image
Go to the clone directory of your fork and (re-)build the Docker image with the following commands:
make -B build-docker
Run the tests throughout the Docker image:
make test
How to run the tests locally
Before running the tests locally, you need to set up a mock server to simulate a DICOM network service. This documentation details instructions for using dcmqrscp, included in the DCMTK tools, to verify the functionality of PACSIFIER without requiring a real DICOM server.
Start the mock server: Open a separate terminal and navigate to the
testsdirectory. Then run the following command:cd tests dcmqrscp -v -c ./config/dcmqrscp.cfg
Check connection: To ensure the connection to the mock server is successful, run the following command in another terminal:
echoscu -ll trace -aec SCU_STORE -aet PACSIFIER_CLIENT localhost 4444
If the connection does not work, try restarting the mock server and then checking the connection again.
Run the tests: Now that the mock server is running, you can run the tests locally. Go to the cloned repository folder and (re-)install
PACSIFIERand its dependencies (see How to install PACSIFIER locally).To run the tests, use the following command:
pytest ./tests
Tip
If you want to generate a coverage report, you can run the tests with the following command:
pytest --cov=pacsifier --cov-report html ./tests
Outputs of tests
In both cases, the tests are run in a temporary tmp directory in the tests directory, so that the original data are not modified. After completion, coverage report in HTML format can be found in the htmlcov folder and can be displayed by opening index.html in your favorite browser.