.. _source-orthanc:
Orthanc
=======
If your scanner pushes to an `Orthanc `_ instance
rather than exporting to a directory, ``collate orthanc`` takes the place of
``collate folder``. It queries Orthanc's REST API for studies and collates them into the
same layout that ``label`` reads (see :ref:`concepts-staging`), hardlinking the DICOM
files straight out of Orthanc's storage rather than copying them.
.. code-block:: console
$ accessionflow collate orthanc http://localhost:8042 /var/lib/orthanc/db \
/data/staging/collated orthanc-user orthanc-password
* ``URL`` — the Orthanc REST endpoint (``ACFLOW_ORTHANC_URL``)
* ``STORE_DIR`` — Orthanc's ``StorageDirectory``, as seen from wherever the command
runs (``ACFLOW_ORTHANC_STORE_DIR``)
* ``OUTPUT_DIR`` — where the collated accessions are written
* ``USER``/``PASSWORD`` — Orthanc credentials
(``ACFLOW_ORTHANC_USER``/``ACFLOW_ORTHANC_PASSWORD``)
Because the files are hardlinked, ``STORE_DIR`` and ``OUTPUT_DIR`` must be on the same
file system, and Orthanc's storage must be uncompressed. Compression is off by default,
so this only matters if you've enabled ``StorageCompression`` in the Orthanc
configuration. For the same reason, ``--copy-mode`` only supports its default.
Accessions are collated by ``StudyInstanceUID``, acquisitions by ``SeriesNumber``
(described by ``SeriesDescription``) and resources by ``ImageType``, following Orthanc's
own study/series/instance hierarchy. These groupings are fixed: there are no
``--accession``/``--acquisition``/``--resource`` options like ``collate folder``'s. What
*metadata* is available to the ``label`` stage can be extended through the Orthanc
configuration however (see :ref:`source-orthanc-metadata`).
``--convert `` converts matching series as they are collated,
e.g. ``--convert medimage/dicom-series medimage/nifti-gz-x``. The source is always
``medimage/dicom-series``. Conversion happens before the processed label is applied, so
a study whose conversion fails is tried again on the next run.
.. _source-orthanc-labels:
Controlling which studies are collated
--------------------------------------
Which studies are collated, and collated only once, is controlled through Orthanc
*labels* rather than by moving or deleting anything:
* ``--to-process-label