# HG changeset patch # User Sebastien Jodogne # Date 1596567215 -7200 # Node ID 03dfb896ca4b023cf977adad5eb11911e6fd1c34 # Parent a735476a0e6e2fb4e832ddbcc4f98ea9a8fa19ce# Parent 90e6c20cef1e4dae9345a0b848714a8ecdce5429 merge diff -r a735476a0e6e -r 03dfb896ca4b Sphinx/source/faq/transcoding.rst --- a/Sphinx/source/faq/transcoding.rst Tue Aug 04 20:53:18 2020 +0200 +++ b/Sphinx/source/faq/transcoding.rst Tue Aug 04 20:53:35 2020 +0200 @@ -88,7 +88,7 @@ UID of interest. For instance, setting ``IngestTranscoding`` to ``1.2.840.10008.1.2.1`` will decompress all the received DICOM instances. Conversely, setting it to ``1.2.840.10008.1.2.4.70`` will - compress and store images using JPEG-LS (lossless). + compress and store images using JPEG Lossless. * **Decompression while sending instances using the DICOM protocol**. Orthanc can be configured to automatically decompress DICOM images diff -r a735476a0e6e -r 03dfb896ca4b Sphinx/source/plugins.rst --- a/Sphinx/source/plugins.rst Tue Aug 04 20:53:18 2020 +0200 +++ b/Sphinx/source/plugins.rst Tue Aug 04 20:53:35 2020 +0200 @@ -70,34 +70,58 @@ Index of the contributed plugins -------------------------------- +C/C++ plugins +^^^^^^^^^^^^^ + * `AWS S3 storage plugin `__: This plugin by `Radpoint `__ makes Orthanc store its DICOM files into an `Amazon S3 bucket `__. + * `DWV Orthanc Plugin `__: This plugin by Yves Martelli is based on `dwv `__ and extends Orthanc with a Web viewer of DICOM images. + * Another Web viewer is provided courtesy of `Emsy Chan `__. + * `VPI Reveal `__ provides a plugin to "write the DICOM records in a normal Windows-readable file hierarchy (patient-study-series-DICOM file) at a location called ``VPIStorage`` that can then be imported into VPI Reveal." `Check out their source code `__. + * `Doc Cirrus `__ is working on `MongoDB `__ database plugins. Check out their `source code `__ and the `associated description `__. + +Python plugins +^^^^^^^^^^^^^^ + +* Julian Hartig maintains a `Python plugin + `__ called + ``orthanc-gdt``, in order to glue Orthanc to the `GDT interface most + German AIS `__ + (Arztinformationssysteme - as opposed to e.g. the RIS used by + radiologists) use for communicating with external applications and + devices. This topic is further discussed on the `Orthanc Users forum + `__. + + +Other +^^^^^ + * Check out the `OrthancContributed repository on GitHub `__, that might contain plugins that are not tracked in this list. -*Remark:* Do not hesitate to `contact us -`__ if you have -developed a plugin so that we can promote it in the list above! +* **Important:** Do not hesitate to `contact us + `__ if you + have developed a plugin so that we can promote it in the list above! diff -r a735476a0e6e -r 03dfb896ca4b Sphinx/source/plugins/python.rst --- a/Sphinx/source/plugins/python.rst Tue Aug 04 20:53:18 2020 +0200 +++ b/Sphinx/source/plugins/python.rst Tue Aug 04 20:53:35 2020 +0200 @@ -240,6 +240,8 @@ $ curl http://localhost:8042/toto ok + +.. _python-changes: Listening to changes .................... @@ -556,7 +558,7 @@ about `attribute matching `__. -.. highlight:: python +.. highlight:: bash Here is a sample call to retrieve all the studies that were last updated in 2019 thanks to this Python script:: @@ -564,6 +566,82 @@ $ curl http://localhost:8042/tools/find -d '{"Level":"Study","Query":{},"Expand":true,"Metadata":{"LastUpdate":"^2019.*$"}}' +.. _python-paging: + +Implementing basic paging +......................... + +.. highlight:: python + +As explained in the FAQ, the :ref:`Orthanc Explorer interface is +low-level `, and is not adapted for +end-users. One common need is to implement paging of studies, which +calls for server-side sorting of studies. This can be done using the +following sample Python plugin that registers a new route +``/sort-studies`` in the REST API of Orthanc:: + + import json + import orthanc + + def GetStudyDate(study): + if 'StudyDate' in study['MainDicomTags']: + return study['MainDicomTags']['StudyDate'] + else: + return '' + + def SortStudiesByDate(output, uri, **request): + if request['method'] == 'GET': + # Retrieve all the studies + studies = json.loads(orthanc.RestApiGet('/studies?expand')) + + # Sort the studies according to the "StudyDate" DICOM tag + studies = sorted(studies, key = GetStudyDate) + + # Read the limit/offset arguments provided by the user + offset = 0 + if 'offset' in request['get']: + offset = int(request['get']['offset']) + + limit = 0 + if 'limit' in request['get']: + limit = int(request['get']['limit']) + + # Truncate the list of studies + if limit == 0: + studies = studies[offset : ] + else: + studies = studies[offset : offset + limit] + + # Return the truncated list of studies + output.AnswerBuffer(json.dumps(studies), 'application/json') + else: + output.SendMethodNotAllowed('GET') + + orthanc.RegisterRestCallback('/sort-studies', SortStudiesByDate) + + +.. highlight:: bash + +Here is a sample call to this new REST route, that could be issued by +any JavaScript framework (the ``json_pp`` command-line pretty-prints a +JSON file):: + + $ curl http://localhost:8042/sort-studies | json_pp + +This route also implement paging (i.e. it can limit and offset the +returned studies):: + + $ curl 'http://localhost:8042/sort-studies?offset=2&limit=2' | json_pp + +Obviously, this basic sample can be improved in many ways. To improve +performance, one could for instance cache the result of +``/studies?expand`` in memory by :ref:`listening to changes +` in the list of studies +(cf. ``orthanc.ChangeType.NEW_STUDY`` and +``orthanc.ChangeType.DELETED``). + + + Performance and concurrency ---------------------------