Docs /Command-Line Client
Command-Line Client: Overview and Installation
The command-line client (climed-client) lets you work with LeaRes from a terminal instead of the web app. It covers loading patients and their CT series, segmenting them (cardiac, lungs, whole body) and downloading the anatomies as STL files, running a virtual spirometry and saving its values, curves and PDF report, and creating projects from STL or VTP files: one at a time, or dozens in a single command. It is meant for the jobs that are slow to do by hand in the browser, such as loading the CT scans of 20 different patients, or loading data from a script.
It runs on your own computer and talks to your LeaRes instance over a secure connection. You do not need access to any server, and it needs no other software of ours.
When to use it
| You want to… | Use |
|---|---|
| Load one patient, with a few series, and look at it right away | The web app (see Uploading and Viewing DICOM Data) |
| Load one patient from a terminal | import-dicom |
| Load many patients at once, from a folder of folders | import-dicom-batch --root |
| Load many patients from a list you prepared | import-dicom-batch --manifest |
| Create an engineering project from an STL or VTP file, or many at once | create-project, create-project-batch |
| Add a further geometry to a project | add-geometry |
| Segment a patient’s CT (cardiac, lungs, whole body) | segment |
| Save anatomies, one or a whole group, as STL files | download-stl |
| Run a virtual spirometry and save FEV1, FVC, PEF, the curves and the PDF report | virtual-spirometry, download-spirometry |
| Run the load unattended (scheduled, or inside a script) | Scripting and Automation |
| Work on your organisation’s own server instead of the cloud | Signing In |
What you need
- A LeaRes account that is registered and active (the download is refused to disabled accounts).
- Python 3.10 or newer on your computer, and a terminal (Windows, macOS or Linux).
- Your DICOM images, one folder (or ZIP archive) per patient.
Install
-
In the same browser where you are signed in to LeaRes, open:
https://leares.net/api/downloads/climed-client/latestA file named like
climed_client-X.Y.Z-py3-none-any.whlis downloaded. If you are not signed in, or your account is disabled, you get an error instead of the file. -
In a terminal, in the folder where the file was saved. A virtual environment keeps your system clean; it is recommended but not required:
python3 -m venv climed-env source climed-env/bin/activate # Windows: climed-env\Scripts\activate pip install ./climed_client-X.Y.Z-py3-none-any.whl # the exact name of the file you downloadedFor the PDF report of virtual spirometry, install it with the PDF extra instead:
pip install "./climed_client-X.Y.Z-py3-none-any.whl[pdf]". Everything else works without it. -
Check that it works:
climed-client --version climed-client --help--helplists the commands; adding--helpafter a command (for exampleclimed-client import-dicom-batch --help) lists its options.
If you closed the terminal, activate the environment again (source climed-env/bin/activate) before using climed-client.
Commands at a glance
| Command | What it does |
|---|---|
login | Sign in and remember your instance (Signing In) |
status | Show who you are signed in as, and for how long |
logout | Forget the saved sign-in on this computer |
databases | List the databases you can write to |
import-dicom | Create one patient and upload one series |
import-dicom-batch | Create many patients, one series each |
create-project | Create one project from an STL or VTP file |
create-project-batch | Create many projects, one file each |
add-geometry | Add a further geometry to a project |
patients | List your patients and their CT series |
segment | Segment anatomy groups (cardiac, lungs, whole body) on the server |
anatomies | List the anatomies of a series |
download-stl | Save anatomies, single or by group, as STL files |
virtual-spirometry | Run a virtual spirometry |
download-spirometry | Save values, curves and the PDF report of virtual spirometry runs |
Update and remove
- Update: download the new file the same way and run
pip install --upgrade ./climed_client-X.Y.Z-py3-none-any.whl. - Remove:
climed-client logout, thenpip uninstall climed-client.
Data handling. DICOM files are uploaded as they are, patient identifiers included. The same rules as any other upload apply: see Intended Use and Safety. The STL files, values and reports you download are patient data too (the report carries the patient name): keep them as your institution requires for any export.