comparison Sources/Autogenerated/orthanc.pyi @ 188:87e546600cbe java-code-model

added Sources/Autogenerated/orthanc.pyi
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 02 Jul 2024 17:03:08 +0200
parents
children 30ed49f2487f
comparison
equal deleted inserted replaced
187:d08d75fc6d6a 188:87e546600cbe
1 ##
2 ## Python plugin for Orthanc
3 ## Copyright (C) 2020-2023 Osimis S.A., Belgium
4 ## Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5 ## Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
6 ##
7 ## This program is free software: you can redistribute it and/or
8 ## modify it under the terms of the GNU Affero General Public License
9 ## as published by the Free Software Foundation, either version 3 of
10 ## the License, or (at your option) any later version.
11 ##
12 ## This program is distributed in the hope that it will be useful, but
13 ## WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ## Affero General Public License for more details.
16 ##
17 ## You should have received a copy of the GNU Affero General Public License
18 ## along with this program. If not, see <http://www.gnu.org/licenses/>.
19 ##
20
21
22 # WARNING: Auto-generated file. Do not modify it by hand.
23
24
25 import enum
26
27
28 class ChangeType(enum.Enum):
29 """
30 The supported types of changes that can be signaled to the change callback.
31 """
32
33 """
34 Series is now complete
35 """
36 COMPLETED_SERIES: int = 0,
37
38 """
39 Deleted resource
40 """
41 DELETED: int = 1,
42
43 """
44 A new instance was added to this resource
45 """
46 NEW_CHILD_INSTANCE: int = 2,
47
48 """
49 New instance received
50 """
51 NEW_INSTANCE: int = 3,
52
53 """
54 New patient created
55 """
56 NEW_PATIENT: int = 4,
57
58 """
59 New series created
60 """
61 NEW_SERIES: int = 5,
62
63 """
64 New study created
65 """
66 NEW_STUDY: int = 6,
67
68 """
69 Timeout: No new instance in this patient
70 """
71 STABLE_PATIENT: int = 7,
72
73 """
74 Timeout: No new instance in this series
75 """
76 STABLE_SERIES: int = 8,
77
78 """
79 Timeout: No new instance in this study
80 """
81 STABLE_STUDY: int = 9,
82
83 """
84 Orthanc has started
85 """
86 ORTHANC_STARTED: int = 10,
87
88 """
89 Orthanc is stopping
90 """
91 ORTHANC_STOPPED: int = 11,
92
93 """
94 Some user-defined attachment has changed for this resource
95 """
96 UPDATED_ATTACHMENT: int = 12,
97
98 """
99 Some user-defined metadata has changed for this resource
100 """
101 UPDATED_METADATA: int = 13,
102
103 """
104 The list of Orthanc peers has changed
105 """
106 UPDATED_PEERS: int = 14,
107
108 """
109 The list of DICOM modalities has changed
110 """
111 UPDATED_MODALITIES: int = 15,
112
113 """
114 New Job submitted
115 """
116 JOB_SUBMITTED: int = 16,
117
118 """
119 A Job has completed successfully
120 """
121 JOB_SUCCESS: int = 17,
122
123 """
124 A Job has failed
125 """
126 JOB_FAILURE: int = 18,
127
128 class CompressionType(enum.Enum):
129 """
130 The compression algorithms that are supported by the Orthanc core.
131 """
132
133 """
134 Standard zlib compression
135 """
136 ZLIB: int = 0,
137
138 """
139 zlib, prefixed with uncompressed size (uint64_t)
140 """
141 ZLIB_WITH_SIZE: int = 1,
142
143 """
144 Standard gzip compression
145 """
146 GZIP: int = 2,
147
148 """
149 gzip, prefixed with uncompressed size (uint64_t)
150 """
151 GZIP_WITH_SIZE: int = 3,
152
153 class ConstraintType(enum.Enum):
154 """
155 The constraints on the tags (main DICOM tags and identifier tags) that must be supported by the database plugins.
156 """
157
158 """
159 Equal
160 """
161 EQUAL: int = 1,
162
163 """
164 Less or equal
165 """
166 SMALLER_OR_EQUAL: int = 2,
167
168 """
169 More or equal
170 """
171 GREATER_OR_EQUAL: int = 3,
172
173 """
174 Wildcard matching
175 """
176 WILDCARD: int = 4,
177
178 """
179 List of values
180 """
181 LIST: int = 5,
182
183 class ContentType(enum.Enum):
184 """
185 The content types that are supported by Orthanc plugins.
186 """
187
188 """
189 Unknown content type
190 """
191 UNKNOWN: int = 0,
192
193 """
194 DICOM
195 """
196 DICOM: int = 1,
197
198 """
199 JSON summary of a DICOM file
200 """
201 DICOM_AS_JSON: int = 2,
202
203 """
204 DICOM Header till pixel data
205 """
206 DICOM_UNTIL_PIXEL_DATA: int = 3,
207
208 class CreateDicomFlags(enum.Enum):
209 """
210 Flags to the creation of a DICOM file.
211 """
212
213 """
214 Default mode
215 """
216 NONE: int = 0,
217
218 """
219 Decode fields encoded using data URI scheme
220 """
221 DECODE_DATA_URI_SCHEME: int = 1,
222
223 """
224 Automatically generate DICOM identifiers
225 """
226 GENERATE_IDENTIFIERS: int = 2,
227
228 class DicomToJsonFlags(enum.Enum):
229 """
230 Flags to customize a DICOM-to-JSON conversion. By default, binary tags are formatted using Data URI scheme.
231 """
232
233 """
234 Default formatting
235 """
236 NONE: int = 0,
237
238 """
239 Include the binary tags
240 """
241 INCLUDE_BINARY: int = 1,
242
243 """
244 Include the private tags
245 """
246 INCLUDE_PRIVATE_TAGS: int = 2,
247
248 """
249 Include the tags unknown by the dictionary
250 """
251 INCLUDE_UNKNOWN_TAGS: int = 4,
252
253 """
254 Include the pixel data
255 """
256 INCLUDE_PIXEL_DATA: int = 8,
257
258 """
259 Output binary tags as-is, dropping non-ASCII
260 """
261 CONVERT_BINARY_TO_ASCII: int = 16,
262
263 """
264 Signal binary tags as null values
265 """
266 CONVERT_BINARY_TO_NULL: int = 32,
267
268 """
269 Stop processing after pixel data (new in 1.9.1)
270 """
271 STOP_AFTER_PIXEL_DATA: int = 64,
272
273 """
274 Skip tags whose element is zero (new in 1.9.1)
275 """
276 SKIP_GROUP_LENGTHS: int = 128,
277
278 class DicomToJsonFormat(enum.Enum):
279 """
280 The possible output formats for a DICOM-to-JSON conversion.
281 """
282
283 """
284 Full output, with most details
285 """
286 FULL: int = 1,
287
288 """
289 Tags output as hexadecimal numbers
290 """
291 SHORT: int = 2,
292
293 """
294 Human-readable JSON
295 """
296 HUMAN: int = 3,
297
298 class DicomWebBinaryMode(enum.Enum):
299 """
300 The available modes to export a binary DICOM tag into a DICOMweb JSON or XML document.
301 """
302
303 """
304 Don't include binary tags
305 """
306 IGNORE: int = 0,
307
308 """
309 Inline encoding using Base64
310 """
311 INLINE_BINARY: int = 1,
312
313 """
314 Use a bulk data URI field
315 """
316 BULK_DATA_URI: int = 2,
317
318 class ErrorCode(enum.Enum):
319 """
320 The various error codes that can be returned by the Orthanc core.
321 """
322
323 """
324 Internal error
325 """
326 INTERNAL_ERROR: int = -1,
327
328 """
329 Success
330 """
331 SUCCESS: int = 0,
332
333 """
334 Error encountered within the plugin engine
335 """
336 PLUGIN: int = 1,
337
338 """
339 Not implemented yet
340 """
341 NOT_IMPLEMENTED: int = 2,
342
343 """
344 Parameter out of range
345 """
346 PARAMETER_OUT_OF_RANGE: int = 3,
347
348 """
349 The server hosting Orthanc is running out of memory
350 """
351 NOT_ENOUGH_MEMORY: int = 4,
352
353 """
354 Bad type for a parameter
355 """
356 BAD_PARAMETER_TYPE: int = 5,
357
358 """
359 Bad sequence of calls
360 """
361 BAD_SEQUENCE_OF_CALLS: int = 6,
362
363 """
364 Accessing an inexistent item
365 """
366 INEXISTENT_ITEM: int = 7,
367
368 """
369 Bad request
370 """
371 BAD_REQUEST: int = 8,
372
373 """
374 Error in the network protocol
375 """
376 NETWORK_PROTOCOL: int = 9,
377
378 """
379 Error while calling a system command
380 """
381 SYSTEM_COMMAND: int = 10,
382
383 """
384 Error with the database engine
385 """
386 DATABASE: int = 11,
387
388 """
389 Badly formatted URI
390 """
391 URI_SYNTAX: int = 12,
392
393 """
394 Inexistent file
395 """
396 INEXISTENT_FILE: int = 13,
397
398 """
399 Cannot write to file
400 """
401 CANNOT_WRITE_FILE: int = 14,
402
403 """
404 Bad file format
405 """
406 BAD_FILE_FORMAT: int = 15,
407
408 """
409 Timeout
410 """
411 TIMEOUT: int = 16,
412
413 """
414 Unknown resource
415 """
416 UNKNOWN_RESOURCE: int = 17,
417
418 """
419 Incompatible version of the database
420 """
421 INCOMPATIBLE_DATABASE_VERSION: int = 18,
422
423 """
424 The file storage is full
425 """
426 FULL_STORAGE: int = 19,
427
428 """
429 Corrupted file (e.g. inconsistent MD5 hash)
430 """
431 CORRUPTED_FILE: int = 20,
432
433 """
434 Inexistent tag
435 """
436 INEXISTENT_TAG: int = 21,
437
438 """
439 Cannot modify a read-only data structure
440 """
441 READ_ONLY: int = 22,
442
443 """
444 Incompatible format of the images
445 """
446 INCOMPATIBLE_IMAGE_FORMAT: int = 23,
447
448 """
449 Incompatible size of the images
450 """
451 INCOMPATIBLE_IMAGE_SIZE: int = 24,
452
453 """
454 Error while using a shared library (plugin)
455 """
456 SHARED_LIBRARY: int = 25,
457
458 """
459 Plugin invoking an unknown service
460 """
461 UNKNOWN_PLUGIN_SERVICE: int = 26,
462
463 """
464 Unknown DICOM tag
465 """
466 UNKNOWN_DICOM_TAG: int = 27,
467
468 """
469 Cannot parse a JSON document
470 """
471 BAD_JSON: int = 28,
472
473 """
474 Bad credentials were provided to an HTTP request
475 """
476 UNAUTHORIZED: int = 29,
477
478 """
479 Badly formatted font file
480 """
481 BAD_FONT: int = 30,
482
483 """
484 The plugin implementing a custom database back-end does not fulfill the proper interface
485 """
486 DATABASE_PLUGIN: int = 31,
487
488 """
489 Error in the plugin implementing a custom storage area
490 """
491 STORAGE_AREA_PLUGIN: int = 32,
492
493 """
494 The request is empty
495 """
496 EMPTY_REQUEST: int = 33,
497
498 """
499 Cannot send a response which is acceptable according to the Accept HTTP header
500 """
501 NOT_ACCEPTABLE: int = 34,
502
503 """
504 Cannot handle a NULL pointer
505 """
506 NULL_POINTER: int = 35,
507
508 """
509 The database is currently not available (probably a transient situation)
510 """
511 DATABASE_UNAVAILABLE: int = 36,
512
513 """
514 This job was canceled
515 """
516 CANCELED_JOB: int = 37,
517
518 """
519 Geometry error encountered in Stone
520 """
521 BAD_GEOMETRY: int = 38,
522
523 """
524 Cannot initialize SSL encryption, check out your certificates
525 """
526 SSL_INITIALIZATION: int = 39,
527
528 """
529 Calling a function that has been removed from the Orthanc Framework
530 """
531 DISCONTINUED_ABI: int = 40,
532
533 """
534 Incorrect range request
535 """
536 BAD_RANGE: int = 41,
537
538 """
539 Database could not serialize access due to concurrent update, the transaction should be retried
540 """
541 DATABASE_CANNOT_SERIALIZE: int = 42,
542
543 """
544 A bad revision number was provided, which might indicate conflict between multiple writers
545 """
546 REVISION: int = 43,
547
548 """
549 SQLite: The database is not opened
550 """
551 SQLITE_NOT_OPENED: int = 1000,
552
553 """
554 SQLite: Connection is already open
555 """
556 SQLITE_ALREADY_OPENED: int = 1001,
557
558 """
559 SQLite: Unable to open the database
560 """
561 SQLITE_CANNOT_OPEN: int = 1002,
562
563 """
564 SQLite: This cached statement is already being referred to
565 """
566 SQLITE_STATEMENT_ALREADY_USED: int = 1003,
567
568 """
569 SQLite: Cannot execute a command
570 """
571 SQLITE_EXECUTE: int = 1004,
572
573 """
574 SQLite: Rolling back a nonexistent transaction (have you called Begin()?)
575 """
576 SQLITE_ROLLBACK_WITHOUT_TRANSACTION: int = 1005,
577
578 """
579 SQLite: Committing a nonexistent transaction
580 """
581 SQLITE_COMMIT_WITHOUT_TRANSACTION: int = 1006,
582
583 """
584 SQLite: Unable to register a function
585 """
586 SQLITE_REGISTER_FUNCTION: int = 1007,
587
588 """
589 SQLite: Unable to flush the database
590 """
591 SQLITE_FLUSH: int = 1008,
592
593 """
594 SQLite: Cannot run a cached statement
595 """
596 SQLITE_CANNOT_RUN: int = 1009,
597
598 """
599 SQLite: Cannot step over a cached statement
600 """
601 SQLITE_CANNOT_STEP: int = 1010,
602
603 """
604 SQLite: Bing a value while out of range (serious error)
605 """
606 SQLITE_BIND_OUT_OF_RANGE: int = 1011,
607
608 """
609 SQLite: Cannot prepare a cached statement
610 """
611 SQLITE_PREPARE_STATEMENT: int = 1012,
612
613 """
614 SQLite: Beginning the same transaction twice
615 """
616 SQLITE_TRANSACTION_ALREADY_STARTED: int = 1013,
617
618 """
619 SQLite: Failure when committing the transaction
620 """
621 SQLITE_TRANSACTION_COMMIT: int = 1014,
622
623 """
624 SQLite: Cannot start a transaction
625 """
626 SQLITE_TRANSACTION_BEGIN: int = 1015,
627
628 """
629 The directory to be created is already occupied by a regular file
630 """
631 DIRECTORY_OVER_FILE: int = 2000,
632
633 """
634 Unable to create a subdirectory or a file in the file storage
635 """
636 FILE_STORAGE_CANNOT_WRITE: int = 2001,
637
638 """
639 The specified path does not point to a directory
640 """
641 DIRECTORY_EXPECTED: int = 2002,
642
643 """
644 The TCP port of the HTTP server is privileged or already in use
645 """
646 HTTP_PORT_IN_USE: int = 2003,
647
648 """
649 The TCP port of the DICOM server is privileged or already in use
650 """
651 DICOM_PORT_IN_USE: int = 2004,
652
653 """
654 This HTTP status is not allowed in a REST API
655 """
656 BAD_HTTP_STATUS_IN_REST: int = 2005,
657
658 """
659 The specified path does not point to a regular file
660 """
661 REGULAR_FILE_EXPECTED: int = 2006,
662
663 """
664 Unable to get the path to the executable
665 """
666 PATH_TO_EXECUTABLE: int = 2007,
667
668 """
669 Cannot create a directory
670 """
671 MAKE_DIRECTORY: int = 2008,
672
673 """
674 An application entity title (AET) cannot be empty or be longer than 16 characters
675 """
676 BAD_APPLICATION_ENTITY_TITLE: int = 2009,
677
678 """
679 No request handler factory for DICOM C-FIND SCP
680 """
681 NO_CFIND_HANDLER: int = 2010,
682
683 """
684 No request handler factory for DICOM C-MOVE SCP
685 """
686 NO_CMOVE_HANDLER: int = 2011,
687
688 """
689 No request handler factory for DICOM C-STORE SCP
690 """
691 NO_CSTORE_HANDLER: int = 2012,
692
693 """
694 No application entity filter
695 """
696 NO_APPLICATION_ENTITY_FILTER: int = 2013,
697
698 """
699 DicomUserConnection: Unable to find the SOP class and instance
700 """
701 NO_SOP_CLASS_OR_INSTANCE: int = 2014,
702
703 """
704 DicomUserConnection: No acceptable presentation context for modality
705 """
706 NO_PRESENTATION_CONTEXT: int = 2015,
707
708 """
709 DicomUserConnection: The C-FIND command is not supported by the remote SCP
710 """
711 DICOM_FIND_UNAVAILABLE: int = 2016,
712
713 """
714 DicomUserConnection: The C-MOVE command is not supported by the remote SCP
715 """
716 DICOM_MOVE_UNAVAILABLE: int = 2017,
717
718 """
719 Cannot store an instance
720 """
721 CANNOT_STORE_INSTANCE: int = 2018,
722
723 """
724 Only string values are supported when creating DICOM instances
725 """
726 CREATE_DICOM_NOT_STRING: int = 2019,
727
728 """
729 Trying to override a value inherited from a parent module
730 """
731 CREATE_DICOM_OVERRIDE_TAG: int = 2020,
732
733 """
734 Use \"Content\" to inject an image into a new DICOM instance
735 """
736 CREATE_DICOM_USE_CONTENT: int = 2021,
737
738 """
739 No payload is present for one instance in the series
740 """
741 CREATE_DICOM_NO_PAYLOAD: int = 2022,
742
743 """
744 The payload of the DICOM instance must be specified according to Data URI scheme
745 """
746 CREATE_DICOM_USE_DATA_URI_SCHEME: int = 2023,
747
748 """
749 Trying to attach a new DICOM instance to an inexistent resource
750 """
751 CREATE_DICOM_BAD_PARENT: int = 2024,
752
753 """
754 Trying to attach a new DICOM instance to an instance (must be a series, study or patient)
755 """
756 CREATE_DICOM_PARENT_IS_INSTANCE: int = 2025,
757
758 """
759 Unable to get the encoding of the parent resource
760 """
761 CREATE_DICOM_PARENT_ENCODING: int = 2026,
762
763 """
764 Unknown modality
765 """
766 UNKNOWN_MODALITY: int = 2027,
767
768 """
769 Bad ordering of filters in a job
770 """
771 BAD_JOB_ORDERING: int = 2028,
772
773 """
774 Cannot convert the given JSON object to a Lua table
775 """
776 JSON_TO_LUA_TABLE: int = 2029,
777
778 """
779 Cannot create the Lua context
780 """
781 CANNOT_CREATE_LUA: int = 2030,
782
783 """
784 Cannot execute a Lua command
785 """
786 CANNOT_EXECUTE_LUA: int = 2031,
787
788 """
789 Arguments cannot be pushed after the Lua function is executed
790 """
791 LUA_ALREADY_EXECUTED: int = 2032,
792
793 """
794 The Lua function does not give the expected number of outputs
795 """
796 LUA_BAD_OUTPUT: int = 2033,
797
798 """
799 The Lua function is not a predicate (only true/false outputs allowed)
800 """
801 NOT_LUA_PREDICATE: int = 2034,
802
803 """
804 The Lua function does not return a string
805 """
806 LUA_RETURNS_NO_STRING: int = 2035,
807
808 """
809 Another plugin has already registered a custom storage area
810 """
811 STORAGE_AREA_ALREADY_REGISTERED: int = 2036,
812
813 """
814 Another plugin has already registered a custom database back-end
815 """
816 DATABASE_BACKEND_ALREADY_REGISTERED: int = 2037,
817
818 """
819 Plugin trying to call the database during its initialization
820 """
821 DATABASE_NOT_INITIALIZED: int = 2038,
822
823 """
824 Orthanc has been built without SSL support
825 """
826 SSL_DISABLED: int = 2039,
827
828 """
829 Unable to order the slices of the series
830 """
831 CANNOT_ORDER_SLICES: int = 2040,
832
833 """
834 No request handler factory for DICOM C-Find Modality SCP
835 """
836 NO_WORKLIST_HANDLER: int = 2041,
837
838 """
839 Cannot override the value of a tag that already exists
840 """
841 ALREADY_EXISTING_TAG: int = 2042,
842
843 """
844 No request handler factory for DICOM N-ACTION SCP (storage commitment)
845 """
846 NO_STORAGE_COMMITMENT_HANDLER: int = 2043,
847
848 """
849 No request handler factory for DICOM C-GET SCP
850 """
851 NO_CGET_HANDLER: int = 2044,
852
853 """
854 Unsupported media type
855 """
856 UNSUPPORTED_MEDIA_TYPE: int = 3000,
857
858 class HttpMethod(enum.Enum):
859 """
860 The various HTTP methods for a REST call.
861 """
862
863 """
864 GET request
865 """
866 GET: int = 1,
867
868 """
869 POST request
870 """
871 POST: int = 2,
872
873 """
874 PUT request
875 """
876 PUT: int = 3,
877
878 """
879 DELETE request
880 """
881 DELETE: int = 4,
882
883 class IdentifierConstraint(enum.Enum):
884 """
885 The constraints on the DICOM identifiers that must be supported by the database plugins.
886 """
887
888 """
889 Equal
890 """
891 EQUAL: int = 1,
892
893 """
894 Less or equal
895 """
896 SMALLER_OR_EQUAL: int = 2,
897
898 """
899 More or equal
900 """
901 GREATER_OR_EQUAL: int = 3,
902
903 """
904 Case-sensitive wildcard matching (with * and ?)
905 """
906 WILDCARD: int = 4,
907
908 class ImageFormat(enum.Enum):
909 """
910 The image formats that are supported by the Orthanc core.
911 """
912
913 """
914 Image compressed using PNG
915 """
916 PNG: int = 0,
917
918 """
919 Image compressed using JPEG
920 """
921 JPEG: int = 1,
922
923 """
924 Image compressed using DICOM
925 """
926 DICOM: int = 2,
927
928 class InstanceOrigin(enum.Enum):
929 """
930 The origin of a DICOM instance that has been received by Orthanc.
931 """
932
933 """
934 Unknown origin
935 """
936 UNKNOWN: int = 1,
937
938 """
939 Instance received through DICOM protocol
940 """
941 DICOM_PROTOCOL: int = 2,
942
943 """
944 Instance received through REST API of Orthanc
945 """
946 REST_API: int = 3,
947
948 """
949 Instance added to Orthanc by a plugin
950 """
951 PLUGIN: int = 4,
952
953 """
954 Instance added to Orthanc by a Lua script
955 """
956 LUA: int = 5,
957
958 """
959 Instance received through WebDAV (new in 1.8.0)
960 """
961 WEB_DAV: int = 6,
962
963 class JobStepStatus(enum.Enum):
964 """
965 The possible status for one single step of a job.
966 """
967
968 """
969 The job has successfully executed all its steps
970 """
971 SUCCESS: int = 1,
972
973 """
974 The job has failed while executing this step
975 """
976 FAILURE: int = 2,
977
978 """
979 The job has still data to process after this step
980 """
981 CONTINUE: int = 3,
982
983 class JobStopReason(enum.Enum):
984 """
985 Explains why the job should stop and release the resources it has allocated. This is especially important to disambiguate between the "paused" condition and the "final" conditions (success, failure, or canceled).
986 """
987
988 """
989 The job has succeeded
990 """
991 SUCCESS: int = 1,
992
993 """
994 The job was paused, and will be resumed later
995 """
996 PAUSED: int = 2,
997
998 """
999 The job has failed, and might be resubmitted later
1000 """
1001 FAILURE: int = 3,
1002
1003 """
1004 The job was canceled, and might be resubmitted later
1005 """
1006 CANCELED: int = 4,
1007
1008 class MetricsType(enum.Enum):
1009 """
1010 The available types of metrics.
1011 """
1012
1013 """
1014 Default metrics
1015 """
1016 DEFAULT: int = 0,
1017
1018 """
1019 This metrics represents a time duration. Orthanc will keep the maximum value of the metrics over a sliding window of ten seconds, which is useful if the metrics is sampled frequently.
1020 """
1021 TIMER: int = 1,
1022
1023 class PixelFormat(enum.Enum):
1024 """
1025 The memory layout of the pixels of an image.
1026 """
1027
1028 """
1029 Graylevel 8bpp image. The image is graylevel. Each pixel is unsigned and stored in one byte.
1030 """
1031 GRAYSCALE8: int = 1,
1032
1033 """
1034 Graylevel, unsigned 16bpp image. The image is graylevel. Each pixel is unsigned and stored in two bytes.
1035 """
1036 GRAYSCALE16: int = 2,
1037
1038 """
1039 Graylevel, signed 16bpp image. The image is graylevel. Each pixel is signed and stored in two bytes.
1040 """
1041 SIGNED_GRAYSCALE16: int = 3,
1042
1043 """
1044 Color image in RGB24 format. This format describes a color image. The pixels are stored in 3 consecutive bytes. The memory layout is RGB.
1045 """
1046 RGB24: int = 4,
1047
1048 """
1049 Color image in RGBA32 format. This format describes a color image. The pixels are stored in 4 consecutive bytes. The memory layout is RGBA.
1050 """
1051 RGBA32: int = 5,
1052
1053 """
1054 Unknown pixel format
1055 """
1056 UNKNOWN: int = 6,
1057
1058 """
1059 Color image in RGB48 format. This format describes a color image. The pixels are stored in 6 consecutive bytes. The memory layout is RRGGBB.
1060 """
1061 RGB48: int = 7,
1062
1063 """
1064 Graylevel, unsigned 32bpp image. The image is graylevel. Each pixel is unsigned and stored in four bytes.
1065 """
1066 GRAYSCALE32: int = 8,
1067
1068 """
1069 Graylevel, floating-point 32bpp image. The image is graylevel. Each pixel is floating-point and stored in four bytes.
1070 """
1071 FLOAT32: int = 9,
1072
1073 """
1074 Color image in BGRA32 format. This format describes a color image. The pixels are stored in 4 consecutive bytes. The memory layout is BGRA.
1075 """
1076 BGRA32: int = 10,
1077
1078 """
1079 Graylevel, unsigned 64bpp image. The image is graylevel. Each pixel is unsigned and stored in eight bytes.
1080 """
1081 GRAYSCALE64: int = 11,
1082
1083 class ReceivedInstanceAction(enum.Enum):
1084 """
1085 The action to be taken after ReceivedInstanceCallback is triggered
1086 """
1087
1088 """
1089 Keep the instance as is
1090 """
1091 KEEP_AS_IS: int = 1,
1092
1093 """
1094 Modify the instance
1095 """
1096 MODIFY: int = 2,
1097
1098 """
1099 Discard the instance
1100 """
1101 DISCARD: int = 3,
1102
1103 class ResourceType(enum.Enum):
1104 """
1105 The supported types of DICOM resources.
1106 """
1107
1108 """
1109 Patient
1110 """
1111 PATIENT: int = 0,
1112
1113 """
1114 Study
1115 """
1116 STUDY: int = 1,
1117
1118 """
1119 Series
1120 """
1121 SERIES: int = 2,
1122
1123 """
1124 Instance
1125 """
1126 INSTANCE: int = 3,
1127
1128 """
1129 Unavailable resource type
1130 """
1131 NONE: int = 4,
1132
1133 class StorageCommitmentFailureReason(enum.Enum):
1134 """
1135 The available values for the Failure Reason (0008,1197) during storage commitment. http://dicom.nema.org/medical/dicom/2019e/output/chtml/part03/sect_C.14.html#sect_C.14.1.1
1136 """
1137
1138 """
1139 Success: The DICOM instance is properly stored in the SCP
1140 """
1141 SUCCESS: int = 0,
1142
1143 """
1144 0110H: A general failure in processing the operation was encountered
1145 """
1146 PROCESSING_FAILURE: int = 1,
1147
1148 """
1149 0112H: One or more of the elements in the Referenced SOP Instance Sequence was not available
1150 """
1151 NO_SUCH_OBJECT_INSTANCE: int = 2,
1152
1153 """
1154 0213H: The SCP does not currently have enough resources to store the requested SOP Instance(s)
1155 """
1156 RESOURCE_LIMITATION: int = 3,
1157
1158 """
1159 0122H: Storage Commitment has been requested for a SOP Instance with a SOP Class that is not supported by the SCP
1160 """
1161 REFERENCED_SOPCLASS_NOT_SUPPORTED: int = 4,
1162
1163 """
1164 0119H: The SOP Class of an element in the Referenced SOP Instance Sequence did not correspond to the SOP class registered for this SOP Instance at the SCP
1165 """
1166 CLASS_INSTANCE_CONFLICT: int = 5,
1167
1168 """
1169 0131H: The Transaction UID of the Storage Commitment Request is already in use
1170 """
1171 DUPLICATE_TRANSACTION_UID: int = 6,
1172
1173 class ValueRepresentation(enum.Enum):
1174 """
1175 The value representations present in the DICOM standard (version 2013).
1176 """
1177
1178 """
1179 Application Entity
1180 """
1181 AE: int = 1,
1182
1183 """
1184 Age String
1185 """
1186 AS: int = 2,
1187
1188 """
1189 Attribute Tag
1190 """
1191 AT: int = 3,
1192
1193 """
1194 Code String
1195 """
1196 CS: int = 4,
1197
1198 """
1199 Date
1200 """
1201 DA: int = 5,
1202
1203 """
1204 Decimal String
1205 """
1206 DS: int = 6,
1207
1208 """
1209 Date Time
1210 """
1211 DT: int = 7,
1212
1213 """
1214 Floating Point Double
1215 """
1216 FD: int = 8,
1217
1218 """
1219 Floating Point Single
1220 """
1221 FL: int = 9,
1222
1223 """
1224 Integer String
1225 """
1226 IS: int = 10,
1227
1228 """
1229 Long String
1230 """
1231 LO: int = 11,
1232
1233 """
1234 Long Text
1235 """
1236 LT: int = 12,
1237
1238 """
1239 Other Byte String
1240 """
1241 OB: int = 13,
1242
1243 """
1244 Other Float String
1245 """
1246 OF: int = 14,
1247
1248 """
1249 Other Word String
1250 """
1251 OW: int = 15,
1252
1253 """
1254 Person Name
1255 """
1256 PN: int = 16,
1257
1258 """
1259 Short String
1260 """
1261 SH: int = 17,
1262
1263 """
1264 Signed Long
1265 """
1266 SL: int = 18,
1267
1268 """
1269 Sequence of Items
1270 """
1271 SQ: int = 19,
1272
1273 """
1274 Signed Short
1275 """
1276 SS: int = 20,
1277
1278 """
1279 Short Text
1280 """
1281 ST: int = 21,
1282
1283 """
1284 Time
1285 """
1286 TM: int = 22,
1287
1288 """
1289 Unique Identifier (UID)
1290 """
1291 UI: int = 23,
1292
1293 """
1294 Unsigned Long
1295 """
1296 UL: int = 24,
1297
1298 """
1299 Unknown
1300 """
1301 UN: int = 25,
1302
1303 """
1304 Unsigned Short
1305 """
1306 US: int = 26,
1307
1308 """
1309 Unlimited Text
1310 """
1311 UT: int = 27,
1312
1313
1314 # This function returns the MIME type of a file by inspecting its extension
1315 def AutodetectMimeType(path: str) -> str:
1316 """
1317 This function returns the MIME type of a file by inspecting its extension.
1318
1319 Args:
1320 path (str): Path to the file.
1321
1322 Returns:
1323 str: The MIME type. This is a statically-allocated string, do not free it.
1324 """
1325 ...
1326 # This function compresses or decompresses a buffer, using the version of the zlib library that is used by the Orthanc core
1327 def BufferCompression(source: bytes, compression: CompressionType, uncompress: int) -> bytes:
1328 """
1329 This function compresses or decompresses a buffer, using the version of the zlib library that is used by the Orthanc core.
1330
1331 Args:
1332 source (bytes): The source buffer.
1333 compression (CompressionType): The compression algorithm.
1334 uncompress (int): If set to "0", the buffer must be compressed. If set to "1", the buffer must be uncompressed.
1335
1336 Returns:
1337 bytes: 0 if success, or the error code if failure.
1338 """
1339 ...
1340 # This function checks whether the version of the Orthanc server running this plugin, is above the version of the current Orthanc SDK header
1341 def CheckVersion() -> int:
1342 """
1343 This function checks whether the version of the Orthanc server running this plugin, is above the version of the current Orthanc SDK header. This guarantees that the plugin is compatible with the hosting Orthanc (i.e. it will not call unavailable services). The result of this function should always be checked in the OrthancPluginInitialize() entry point of the plugin.
1344
1345 Returns:
1346 int: 1 if and only if the versions are compatible. If the result is 0, the initialization of the plugin should fail.
1347 """
1348 ...
1349 # This function checks whether the version of the Orthanc server running this plugin, is above the given version
1350 def CheckVersionAdvanced(expected_major: int, expected_minor: int, expected_revision: int) -> int:
1351 """
1352 This function checks whether the version of the Orthanc server running this plugin, is above the given version. Contrarily to OrthancPluginCheckVersion(), it is up to the developer of the plugin to make sure that all the Orthanc SDK services called by the plugin are actually implemented in the given version of Orthanc.
1353
1354 Args:
1355 expected_major (int): Expected major version.
1356 expected_minor (int): Expected minor version.
1357 expected_revision (int): Expected revision.
1358
1359 Returns:
1360 int: 1 if and only if the versions are compatible. If the result is 0, the initialization of the plugin should fail.
1361 """
1362 ...
1363 # This function compresses the given memory buffer containing an image using the JPEG specification, and stores the result of the compression into a newly allocated memory buffer
1364 def CompressJpegImage(format: PixelFormat, width: int, height: int, pitch: int, buffer: bytes, quality: int) -> bytes:
1365 """
1366 This function compresses the given memory buffer containing an image using the JPEG specification, and stores the result of the compression into a newly allocated memory buffer.
1367
1368 Args:
1369 format (PixelFormat): The memory layout of the uncompressed image.
1370 width (int): The width of the image.
1371 height (int): The height of the image.
1372 pitch (int): The pitch of the image (i.e. the number of bytes between 2 successive lines of the image in the memory buffer).
1373 buffer (bytes): The memory buffer containing the uncompressed image.
1374 quality (int): The quality of the JPEG encoding, between 1 (worst quality, best compression) and 100 (best quality, worst compression).
1375
1376 Returns:
1377 bytes: 0 if success, or the error code if failure.
1378 """
1379 ...
1380 # This function compresses the given memory buffer containing an image using the PNG specification, and stores the result of the compression into a newly allocated memory buffer
1381 def CompressPngImage(format: PixelFormat, width: int, height: int, pitch: int, buffer: bytes) -> bytes:
1382 """
1383 This function compresses the given memory buffer containing an image using the PNG specification, and stores the result of the compression into a newly allocated memory buffer.
1384
1385 Args:
1386 format (PixelFormat): The memory layout of the uncompressed image.
1387 width (int): The width of the image.
1388 height (int): The height of the image.
1389 pitch (int): The pitch of the image (i.e. the number of bytes between 2 successive lines of the image in the memory buffer).
1390 buffer (bytes): The memory buffer containing the uncompressed image.
1391
1392 Returns:
1393 bytes: 0 if success, or the error code if failure.
1394 """
1395 ...
1396 # This functions computes the MD5 cryptographic hash of the given memory buffer
1397 def ComputeMd5(buffer: bytes) -> str:
1398 """
1399 This functions computes the MD5 cryptographic hash of the given memory buffer.
1400
1401 Args:
1402 buffer (bytes): The source memory buffer.
1403
1404 Returns:
1405 str: The NULL value in case of error, or a string containing the cryptographic hash. This string must be freed by OrthancPluginFreeString().
1406 """
1407 ...
1408 # This functions computes the SHA-1 cryptographic hash of the given memory buffer
1409 def ComputeSha1(buffer: bytes) -> str:
1410 """
1411 This functions computes the SHA-1 cryptographic hash of the given memory buffer.
1412
1413 Args:
1414 buffer (bytes): The source memory buffer.
1415
1416 Returns:
1417 str: The NULL value in case of error, or a string containing the cryptographic hash. This string must be freed by OrthancPluginFreeString().
1418 """
1419 ...
1420 # This function takes as input a string containing a JSON file describing the content of a DICOM instance
1421 def CreateDicom(json: str, pixel_data: Image, flags: CreateDicomFlags) -> bytes:
1422 """
1423 This function takes as input a string containing a JSON file describing the content of a DICOM instance. As an output, it writes the corresponding DICOM instance to a newly allocated memory buffer. Additionally, an image to be encoded within the DICOM instance can also be provided.
1424 Private tags will be associated with the private creator whose value is specified in the "DefaultPrivateCreator" configuration option of Orthanc. The function OrthancPluginCreateDicom2() can be used if another private creator must be used to create this instance.
1425
1426 Args:
1427 json (str): The input JSON file.
1428 pixel_data (Image): The image. Can be NULL, if the pixel data is encoded inside the JSON with the data URI scheme.
1429 flags (CreateDicomFlags): Flags governing the output.
1430
1431 Returns:
1432 bytes: 0 if success, other value if error.
1433 """
1434 ...
1435 # This function takes as input a string containing a JSON file describing the content of a DICOM instance
1436 def CreateDicom2(json: str, pixel_data: Image, flags: CreateDicomFlags, private_creator: str) -> bytes:
1437 """
1438 This function takes as input a string containing a JSON file describing the content of a DICOM instance. As an output, it writes the corresponding DICOM instance to a newly allocated memory buffer. Additionally, an image to be encoded within the DICOM instance can also be provided.
1439 Contrarily to the function OrthancPluginCreateDicom(), this function can be explicitly provided with a private creator.
1440
1441 Args:
1442 json (str): The input JSON file.
1443 pixel_data (Image): The image. Can be NULL, if the pixel data is encoded inside the JSON with the data URI scheme.
1444 flags (CreateDicomFlags): Flags governing the output.
1445 private_creator (str): The private creator to be used for the private DICOM tags. Check out the global configuration option "Dictionary" of Orthanc.
1446
1447 Returns:
1448 bytes: 0 if success, other value if error.
1449 """
1450 ...
1451 # This function parses a memory buffer that contains a DICOM file
1452 def CreateDicomInstance(buffer: bytes) -> DicomInstance:
1453 """
1454 This function parses a memory buffer that contains a DICOM file. The function returns a new pointer to a data structure that is managed by the Orthanc core.
1455
1456 Args:
1457 buffer (bytes): The memory buffer containing the DICOM instance.
1458
1459 Returns:
1460 DicomInstance: The newly allocated DICOM instance. It must be freed with OrthancPluginFreeDicomInstance().
1461 """
1462 ...
1463 # This function creates a "matcher" object that can be used to check whether a DICOM instance matches a C-Find query
1464 def CreateFindMatcher(query: bytes) -> FindMatcher:
1465 """
1466 This function creates a "matcher" object that can be used to check whether a DICOM instance matches a C-Find query. The C-Find query must be expressed as a DICOM buffer.
1467
1468 Args:
1469 query (bytes): The C-Find DICOM query.
1470
1471 Returns:
1472 FindMatcher: The newly allocated matcher. It must be freed with OrthancPluginFreeFindMatcher().
1473 """
1474 ...
1475 # This function creates an image of given size and format
1476 def CreateImage(format: PixelFormat, width: int, height: int) -> Image:
1477 """
1478 This function creates an image of given size and format.
1479
1480 Args:
1481 format (PixelFormat): The format of the pixels.
1482 width (int): The width of the image.
1483 height (int): The height of the image.
1484
1485 Returns:
1486 Image: The newly allocated image. It must be freed with OrthancPluginFreeImage().
1487 """
1488 ...
1489 # Create a new memory buffer managed by the Orthanc core
1490 def CreateMemoryBuffer(size: int) -> bytes:
1491 """
1492 Create a new memory buffer managed by the Orthanc core
1493
1494 Args:
1495 size (int): Size of the memory buffer to be created
1496
1497 Returns:
1498 bytes: The newly allocated memory buffer
1499 """
1500 ...
1501 # This function decodes one frame of a DICOM image that is stored in a memory buffer
1502 def DecodeDicomImage(buffer: bytes, frame_index: int) -> Image:
1503 """
1504 This function decodes one frame of a DICOM image that is stored in a memory buffer. This function will give the same result as OrthancPluginUncompressImage() for single-frame DICOM images.
1505
1506 Args:
1507 buffer (bytes): Pointer to a memory buffer containing the DICOM image.
1508 frame_index (int): The index of the frame of interest in a multi-frame image.
1509
1510 Returns:
1511 Image: The uncompressed image. It must be freed with OrthancPluginFreeImage().
1512 """
1513 ...
1514 # This function takes as input a memory buffer containing a DICOM file, and outputs a JSON string representing the tags of this DICOM file
1515 def DicomBufferToJson(buffer: bytes, format: DicomToJsonFormat, flags: DicomToJsonFlags, max_string_length: int) -> str:
1516 """
1517 This function takes as input a memory buffer containing a DICOM file, and outputs a JSON string representing the tags of this DICOM file.
1518
1519 Args:
1520 buffer (bytes): The memory buffer containing the DICOM file.
1521 format (DicomToJsonFormat): The output format.
1522 flags (DicomToJsonFlags): Flags governing the output.
1523 max_string_length (int): The maximum length of a field. Too long fields will be output as "null". The 0 value means no maximum length.
1524
1525 Returns:
1526 str: The NULL value if the case of an error, or the JSON string. This string must be freed by OrthancPluginFreeString().
1527 """
1528 ...
1529 # This function formats a DICOM instance that is stored in Orthanc, and outputs a JSON string representing the tags of this DICOM instance
1530 def DicomInstanceToJson(instance_id: str, format: DicomToJsonFormat, flags: DicomToJsonFlags, max_string_length: int) -> str:
1531 """
1532 This function formats a DICOM instance that is stored in Orthanc, and outputs a JSON string representing the tags of this DICOM instance.
1533
1534 Args:
1535 instance_id (str): The Orthanc identifier of the instance.
1536 format (DicomToJsonFormat): The output format.
1537 flags (DicomToJsonFlags): Flags governing the output.
1538 max_string_length (int): The maximum length of a field. Too long fields will be output as "null". The 0 value means no maximum length.
1539
1540 Returns:
1541 str: The NULL value if the case of an error, or the JSON string. This string must be freed by OrthancPluginFreeString().
1542 """
1543 ...
1544 # Add JavaScript code to customize the default behavior of Orthanc Explorer
1545 def ExtendOrthancExplorer(javascript: str) -> None:
1546 """
1547 Add JavaScript code to customize the default behavior of Orthanc Explorer. This can for instance be used to add new buttons.
1548
1549 Args:
1550 javascript (str): The custom JavaScript code.
1551 """
1552 ...
1553 # This function generates a token that can be set in the HTTP header "Authorization" so as to grant full access to the REST API of Orthanc using an external HTTP client
1554 def GenerateRestApiAuthorizationToken() -> str:
1555 """
1556 This function generates a token that can be set in the HTTP header "Authorization" so as to grant full access to the REST API of Orthanc using an external HTTP client. Using this function avoids the need of adding a separate user in the "RegisteredUsers" configuration of Orthanc, which eases deployments.
1557 This feature is notably useful in multiprocess scenarios, where a subprocess created by a plugin has no access to the "OrthancPluginContext", and thus cannot call "OrthancPluginRestApi[Get|Post|Put|Delete]()".
1558 This situation is frequently encountered in Python plugins, where the "multiprocessing" package can be used to bypass the Global Interpreter Lock (GIL) and thus to improve performance and concurrency.
1559
1560 Returns:
1561 str: The authorization token, or NULL value in the case of an error. This string must be freed by OrthancPluginFreeString().
1562 """
1563 ...
1564 # Generate a random GUID/UUID (globally unique identifier)
1565 def GenerateUuid() -> str:
1566 """
1567 Generate a random GUID/UUID (globally unique identifier).
1568
1569 Returns:
1570 str: NULL in the case of an error, or a newly allocated string containing the UUID. This string must be freed by OrthancPluginFreeString().
1571 """
1572 ...
1573 # Get the value of one of the command-line arguments that were used to launch Orthanc
1574 def GetCommandLineArgument(argument: int) -> str:
1575 """
1576 Get the value of one of the command-line arguments that were used to launch Orthanc. The number of available arguments can be retrieved by OrthancPluginGetCommandLineArgumentsCount().
1577
1578 Args:
1579 argument (int): The index of the argument.
1580
1581 Returns:
1582 str: The value of the argument, or NULL in the case of an error. This string must be freed by OrthancPluginFreeString().
1583 """
1584 ...
1585 # Retrieve the number of command-line arguments that were used to launch Orthanc
1586 def GetCommandLineArgumentsCount() -> int:
1587 """
1588 Retrieve the number of command-line arguments that were used to launch Orthanc.
1589
1590 Returns:
1591 int: The number of arguments.
1592 """
1593 ...
1594 # This function returns the content of the configuration that is used by Orthanc, formatted as a JSON string
1595 def GetConfiguration() -> str:
1596 """
1597 This function returns the content of the configuration that is used by Orthanc, formatted as a JSON string.
1598
1599 Returns:
1600 str: NULL in the case of an error, or a newly allocated string containing the configuration. This string must be freed by OrthancPluginFreeString().
1601 """
1602 ...
1603 # This function returns the path to the configuration file(s) that was specified when starting Orthanc
1604 def GetConfigurationPath() -> str:
1605 """
1606 This function returns the path to the configuration file(s) that was specified when starting Orthanc. Since version 0.9.1, this path can refer to a folder that stores a set of configuration files. This function is deprecated in favor of OrthancPluginGetConfiguration().
1607
1608 Returns:
1609 str: NULL in the case of an error, or a newly allocated string containing the path. This string must be freed by OrthancPluginFreeString().
1610 """
1611 ...
1612 # Retrieve a DICOM instance using its Orthanc identifier
1613 def GetDicomForInstance(instance_id: str) -> bytes:
1614 """
1615 Retrieve a DICOM instance using its Orthanc identifier. The DICOM file is stored into a newly allocated memory buffer.
1616
1617 Args:
1618 instance_id (str): The Orthanc identifier of the DICOM instance of interest.
1619
1620 Returns:
1621 bytes: 0 if success, or the error code if failure.
1622 """
1623 ...
1624 # This function returns the description of a given error code
1625 def GetErrorDescription(error: ErrorCode) -> str:
1626 """
1627 This function returns the description of a given error code.
1628
1629 Args:
1630 error (ErrorCode): The error code of interest.
1631
1632 Returns:
1633 str: The error description. This is a statically-allocated string, do not free it.
1634 """
1635 ...
1636 # Retrieve the expected version of the database schema
1637 def GetExpectedDatabaseVersion() -> int:
1638 """
1639 Retrieve the expected version of the database schema.
1640
1641 Returns:
1642 int: The version.
1643 """
1644 ...
1645 # This function returns the name of a font that is built in the Orthanc core
1646 def GetFontName(font_index: int) -> str:
1647 """
1648 This function returns the name of a font that is built in the Orthanc core.
1649
1650 Args:
1651 font_index (int): The index of the font. This value must be less than OrthancPluginGetFontsCount().
1652
1653 Returns:
1654 str: The font name. This is a statically-allocated string, do not free it.
1655 """
1656 ...
1657 # This function returns the size of a font that is built in the Orthanc core
1658 def GetFontSize(font_index: int) -> int:
1659 """
1660 This function returns the size of a font that is built in the Orthanc core.
1661
1662 Args:
1663 font_index (int): The index of the font. This value must be less than OrthancPluginGetFontsCount().
1664
1665 Returns:
1666 int: The font size.
1667 """
1668 ...
1669 # This function returns the number of fonts that are built in the Orthanc core
1670 def GetFontsCount() -> int:
1671 """
1672 This function returns the number of fonts that are built in the Orthanc core. These fonts can be used to draw texts on images through OrthancPluginDrawText().
1673
1674 Returns:
1675 int: The number of fonts.
1676 """
1677 ...
1678 # Get the value of a global property that is stored in the Orthanc database
1679 def GetGlobalProperty(property: int, default_value: str) -> str:
1680 """
1681 Get the value of a global property that is stored in the Orthanc database. Global properties whose index is below 1024 are reserved by Orthanc.
1682
1683 Args:
1684 property (int): The global property of interest.
1685 default_value (str): The value to return, if the global property is unset.
1686
1687 Returns:
1688 str: The value of the global property, or NULL in the case of an error. This string must be freed by OrthancPluginFreeString().
1689 """
1690 ...
1691 # This function returns the path to the directory containing the Orthanc executable
1692 def GetOrthancDirectory() -> str:
1693 """
1694 This function returns the path to the directory containing the Orthanc executable.
1695
1696 Returns:
1697 str: NULL in the case of an error, or a newly allocated string containing the path. This string must be freed by OrthancPluginFreeString().
1698 """
1699 ...
1700 # This function returns the path to the Orthanc executable
1701 def GetOrthancPath() -> str:
1702 """
1703 This function returns the path to the Orthanc executable.
1704
1705 Returns:
1706 str: NULL in the case of an error, or a newly allocated string containing the path. This string must be freed by OrthancPluginFreeString().
1707 """
1708 ...
1709 # This function returns the parameters of the Orthanc peers that are known to the Orthanc server hosting the plugin
1710 def GetPeers() -> Peers:
1711 """
1712 This function returns the parameters of the Orthanc peers that are known to the Orthanc server hosting the plugin.
1713
1714 Returns:
1715 Peers: NULL if error, or a newly allocated opaque data structure containing the peers. This structure must be freed with OrthancPluginFreePeers().
1716 """
1717 ...
1718 # This function makes a lookup to the dictionary of DICOM tags that are known to Orthanc, and returns the symbolic name of a DICOM tag
1719 def GetTagName(group: int, element: int, private_creator: str) -> str:
1720 """
1721 This function makes a lookup to the dictionary of DICOM tags that are known to Orthanc, and returns the symbolic name of a DICOM tag.
1722
1723 Args:
1724 group (int): The group of the tag.
1725 element (int): The element of the tag.
1726 private_creator (str): For private tags, the name of the private creator (can be NULL).
1727
1728 Returns:
1729 str: NULL in the case of an error, or a newly allocated string containing the path. This string must be freed by OrthancPluginFreeString().
1730 """
1731 ...
1732 # Make a HTTP DELETE call to the given URL
1733 def HttpDelete(url: str, username: str, password: str) -> None:
1734 """
1735 Make a HTTP DELETE call to the given URL. Favor OrthancPluginRestApiDelete() if calling the built-in REST API of the Orthanc instance that hosts this plugin.
1736
1737 Args:
1738 url (str): The URL of interest.
1739 username (str): The username (can be "NULL" if no password protection).
1740 password (str): The password (can be "NULL" if no password protection).
1741 """
1742 ...
1743 # Make a HTTP GET call to the given URL
1744 def HttpGet(url: str, username: str, password: str) -> bytes:
1745 """
1746 Make a HTTP GET call to the given URL. The result to the query is stored into a newly allocated memory buffer. Favor OrthancPluginRestApiGet() if calling the built-in REST API of the Orthanc instance that hosts this plugin.
1747
1748 Args:
1749 url (str): The URL of interest.
1750 username (str): The username (can be "NULL" if no password protection).
1751 password (str): The password (can be "NULL" if no password protection).
1752
1753 Returns:
1754 bytes: 0 if success, or the error code if failure.
1755 """
1756 ...
1757 # Make a HTTP POST call to the given URL
1758 def HttpPost(url: str, body: bytes, username: str, password: str) -> bytes:
1759 """
1760 Make a HTTP POST call to the given URL. The result to the query is stored into a newly allocated memory buffer. Favor OrthancPluginRestApiPost() if calling the built-in REST API of the Orthanc instance that hosts this plugin.
1761
1762 Args:
1763 url (str): The URL of interest.
1764 body (bytes): The content of the body of the request.
1765 username (str): The username (can be "NULL" if no password protection).
1766 password (str): The password (can be "NULL" if no password protection).
1767
1768 Returns:
1769 bytes: 0 if success, or the error code if failure.
1770 """
1771 ...
1772 # Make a HTTP PUT call to the given URL
1773 def HttpPut(url: str, body: bytes, username: str, password: str) -> bytes:
1774 """
1775 Make a HTTP PUT call to the given URL. The result to the query is stored into a newly allocated memory buffer. Favor OrthancPluginRestApiPut() if calling the built-in REST API of the Orthanc instance that hosts this plugin.
1776
1777 Args:
1778 url (str): The URL of interest.
1779 body (bytes): The content of the body of the request.
1780 username (str): The username (can be "NULL" if no password protection).
1781 password (str): The password (can be "NULL" if no password protection).
1782
1783 Returns:
1784 bytes: 0 if success, or the error code if failure.
1785 """
1786 ...
1787 # Log an error message using the Orthanc logging system
1788 def LogError(message: str) -> None:
1789 """
1790 Log an error message using the Orthanc logging system.
1791
1792 Args:
1793 message (str): The message to be logged.
1794 """
1795 ...
1796 # Log an information message using the Orthanc logging system
1797 def LogInfo(message: str) -> None:
1798 """
1799 Log an information message using the Orthanc logging system.
1800
1801 Args:
1802 message (str): The message to be logged.
1803 """
1804 ...
1805 # Log a warning message using the Orthanc logging system
1806 def LogWarning(message: str) -> None:
1807 """
1808 Log a warning message using the Orthanc logging system.
1809
1810 Args:
1811 message (str): The message to be logged.
1812 """
1813 ...
1814 # Look for an instance stored in Orthanc, using its SOP Instance UID tag (0x0008, 0x0018)
1815 def LookupInstance(sop_instance_u_i_d: str) -> str:
1816 """
1817 Look for an instance stored in Orthanc, using its SOP Instance UID tag (0x0008, 0x0018). This function uses the database index to run as fast as possible (it does not loop over all the stored instances).
1818
1819 Args:
1820 sop_instance_u_i_d (str): The SOP Instance UID of interest.
1821
1822 Returns:
1823 str: The NULL value if the instance is non-existent, or a string containing the Orthanc ID of the instance. This string must be freed by OrthancPluginFreeString().
1824 """
1825 ...
1826 # Look for a patient stored in Orthanc, using its Patient ID tag (0x0010, 0x0020)
1827 def LookupPatient(patient_i_d: str) -> str:
1828 """
1829 Look for a patient stored in Orthanc, using its Patient ID tag (0x0010, 0x0020). This function uses the database index to run as fast as possible (it does not loop over all the stored patients).
1830
1831 Args:
1832 patient_i_d (str): The Patient ID of interest.
1833
1834 Returns:
1835 str: The NULL value if the patient is non-existent, or a string containing the Orthanc ID of the patient. This string must be freed by OrthancPluginFreeString().
1836 """
1837 ...
1838 # Look for a series stored in Orthanc, using its Series Instance UID tag (0x0020, 0x000e)
1839 def LookupSeries(series_u_i_d: str) -> str:
1840 """
1841 Look for a series stored in Orthanc, using its Series Instance UID tag (0x0020, 0x000e). This function uses the database index to run as fast as possible (it does not loop over all the stored series).
1842
1843 Args:
1844 series_u_i_d (str): The Series Instance UID of interest.
1845
1846 Returns:
1847 str: The NULL value if the series is non-existent, or a string containing the Orthanc ID of the series. This string must be freed by OrthancPluginFreeString().
1848 """
1849 ...
1850 # Look for a study stored in Orthanc, using its Study Instance UID tag (0x0020, 0x000d)
1851 def LookupStudy(study_u_i_d: str) -> str:
1852 """
1853 Look for a study stored in Orthanc, using its Study Instance UID tag (0x0020, 0x000d). This function uses the database index to run as fast as possible (it does not loop over all the stored studies).
1854
1855 Args:
1856 study_u_i_d (str): The Study Instance UID of interest.
1857
1858 Returns:
1859 str: The NULL value if the study is non-existent, or a string containing the Orthanc ID of the study. This string must be freed by OrthancPluginFreeString().
1860 """
1861 ...
1862 # Look for a study stored in Orthanc, using its Accession Number tag (0x0008, 0x0050)
1863 def LookupStudyWithAccessionNumber(accession_number: str) -> str:
1864 """
1865 Look for a study stored in Orthanc, using its Accession Number tag (0x0008, 0x0050). This function uses the database index to run as fast as possible (it does not loop over all the stored studies).
1866
1867 Args:
1868 accession_number (str): The Accession Number of interest.
1869
1870 Returns:
1871 str: The NULL value if the study is non-existent, or a string containing the Orthanc ID of the study. This string must be freed by OrthancPluginFreeString().
1872 """
1873 ...
1874 # Read the content of a file on the filesystem, and returns it into a newly allocated memory buffer
1875 def ReadFile(path: str) -> bytes:
1876 """
1877 Read the content of a file on the filesystem, and returns it into a newly allocated memory buffer.
1878
1879 Args:
1880 path (str): The path of the file to be read.
1881
1882 Returns:
1883 bytes: 0 if success, or the error code if failure.
1884 """
1885 ...
1886 # This function declares a new public tag in the dictionary of DICOM tags that are known to Orthanc
1887 def RegisterDictionaryTag(group: int, element: int, vr: ValueRepresentation, name: str, min_multiplicity: int, max_multiplicity: int) -> None:
1888 """
1889 This function declares a new public tag in the dictionary of DICOM tags that are known to Orthanc. This function should be used in the OrthancPluginInitialize() callback.
1890
1891 Args:
1892 group (int): The group of the tag.
1893 element (int): The element of the tag.
1894 vr (ValueRepresentation): The value representation of the tag.
1895 name (str): The nickname of the tag.
1896 min_multiplicity (int): The minimum multiplicity of the tag (must be above 0).
1897 max_multiplicity (int): The maximum multiplicity of the tag. A value of 0 means an arbitrary multiplicity (""n"").
1898 """
1899 ...
1900 # This function declares a custom error code that can be generated by this plugin
1901 def RegisterErrorCode(code: int, http_status: int, message: str) -> None:
1902 """
1903 This function declares a custom error code that can be generated by this plugin. This declaration is used to enrich the body of the HTTP answer in the case of an error, and to set the proper HTTP status code.
1904
1905 Args:
1906 code (int): The error code that is internal to this plugin.
1907 http_status (int): The HTTP status corresponding to this error.
1908 message (str): The description of the error.
1909 """
1910 ...
1911 # This function declares a new private tag in the dictionary of DICOM tags that are known to Orthanc
1912 def RegisterPrivateDictionaryTag(group: int, element: int, vr: ValueRepresentation, name: str, min_multiplicity: int, max_multiplicity: int, private_creator: str) -> None:
1913 """
1914 This function declares a new private tag in the dictionary of DICOM tags that are known to Orthanc. This function should be used in the OrthancPluginInitialize() callback.
1915
1916 Args:
1917 group (int): The group of the tag.
1918 element (int): The element of the tag.
1919 vr (ValueRepresentation): The value representation of the tag.
1920 name (str): The nickname of the tag.
1921 min_multiplicity (int): The minimum multiplicity of the tag (must be above 0).
1922 max_multiplicity (int): The maximum multiplicity of the tag. A value of 0 means an arbitrary multiplicity (""n"").
1923 private_creator (str): The private creator of this private tag.
1924 """
1925 ...
1926 # Make a DELETE call to the built-in Orthanc REST API
1927 def RestApiDelete(uri: str) -> None:
1928 """
1929 Make a DELETE call to the built-in Orthanc REST API.
1930 Remark: If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
1931
1932 Args:
1933 uri (str): The URI to delete in the built-in Orthanc API.
1934 """
1935 ...
1936 # Make a DELETE call to the Orthanc REST API, after all the plugins are applied
1937 def RestApiDeleteAfterPlugins(uri: str) -> None:
1938 """
1939 Make a DELETE call to the Orthanc REST API, after all the plugins are applied. In other words, if some plugin overrides or adds the called URI to the built-in Orthanc REST API, this call will return the result provided by this plugin.
1940 Remark: If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
1941
1942 Args:
1943 uri (str): The URI to delete in the built-in Orthanc API.
1944 """
1945 ...
1946 # Make a GET call to the built-in Orthanc REST API
1947 def RestApiGet(uri: str) -> bytes:
1948 """
1949 Make a GET call to the built-in Orthanc REST API. The result to the query is stored into a newly allocated memory buffer.
1950 Remark: If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
1951
1952 Args:
1953 uri (str): The URI in the built-in Orthanc API.
1954
1955 Returns:
1956 bytes: 0 if success, or the error code if failure.
1957 """
1958 ...
1959 # Make a GET call to the Orthanc REST API, after all the plugins are applied
1960 def RestApiGetAfterPlugins(uri: str) -> bytes:
1961 """
1962 Make a GET call to the Orthanc REST API, after all the plugins are applied. In other words, if some plugin overrides or adds the called URI to the built-in Orthanc REST API, this call will return the result provided by this plugin. The result to the query is stored into a newly allocated memory buffer.
1963 Remark: If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
1964
1965 Args:
1966 uri (str): The URI in the built-in Orthanc API.
1967
1968 Returns:
1969 bytes: 0 if success, or the error code if failure.
1970 """
1971 ...
1972 # Make a POST call to the built-in Orthanc REST API
1973 def RestApiPost(uri: str, body: bytes) -> bytes:
1974 """
1975 Make a POST call to the built-in Orthanc REST API. The result to the query is stored into a newly allocated memory buffer.
1976 Remark: If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
1977
1978 Args:
1979 uri (str): The URI in the built-in Orthanc API.
1980 body (bytes): The body of the POST request.
1981
1982 Returns:
1983 bytes: 0 if success, or the error code if failure.
1984 """
1985 ...
1986 # Make a POST call to the Orthanc REST API, after all the plugins are applied
1987 def RestApiPostAfterPlugins(uri: str, body: bytes) -> bytes:
1988 """
1989 Make a POST call to the Orthanc REST API, after all the plugins are applied. In other words, if some plugin overrides or adds the called URI to the built-in Orthanc REST API, this call will return the result provided by this plugin. The result to the query is stored into a newly allocated memory buffer.
1990 Remark: If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
1991
1992 Args:
1993 uri (str): The URI in the built-in Orthanc API.
1994 body (bytes): The body of the POST request.
1995
1996 Returns:
1997 bytes: 0 if success, or the error code if failure.
1998 """
1999 ...
2000 # Make a PUT call to the built-in Orthanc REST API
2001 def RestApiPut(uri: str, body: bytes) -> bytes:
2002 """
2003 Make a PUT call to the built-in Orthanc REST API. The result to the query is stored into a newly allocated memory buffer.
2004 Remark: If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
2005
2006 Args:
2007 uri (str): The URI in the built-in Orthanc API.
2008 body (bytes): The body of the PUT request.
2009
2010 Returns:
2011 bytes: 0 if success, or the error code if failure.
2012 """
2013 ...
2014 # Make a PUT call to the Orthanc REST API, after all the plugins are applied
2015 def RestApiPutAfterPlugins(uri: str, body: bytes) -> bytes:
2016 """
2017 Make a PUT call to the Orthanc REST API, after all the plugins are applied. In other words, if some plugin overrides or adds the called URI to the built-in Orthanc REST API, this call will return the result provided by this plugin. The result to the query is stored into a newly allocated memory buffer.
2018 Remark: If the resource is not existing (error 404), the error code will be OrthancPluginErrorCode_UnknownResource.
2019
2020 Args:
2021 uri (str): The URI in the built-in Orthanc API.
2022 body (bytes): The body of the PUT request.
2023
2024 Returns:
2025 bytes: 0 if success, or the error code if failure.
2026 """
2027 ...
2028 # Set a description for this plugin
2029 def SetDescription(description: str) -> None:
2030 """
2031 Set a description for this plugin. It is displayed in the "Plugins" page of Orthanc Explorer.
2032
2033 Args:
2034 description (str): The description.
2035 """
2036 ...
2037 # Set the value of a global property into the Orthanc database
2038 def SetGlobalProperty(property: int, value: str) -> None:
2039 """
2040 Set the value of a global property into the Orthanc database. Setting a global property can be used by plugins to save their internal parameters. Plugins are only allowed to set properties whose index are above or equal to 1024 (properties below 1024 are read-only and reserved by Orthanc).
2041
2042 Args:
2043 property (int): The global property of interest.
2044 value (str): The value to be set in the global property.
2045 """
2046 ...
2047 # This function sets the value of a metrics to monitor the behavior of the plugin through tools such as Prometheus
2048 def SetMetricsValue(name: str, value: float, type: MetricsType) -> None:
2049 """
2050 This function sets the value of a metrics to monitor the behavior of the plugin through tools such as Prometheus. The values of all the metrics are stored within the Orthanc context.
2051
2052 Args:
2053 name (str): The name of the metrics to be set.
2054 value (float): The value of the metrics.
2055 type (MetricsType): The type of the metrics. This parameter is only taken into consideration the first time this metrics is set.
2056 """
2057 ...
2058 # For plugins that come with a Web interface, this function declares the entry path where to find this interface
2059 def SetRootUri(uri: str) -> None:
2060 """
2061 For plugins that come with a Web interface, this function declares the entry path where to find this interface. This information is notably used in the "Plugins" page of Orthanc Explorer.
2062
2063 Args:
2064 uri (str): The root URI for this plugin.
2065 """
2066 ...
2067 # This function parses a memory buffer that contains a DICOM file, then transcodes it to the given transfer syntax
2068 def TranscodeDicomInstance(buffer: bytes, transfer_syntax: str) -> DicomInstance:
2069 """
2070 This function parses a memory buffer that contains a DICOM file, then transcodes it to the given transfer syntax. The function returns a new pointer to a data structure that is managed by the Orthanc core.
2071
2072 Args:
2073 buffer (bytes): The memory buffer containing the DICOM instance.
2074 transfer_syntax (str): The transfer syntax UID for the transcoding.
2075
2076 Returns:
2077 DicomInstance: The newly allocated DICOM instance. It must be freed with OrthancPluginFreeDicomInstance().
2078 """
2079 ...
2080 # This function decodes a compressed image from a memory buffer
2081 def UncompressImage(data: bytes, format: ImageFormat) -> Image:
2082 """
2083 This function decodes a compressed image from a memory buffer.
2084
2085 Args:
2086 data (bytes): Pointer to a memory buffer containing the compressed image.
2087 format (ImageFormat): The file format of the compressed image.
2088
2089 Returns:
2090 Image: The uncompressed image. It must be freed with OrthancPluginFreeImage().
2091 """
2092 ...
2093 # Write the content of a memory buffer to the filesystem
2094 def WriteFile(path: str, data: bytes) -> None:
2095 """
2096 Write the content of a memory buffer to the filesystem.
2097
2098 Args:
2099 path (str): The path of the file to be written.
2100 data (bytes): The content of the memory buffer.
2101 """
2102 ...
2103
2104
2105 class DicomInstance:
2106 ...
2107
2108 # This function returns the Application Entity Title (AET) of the DICOM modality from which a DICOM instance originates
2109 def GetInstanceRemoteAet(self) -> str:
2110 """
2111 This function returns the Application Entity Title (AET) of the DICOM modality from which a DICOM instance originates.
2112
2113 Returns:
2114 str: The AET if success, NULL if error.
2115 """
2116 ...
2117 # This function returns the number of bytes of the given DICOM instance
2118 def GetInstanceSize(self) -> int:
2119 """
2120 This function returns the number of bytes of the given DICOM instance.
2121
2122 Returns:
2123 int: The size of the file, -1 in case of error.
2124 """
2125 ...
2126 # This function returns a pointer to a newly created string containing a JSON file
2127 def GetInstanceJson(self) -> str:
2128 """
2129 This function returns a pointer to a newly created string containing a JSON file. This JSON file encodes the tag hierarchy of the given DICOM instance.
2130
2131 Returns:
2132 str: The NULL value in case of error, or a string containing the JSON file. This string must be freed by OrthancPluginFreeString().
2133 """
2134 ...
2135 # This function returns a pointer to a newly created string containing a JSON file
2136 def GetInstanceSimplifiedJson(self) -> str:
2137 """
2138 This function returns a pointer to a newly created string containing a JSON file. This JSON file encodes the tag hierarchy of the given DICOM instance. In contrast with ::OrthancPluginGetInstanceJson(), the returned JSON file is in its simplified version.
2139
2140 Returns:
2141 str: The NULL value in case of error, or a string containing the JSON file. This string must be freed by OrthancPluginFreeString().
2142 """
2143 ...
2144 # This function checks whether the DICOM instance of interest is associated with some metadata
2145 def HasInstanceMetadata(self, metadata: str) -> int:
2146 """
2147 This function checks whether the DICOM instance of interest is associated with some metadata. As of Orthanc 0.8.1, in the callbacks registered by ::OrthancPluginRegisterOnStoredInstanceCallback(), the only possibly available metadata are "ReceptionDate", "RemoteAET" and "IndexInSeries".
2148
2149 Args:
2150 metadata (str): The metadata of interest.
2151
2152 Returns:
2153 int: 1 if the metadata is present, 0 if it is absent, -1 in case of error.
2154 """
2155 ...
2156 # This functions returns the value of some metadata that is associated with the DICOM instance of interest
2157 def GetInstanceMetadata(self, metadata: str) -> str:
2158 """
2159 This functions returns the value of some metadata that is associated with the DICOM instance of interest. Before calling this function, the existence of the metadata must have been checked with ::OrthancPluginHasInstanceMetadata().
2160
2161 Args:
2162 metadata (str): The metadata of interest.
2163
2164 Returns:
2165 str: The metadata value if success, NULL if error. Please note that the returned string belongs to the instance object and must NOT be deallocated. Please make a copy of the string if you wish to access it later.
2166 """
2167 ...
2168 # This function returns the origin of a DICOM instance that has been received by Orthanc
2169 def GetInstanceOrigin(self) -> InstanceOrigin:
2170 """
2171 This function returns the origin of a DICOM instance that has been received by Orthanc.
2172
2173 Returns:
2174 InstanceOrigin: The origin of the instance.
2175 """
2176 ...
2177 # This function returns a pointer to a newly created string that contains the transfer syntax UID of the DICOM instance
2178 def GetInstanceTransferSyntaxUid(self) -> str:
2179 """
2180 This function returns a pointer to a newly created string that contains the transfer syntax UID of the DICOM instance. The empty string might be returned if this information is unknown.
2181
2182 Returns:
2183 str: The NULL value in case of error, or a string containing the transfer syntax UID. This string must be freed by OrthancPluginFreeString().
2184 """
2185 ...
2186 # This function returns a Boolean value indicating whether the DICOM instance contains the pixel data (7FE0,0010) tag
2187 def HasInstancePixelData(self) -> int:
2188 """
2189 This function returns a Boolean value indicating whether the DICOM instance contains the pixel data (7FE0,0010) tag.
2190
2191 Returns:
2192 int: "1" if the DICOM instance contains pixel data, or "0" if the tag is missing, or "-1" in the case of an error.
2193 """
2194 ...
2195 # This function returns the number of frames that are part of a DICOM image managed by the Orthanc core
2196 def GetInstanceFramesCount(self) -> int:
2197 """
2198 This function returns the number of frames that are part of a DICOM image managed by the Orthanc core.
2199
2200 Returns:
2201 int: The number of frames (will be zero in the case of an error).
2202 """
2203 ...
2204 # This function returns a memory buffer containing the raw content of a frame in a DICOM instance that is managed by the Orthanc core
2205 def GetInstanceRawFrame(self, frame_index: int) -> bytes:
2206 """
2207 This function returns a memory buffer containing the raw content of a frame in a DICOM instance that is managed by the Orthanc core. This is notably useful for compressed transfer syntaxes, as it gives access to the embedded files (such as JPEG, JPEG-LS or JPEG2k). The Orthanc core transparently reassembles the fragments to extract the raw frame.
2208
2209 Args:
2210 frame_index (int): The index of the frame of interest.
2211
2212 Returns:
2213 bytes: 0 if success, or the error code if failure.
2214 """
2215 ...
2216 # This function decodes one frame of a DICOM image that is managed by the Orthanc core
2217 def GetInstanceDecodedFrame(self, frame_index: int) -> Image:
2218 """
2219 This function decodes one frame of a DICOM image that is managed by the Orthanc core.
2220
2221 Args:
2222 frame_index (int): The index of the frame of interest.
2223
2224 Returns:
2225 Image: The uncompressed image. It must be freed with OrthancPluginFreeImage().
2226 """
2227 ...
2228 # This function returns a memory buffer containing the serialization of a DICOM instance that is managed by the Orthanc core
2229 def SerializeDicomInstance(self) -> bytes:
2230 """
2231 This function returns a memory buffer containing the serialization of a DICOM instance that is managed by the Orthanc core.
2232
2233 Returns:
2234 bytes: 0 if success, or the error code if failure.
2235 """
2236 ...
2237 # This function takes as DICOM instance managed by the Orthanc core, and outputs a JSON string representing the tags of this DICOM file
2238 def GetInstanceAdvancedJson(self, format: DicomToJsonFormat, flags: DicomToJsonFlags, max_string_length: int) -> str:
2239 """
2240 This function takes as DICOM instance managed by the Orthanc core, and outputs a JSON string representing the tags of this DICOM file.
2241
2242 Args:
2243 format (DicomToJsonFormat): The output format.
2244 flags (DicomToJsonFlags): Flags governing the output.
2245 max_string_length (int): The maximum length of a field. Too long fields will be output as "null". The 0 value means no maximum length.
2246
2247 Returns:
2248 str: The NULL value if the case of an error, or the JSON string. This string must be freed by OrthancPluginFreeString().
2249 """
2250 ...
2251
2252 # Get the content of the DICOM instance
2253 def GetInstanceData(self) -> bytes:
2254 """
2255 Get the content of the DICOM instance.
2256
2257 Returns:
2258 bytes: The DICOM data.
2259 """
2260 ...
2261 class DicomWebNode:
2262 ...
2263
2264
2265 class FindAnswers:
2266 ...
2267
2268 # This function adds one answer (encoded as a DICOM file) to the set of answers corresponding to some C-Find SCP request that is not related to modality worklists
2269 def FindAddAnswer(self, dicom: bytes) -> None:
2270 """
2271 This function adds one answer (encoded as a DICOM file) to the set of answers corresponding to some C-Find SCP request that is not related to modality worklists.
2272
2273 Args:
2274 dicom (bytes): The answer to be added, encoded as a DICOM file.
2275 """
2276 ...
2277 # This function marks as incomplete the set of answers corresponding to some C-Find SCP request that is not related to modality worklists
2278 def FindMarkIncomplete(self) -> None:
2279 """
2280 This function marks as incomplete the set of answers corresponding to some C-Find SCP request that is not related to modality worklists. This must be used if canceling the handling of a request when too many answers are to be returned.
2281 """
2282 ...
2283
2284 class FindMatcher:
2285 ...
2286
2287 # This function checks whether one DICOM instance matches C-Find matcher that was previously allocated using OrthancPluginCreateFindMatcher()
2288 def FindMatcherIsMatch(self, dicom: bytes) -> int:
2289 """
2290 This function checks whether one DICOM instance matches C-Find matcher that was previously allocated using OrthancPluginCreateFindMatcher().
2291
2292 Args:
2293 dicom (bytes): The DICOM instance to be matched.
2294
2295 Returns:
2296 int: 1 if the DICOM instance matches the query, 0 otherwise.
2297 """
2298 ...
2299
2300 class FindQuery:
2301 ...
2302
2303 # This function returns the number of tags that are contained in the given C-Find query
2304 def GetFindQuerySize(self) -> int:
2305 """
2306 This function returns the number of tags that are contained in the given C-Find query.
2307
2308 Returns:
2309 int: The number of tags.
2310 """
2311 ...
2312 # This function returns the symbolic name of one DICOM tag in the given C-Find query
2313 def GetFindQueryTagName(self, index: int) -> str:
2314 """
2315 This function returns the symbolic name of one DICOM tag in the given C-Find query.
2316
2317 Args:
2318 index (int): The index of the tag of interest.
2319
2320 Returns:
2321 str: 0 if success, other value if error.
2322 """
2323 ...
2324 # This function returns the value associated with one tag in the given C-Find query
2325 def GetFindQueryValue(self, index: int) -> str:
2326 """
2327 This function returns the value associated with one tag in the given C-Find query.
2328
2329 Args:
2330 index (int): The index of the tag of interest.
2331
2332 Returns:
2333 str: 0 if success, other value if error.
2334 """
2335 ...
2336
2337 # This function returns the group of one DICOM tag in the given C-Find query
2338 def GetFindQueryTagGroup(self, index: int) -> int:
2339 """
2340 This function returns the group of one DICOM tag in the given C-Find query.
2341
2342 Args:
2343 index (int): The index of the tag of interest.
2344
2345 Returns:
2346 int: The value of the group.
2347 """
2348 ...
2349 # This function returns the element of one DICOM tag in the given C-Find query
2350 def GetFindQueryTagElement(self, index: int) -> int:
2351 """
2352 This function returns the element of one DICOM tag in the given C-Find query.
2353
2354 Args:
2355 index (int): The index of the tag of interest.
2356
2357 Returns:
2358 int: The value of the element.
2359 """
2360 ...
2361 class Image:
2362 ...
2363
2364 # This function returns the type of memory layout for the pixels of the given image
2365 def GetImagePixelFormat(self) -> PixelFormat:
2366 """
2367 This function returns the type of memory layout for the pixels of the given image.
2368
2369 Returns:
2370 PixelFormat: The pixel format.
2371 """
2372 ...
2373 # This function returns the width of the given image
2374 def GetImageWidth(self) -> int:
2375 """
2376 This function returns the width of the given image.
2377
2378 Returns:
2379 int: The width.
2380 """
2381 ...
2382 # This function returns the height of the given image
2383 def GetImageHeight(self) -> int:
2384 """
2385 This function returns the height of the given image.
2386
2387 Returns:
2388 int: The height.
2389 """
2390 ...
2391 # This function returns the pitch of the given image
2392 def GetImagePitch(self) -> int:
2393 """
2394 This function returns the pitch of the given image. The pitch is defined as the number of bytes between 2 successive lines of the image in the memory buffer.
2395
2396 Returns:
2397 int: The pitch.
2398 """
2399 ...
2400 # This function creates a new image, changing the memory layout of the pixels
2401 def ConvertPixelFormat(self, target_format: PixelFormat) -> Image:
2402 """
2403 This function creates a new image, changing the memory layout of the pixels.
2404
2405 Args:
2406 target_format (PixelFormat): The target pixel format.
2407
2408 Returns:
2409 Image: The resulting image. It must be freed with OrthancPluginFreeImage().
2410 """
2411 ...
2412 # This function draws some text on some image
2413 def DrawText(self, font_index: int, utf8_text: str, x: int, y: int, r: int, g: int, b: int) -> None:
2414 """
2415 This function draws some text on some image.
2416
2417 Args:
2418 font_index (int): The index of the font. This value must be less than OrthancPluginGetFontsCount().
2419 utf8_text (str): The text to be drawn, encoded as an UTF-8 zero-terminated string.
2420 x (int): The X position of the text over the image.
2421 y (int): The Y position of the text over the image.
2422 r (int): The value of the red color channel of the text.
2423 g (int): The value of the green color channel of the text.
2424 b (int): The value of the blue color channel of the text.
2425 """
2426 ...
2427
2428 # This function returns a pointer to the memory buffer that contains the pixels of the image
2429 def GetImageBuffer(self) -> bytes:
2430 """
2431 This function returns a pointer to the memory buffer that contains the pixels of the image.
2432
2433 Returns:
2434 bytes: The pixel data.
2435 """
2436 ...
2437 class Job:
2438 ...
2439
2440 # This function adds the given job to the pending jobs of Orthanc
2441 def SubmitJob(self, priority: int) -> str:
2442 """
2443 This function adds the given job to the pending jobs of Orthanc. Orthanc will take take of freeing it by invoking the finalization callback provided to OrthancPluginCreateJob().
2444
2445 Args:
2446 priority (int): The priority of the job.
2447
2448 Returns:
2449 str: ID of the newly-submitted job. This string must be freed by OrthancPluginFreeString().
2450 """
2451 ...
2452
2453 class Peers:
2454 ...
2455
2456 # This function returns the number of Orthanc peers
2457 def GetPeersCount(self) -> int:
2458 """
2459 This function returns the number of Orthanc peers.
2460 This function is thread-safe: Several threads sharing the same OrthancPluginPeers object can simultaneously call this function.
2461
2462 Returns:
2463 int: The number of peers.
2464 """
2465 ...
2466 # This function returns the symbolic name of the Orthanc peer, which corresponds to the key of the "OrthancPeers" configuration option of Orthanc
2467 def GetPeerName(self, peer_index: int) -> str:
2468 """
2469 This function returns the symbolic name of the Orthanc peer, which corresponds to the key of the "OrthancPeers" configuration option of Orthanc.
2470 This function is thread-safe: Several threads sharing the same OrthancPluginPeers object can simultaneously call this function.
2471
2472 Args:
2473 peer_index (int): The index of the peer of interest. This value must be lower than OrthancPluginGetPeersCount().
2474
2475 Returns:
2476 str: The symbolic name, or NULL in the case of an error.
2477 """
2478 ...
2479 # This function returns the base URL to the REST API of some Orthanc peer
2480 def GetPeerUrl(self, peer_index: int) -> str:
2481 """
2482 This function returns the base URL to the REST API of some Orthanc peer.
2483 This function is thread-safe: Several threads sharing the same OrthancPluginPeers object can simultaneously call this function.
2484
2485 Args:
2486 peer_index (int): The index of the peer of interest. This value must be lower than OrthancPluginGetPeersCount().
2487
2488 Returns:
2489 str: The URL, or NULL in the case of an error.
2490 """
2491 ...
2492 # This function returns some user-defined property of some Orthanc peer
2493 def GetPeerUserProperty(self, peer_index: int, user_property: str) -> str:
2494 """
2495 This function returns some user-defined property of some Orthanc peer. An user-defined property is a property that is associated with the peer in the Orthanc configuration file, but that is not recognized by the Orthanc core.
2496 This function is thread-safe: Several threads sharing the same OrthancPluginPeers object can simultaneously call this function.
2497
2498 Args:
2499 peer_index (int): The index of the peer of interest. This value must be lower than OrthancPluginGetPeersCount().
2500 user_property (str): The user property of interest.
2501
2502 Returns:
2503 str: The value of the user property, or NULL if it is not defined.
2504 """
2505 ...
2506
2507 class RestOutput:
2508 ...
2509
2510 # This function answers to a REST request with the content of a memory buffer
2511 def AnswerBuffer(self, answer: bytes, mime_type: str) -> None:
2512 """
2513 This function answers to a REST request with the content of a memory buffer.
2514
2515 Args:
2516 answer (bytes): Pointer to the memory buffer containing the answer.
2517 mime_type (str): The MIME type of the answer.
2518 """
2519 ...
2520 # This function answers to a REST request with a PNG image
2521 def CompressAndAnswerPngImage(self, format: PixelFormat, width: int, height: int, pitch: int, buffer: bytes) -> None:
2522 """
2523 This function answers to a REST request with a PNG image. The parameters of this function describe a memory buffer that contains an uncompressed image. The image will be automatically compressed as a PNG image by the core system of Orthanc.
2524
2525 Args:
2526 format (PixelFormat): The memory layout of the uncompressed image.
2527 width (int): The width of the image.
2528 height (int): The height of the image.
2529 pitch (int): The pitch of the image (i.e. the number of bytes between 2 successive lines of the image in the memory buffer).
2530 buffer (bytes): The memory buffer containing the uncompressed image.
2531 """
2532 ...
2533 # This function answers to a REST request by redirecting the user to another URI using HTTP status 301
2534 def Redirect(self, redirection: str) -> None:
2535 """
2536 This function answers to a REST request by redirecting the user to another URI using HTTP status 301.
2537
2538 Args:
2539 redirection (str): Where to redirect.
2540 """
2541 ...
2542 # This function answers to a REST request by sending a HTTP status code (such as "400 - Bad Request")
2543 def SendHttpStatusCode(self, status: int) -> None:
2544 """
2545 This function answers to a REST request by sending a HTTP status code (such as "400 - Bad Request"). Note that: - Successful requests (status 200) must use ::OrthancPluginAnswerBuffer(). - Redirections (status 301) must use ::OrthancPluginRedirect(). - Unauthorized access (status 401) must use ::OrthancPluginSendUnauthorized(). - Methods not allowed (status 405) must use ::OrthancPluginSendMethodNotAllowed().
2546
2547 Args:
2548 status (int): The HTTP status code to be sent.
2549 """
2550 ...
2551 # This function answers to a REST request by signaling that it is not authorized
2552 def SendUnauthorized(self, realm: str) -> None:
2553 """
2554 This function answers to a REST request by signaling that it is not authorized.
2555
2556 Args:
2557 realm (str): The realm for the authorization process.
2558 """
2559 ...
2560 # This function answers to a REST request by signaling that the queried URI does not support this method
2561 def SendMethodNotAllowed(self, allowed_methods: str) -> None:
2562 """
2563 This function answers to a REST request by signaling that the queried URI does not support this method.
2564
2565 Args:
2566 allowed_methods (str): The allowed methods for this URI (e.g. "GET,POST" after a PUT or a POST request).
2567 """
2568 ...
2569 # This function sets a cookie in the HTTP client
2570 def SetCookie(self, cookie: str, value: str) -> None:
2571 """
2572 This function sets a cookie in the HTTP client.
2573
2574 Args:
2575 cookie (str): The cookie to be set.
2576 value (str): The value of the cookie.
2577 """
2578 ...
2579 # This function sets a HTTP header in the HTTP answer
2580 def SetHttpHeader(self, key: str, value: str) -> None:
2581 """
2582 This function sets a HTTP header in the HTTP answer.
2583
2584 Args:
2585 key (str): The HTTP header to be set.
2586 value (str): The value of the HTTP header.
2587 """
2588 ...
2589 # Initiates a HTTP multipart answer, as the result of a REST request
2590 def StartMultipartAnswer(self, sub_type: str, content_type: str) -> None:
2591 """
2592 Initiates a HTTP multipart answer, as the result of a REST request.
2593
2594 Args:
2595 sub_type (str): The sub-type of the multipart answer ("mixed" or "related").
2596 content_type (str): The MIME type of the items in the multipart answer.
2597 """
2598 ...
2599 # This function sends an item as a part of some HTTP multipart answer that was initiated by OrthancPluginStartMultipartAnswer()
2600 def SendMultipartItem(self, answer: bytes) -> None:
2601 """
2602 This function sends an item as a part of some HTTP multipart answer that was initiated by OrthancPluginStartMultipartAnswer().
2603
2604 Args:
2605 answer (bytes): Pointer to the memory buffer containing the item.
2606 """
2607 ...
2608 # This function answers to a HTTP request by sending a HTTP status code (such as "400 - Bad Request"), together with a body describing the error
2609 def SendHttpStatus(self, status: int, body: bytes) -> None:
2610 """
2611 This function answers to a HTTP request by sending a HTTP status code (such as "400 - Bad Request"), together with a body describing the error. The body will only be returned if the configuration option "HttpDescribeErrors" of Orthanc is set to "true".
2612 Note that: - Successful requests (status 200) must use ::OrthancPluginAnswerBuffer(). - Redirections (status 301) must use ::OrthancPluginRedirect(). - Unauthorized access (status 401) must use ::OrthancPluginSendUnauthorized(). - Methods not allowed (status 405) must use ::OrthancPluginSendMethodNotAllowed().
2613
2614 Args:
2615 status (int): The HTTP status code to be sent.
2616 body (bytes): The body of the answer.
2617 """
2618 ...
2619 # This function answers to a REST request with a JPEG image
2620 def CompressAndAnswerJpegImage(self, format: PixelFormat, width: int, height: int, pitch: int, buffer: bytes, quality: int) -> None:
2621 """
2622 This function answers to a REST request with a JPEG image. The parameters of this function describe a memory buffer that contains an uncompressed image. The image will be automatically compressed as a JPEG image by the core system of Orthanc.
2623
2624 Args:
2625 format (PixelFormat): The memory layout of the uncompressed image.
2626 width (int): The width of the image.
2627 height (int): The height of the image.
2628 pitch (int): The pitch of the image (i.e. the number of bytes between 2 successive lines of the image in the memory buffer).
2629 buffer (bytes): The memory buffer containing the uncompressed image.
2630 quality (int): The quality of the JPEG encoding, between 1 (worst quality, best compression) and 100 (best quality, worst compression).
2631 """
2632 ...
2633 # This function sets the detailed description associated with an HTTP error
2634 def SetHttpErrorDetails(self, details: str, log: int) -> None:
2635 """
2636 This function sets the detailed description associated with an HTTP error. This description will be displayed in the "Details" field of the JSON body of the HTTP answer. It is only taken into consideration if the REST callback returns an error code that is different from "OrthancPluginErrorCode_Success", and if the "HttpDescribeErrors" configuration option of Orthanc is set to "true".
2637
2638 Args:
2639 details (str): The details of the error message.
2640 log (int): Whether to also write the detailed error to the Orthanc logs.
2641 """
2642 ...
2643
2644 class ServerChunkedRequestReader:
2645 ...
2646
2647
2648 class StorageArea:
2649 ...
2650
2651 # This function creates a new file inside the storage area that is currently used by Orthanc
2652 def StorageAreaCreate(self, uuid: str, content: bytes, size: int, type: ContentType) -> None:
2653 """
2654 This function creates a new file inside the storage area that is currently used by Orthanc.
2655
2656 Args:
2657 uuid (str): The identifier of the file to be created.
2658 content (bytes): The content to store in the newly created file.
2659 size (int): The size of the content.
2660 type (ContentType): The type of the file content.
2661 """
2662 ...
2663 # This function reads the content of a given file from the storage area that is currently used by Orthanc
2664 def StorageAreaRead(self, uuid: str, type: ContentType) -> bytes:
2665 """
2666 This function reads the content of a given file from the storage area that is currently used by Orthanc.
2667
2668 Args:
2669 uuid (str): The identifier of the file to be read.
2670 type (ContentType): The type of the file content.
2671
2672 Returns:
2673 bytes: 0 if success, other value if error.
2674 """
2675 ...
2676 # This function removes a given file from the storage area that is currently used by Orthanc
2677 def StorageAreaRemove(self, uuid: str, type: ContentType) -> None:
2678 """
2679 This function removes a given file from the storage area that is currently used by Orthanc.
2680
2681 Args:
2682 uuid (str): The identifier of the file to be removed.
2683 type (ContentType): The type of the file content.
2684 """
2685 ...
2686 # This function requests the Orthanc core to reconstruct the main DICOM tags of all the resources of the given type
2687 def ReconstructMainDicomTags(self, level: ResourceType) -> None:
2688 """
2689 This function requests the Orthanc core to reconstruct the main DICOM tags of all the resources of the given type. This function can only be used as a part of the upgrade of a custom database back-end. A database transaction will be automatically setup.
2690
2691 Args:
2692 level (ResourceType): The type of the resources of interest.
2693 """
2694 ...
2695
2696 class WorklistAnswers:
2697 ...
2698
2699 # This function adds one worklist (encoded as a DICOM file) to the set of answers corresponding to some C-Find SCP request against modality worklists
2700 def WorklistAddAnswer(self, query: WorklistQuery, dicom: bytes) -> None:
2701 """
2702 This function adds one worklist (encoded as a DICOM file) to the set of answers corresponding to some C-Find SCP request against modality worklists.
2703
2704 Args:
2705 query (WorklistQuery): The worklist query, as received by the callback.
2706 dicom (bytes): The worklist to answer, encoded as a DICOM file.
2707 """
2708 ...
2709 # This function marks as incomplete the set of answers corresponding to some C-Find SCP request against modality worklists
2710 def WorklistMarkIncomplete(self) -> None:
2711 """
2712 This function marks as incomplete the set of answers corresponding to some C-Find SCP request against modality worklists. This must be used if canceling the handling of a request when too many answers are to be returned.
2713 """
2714 ...
2715
2716 class WorklistQuery:
2717 ...
2718
2719 # This function checks whether one worklist (encoded as a DICOM file) matches the C-Find SCP query against modality worklists
2720 def WorklistIsMatch(self, dicom: bytes) -> int:
2721 """
2722 This function checks whether one worklist (encoded as a DICOM file) matches the C-Find SCP query against modality worklists. This function must be called before adding the worklist as an answer through OrthancPluginWorklistAddAnswer().
2723
2724 Args:
2725 dicom (bytes): The worklist to answer, encoded as a DICOM file.
2726
2727 Returns:
2728 int: 1 if the worklist matches the query, 0 otherwise.
2729 """
2730 ...
2731 # This function retrieves the DICOM file that underlies a C-Find SCP query against modality worklists
2732 def WorklistGetDicomQuery(self) -> bytes:
2733 """
2734 This function retrieves the DICOM file that underlies a C-Find SCP query against modality worklists.
2735
2736 Returns:
2737 bytes: 0 if success, other value if error.
2738 """
2739 ...
2740