Mercurial > hg > orthanc-book
annotate Sphinx/source/faq/rest-samples.rst @ 410:84d1bd38dd51
ovewrite
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 05 May 2020 07:02:11 +0200 |
parents | 84e3a2612c36 |
children | 2922fb1bd65e |
rev | line source |
---|---|
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. | |
224
02399e86f046
starting documentation of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
9 * More advanced features of the REST API can be found :ref:`in this |
02399e86f046
starting documentation of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
10 dedicated section <rest-advanced>`. |
0 | 11 * Many working examples written in Python are `available in the source |
12 distribution | |
360 | 13 <https://hg.orthanc-server.com/orthanc/file/default/Resources/Samples/Python/>`__. |
0 | 14 * If you cannot find an example for some feature in this manual or in |
15 the Python examples, please check the `publicly available | |
16 integration tests | |
361 | 17 <https://hg.orthanc-server.com/orthanc-tests/file/tip/Tests/Tests.py>`__ |
0 | 18 that span most of the REST API. |
19 * Samples for the deprecated APIs are available below. | |
20 | |
21 | |
22 | |
23 Deprecated APIs | |
24 --------------- | |
25 | |
26 You will find below code snippets for APIs that have been deprecated | |
27 over the releases of Orthanc. They are reproduced here for backward | |
28 compatibility and should not be used in new developments. | |
29 | |
30 | |
31 .. _deprecated-find-scu: | |
32 | |
33 C-Find SCU (Deprecated) | |
34 ^^^^^^^^^^^^^^^^^^^^^^^ | |
35 | |
36 1. Retrieve the PatientID:: | |
37 | |
38 $ curl http://localhost:8042/modalities/pacs/find-patient -X POST -d '{"PatientName":"JOD*","PatientSex":"M"}' | |
39 | |
40 2. Retrieve the studies of this patient (using the "PatientID" returned from Step 1):: | |
41 | |
42 $ curl http://localhost:8042/modalities/pacs/find-study -X POST -d '{"PatientID":"0555643F"}' | |
43 | |
44 3. Retrieve the series of one study (using the "PatientID" from Step 1, and the "StudyInstanceUID" from Step 2):: | |
45 | |
46 $ curl http://localhost:8042/modalities/pacs/find-series -X POST -d '{"PatientID":"0555643F","StudyInstanceUID":"1.2.840.113704.1.111.276 | |
47 | |
48 You will have to define the modality "pacs" in the :ref:`configuration file | |
49 <configuration>` of Orthanc (under the section ``DicomModalities``). | |
50 | |
51 *Note:* This API has been superseded by the ``/modalities/.../query`` | |
52 URI. Please check the ``test_rest_query_retrieve`` `integration test | |
361 | 53 <https://hg.orthanc-server.com/orthanc-tests/file/tip/Tests/Tests.py>`__. |
0 | 54 |
55 | |
56 Using Orthanc to Ease WADO Querying (Deprecated) | |
57 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
58 | |
59 As of Orthanc 0.6.1, it will be possible to use Orthanc to easily | |
60 gather the three identifiers that are required to run a `WADO query | |
61 <ftp://medical.nema.org/medical/dicom/2006/06_18pu.pdf>`__ against a | |
62 remote modality (without storing the files inside Orthanc). These | |
63 identifiers are: | |
64 | |
65 * StudyInstanceUID (0020,000d), | |
66 * SeriesInstanceUID (0020,000e), | |
67 * ObjectUID, that exactly corresponds to the SOPInstanceUID tag | |
68 (0008,0018) (cf. the `WADO specification | |
69 <ftp://medical.nema.org/medical/dicom/2006/06_18pu.pdf>`__, Section | |
70 8.1.4). | |
71 | |
72 The trick consists in using the experimental C-Find SCU API, going down to the instance level:: | |
73 | |
74 $ curl http://localhost:8042/modalities/pacs/find-patient -X POST -d '{"PatientName":"JOD*","PatientSex":"M"}' | |
75 $ curl http://localhost:8042/modalities/pacs/find-study -X POST -d '{"PatientID":"0555643F"}' | |
76 $ curl http://localhost:8042/modalities/pacs/find-series -X POST -d '{"PatientID":"0555643F","StudyInstanceUID":"1.2.840.113704.1.111.2768.1239195678.57"}' | |
77 $ 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"}' | |
78 | |
79 The first three steps are described in this :ref:`other FAQ entry | |
80 <deprecated-find-scu>`. The fourth step retrieves the list of the | |
81 instances of the series. The latter query was not possible until | |
82 Orthanc 0.6.1. As a result of this sequence of four commands, the | |
83 StudyInstanceUID, SeriesInstanceUID and SOPInstanceUID are readily | |
84 available for each instance of the series. | |
85 | |
86 *Note:* This API has been superseded by the ``/modalities/.../query`` | |
87 URI. Please check the ``test_rest_query_retrieve`` `integration test | |
361 | 88 <https://hg.orthanc-server.com/orthanc-tests/file/tip/Tests/Tests.py>`__. |