0
|
1 .. highlight:: bash
|
|
2 .. _rest-samples:
|
|
3
|
|
4 Finding samples for the REST API
|
|
5 ================================
|
|
6
|
|
7 * This "Orthanc Book" proposes a :ref:`number of samples showing how
|
|
8 to use the REST API <rest>` of Orthanc.
|
|
9 * Many working examples written in Python are `available in the source
|
|
10 distribution
|
|
11 <https://bitbucket.org/sjodogne/orthanc/src/default/Resources/Samples/Python/>`__.
|
|
12 * If you cannot find an example for some feature in this manual or in
|
|
13 the Python examples, please check the `publicly available
|
|
14 integration tests
|
|
15 <https://bitbucket.org/sjodogne/orthanc-tests/src/default/Tests/Tests.py>`__
|
|
16 that span most of the REST API.
|
|
17 * Samples for the deprecated APIs are available below.
|
|
18
|
|
19
|
|
20
|
|
21 Deprecated APIs
|
|
22 ---------------
|
|
23
|
|
24 You will find below code snippets for APIs that have been deprecated
|
|
25 over the releases of Orthanc. They are reproduced here for backward
|
|
26 compatibility and should not be used in new developments.
|
|
27
|
|
28
|
|
29 .. _deprecated-find-scu:
|
|
30
|
|
31 C-Find SCU (Deprecated)
|
|
32 ^^^^^^^^^^^^^^^^^^^^^^^
|
|
33
|
|
34 1. Retrieve the PatientID::
|
|
35
|
|
36 $ curl http://localhost:8042/modalities/pacs/find-patient -X POST -d '{"PatientName":"JOD*","PatientSex":"M"}'
|
|
37
|
|
38 2. Retrieve the studies of this patient (using the "PatientID" returned from Step 1)::
|
|
39
|
|
40 $ curl http://localhost:8042/modalities/pacs/find-study -X POST -d '{"PatientID":"0555643F"}'
|
|
41
|
|
42 3. Retrieve the series of one study (using the "PatientID" from Step 1, and the "StudyInstanceUID" from Step 2)::
|
|
43
|
|
44 $ curl http://localhost:8042/modalities/pacs/find-series -X POST -d '{"PatientID":"0555643F","StudyInstanceUID":"1.2.840.113704.1.111.276
|
|
45
|
|
46 You will have to define the modality "pacs" in the :ref:`configuration file
|
|
47 <configuration>` of Orthanc (under the section ``DicomModalities``).
|
|
48
|
|
49 *Note:* This API has been superseded by the ``/modalities/.../query``
|
|
50 URI. Please check the ``test_rest_query_retrieve`` `integration test
|
|
51 <https://bitbucket.org/sjodogne/orthanc-tests/src/default/Tests/Tests.py>`__.
|
|
52
|
|
53
|
|
54 Using Orthanc to Ease WADO Querying (Deprecated)
|
|
55 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
56
|
|
57 As of Orthanc 0.6.1, it will be possible to use Orthanc to easily
|
|
58 gather the three identifiers that are required to run a `WADO query
|
|
59 <ftp://medical.nema.org/medical/dicom/2006/06_18pu.pdf>`__ against a
|
|
60 remote modality (without storing the files inside Orthanc). These
|
|
61 identifiers are:
|
|
62
|
|
63 * StudyInstanceUID (0020,000d),
|
|
64 * SeriesInstanceUID (0020,000e),
|
|
65 * ObjectUID, that exactly corresponds to the SOPInstanceUID tag
|
|
66 (0008,0018) (cf. the `WADO specification
|
|
67 <ftp://medical.nema.org/medical/dicom/2006/06_18pu.pdf>`__, Section
|
|
68 8.1.4).
|
|
69
|
|
70 The trick consists in using the experimental C-Find SCU API, going down to the instance level::
|
|
71
|
|
72 $ curl http://localhost:8042/modalities/pacs/find-patient -X POST -d '{"PatientName":"JOD*","PatientSex":"M"}'
|
|
73 $ curl http://localhost:8042/modalities/pacs/find-study -X POST -d '{"PatientID":"0555643F"}'
|
|
74 $ curl http://localhost:8042/modalities/pacs/find-series -X POST -d '{"PatientID":"0555643F","StudyInstanceUID":"1.2.840.113704.1.111.2768.1239195678.57"}'
|
|
75 $ curl http://localhost:8042/modalities/pacs/find-instance -X POST -d '{"PatientID":"0555643F","StudyInstanceUID":"1.2.840.113704.1.111.2768.1239195678.57","SeriesInstanceUID":"1.3.46.670589.28.2.7.2200939417.2.13493.0.1239199523"}'
|
|
76
|
|
77 The first three steps are described in this :ref:`other FAQ entry
|
|
78 <deprecated-find-scu>`. The fourth step retrieves the list of the
|
|
79 instances of the series. The latter query was not possible until
|
|
80 Orthanc 0.6.1. As a result of this sequence of four commands, the
|
|
81 StudyInstanceUID, SeriesInstanceUID and SOPInstanceUID are readily
|
|
82 available for each instance of the series.
|
|
83
|
|
84 *Note:* This API has been superseded by the ``/modalities/.../query``
|
|
85 URI. Please check the ``test_rest_query_retrieve`` `integration test
|
|
86 <https://bitbucket.org/sjodogne/orthanc-tests/src/default/Tests/Tests.py>`__.
|