-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathOrthancCPlugin.h
16152 lines (7526 loc) · 314 KB
/
OrthancCPlugin.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* \mainpage
*
* This C/C++ SDK allows external developers to create plugins that
* can be loaded into Orthanc to extend its functionality. Each
* Orthanc plugin must expose 4 public functions with the following
* signatures:
*
* -# <tt>int32_t OrthancPluginInitialize(const OrthancPluginContext* context)</tt>:
* This function is invoked by Orthanc when it loads the plugin on startup.
* The plugin must:
* - Check its compatibility with the Orthanc version using
* ::OrthancPluginCheckVersion().
* - Store the context pointer so that it can use the plugin
* services of Orthanc.
* - Register all its REST callbacks using ::OrthancPluginRegisterRestCallback().
* - Possibly register its callback for received DICOM instances using ::OrthancPluginRegisterOnStoredInstanceCallback().
* - Possibly register its callback for changes to the DICOM store using ::OrthancPluginRegisterOnChangeCallback().
* - Possibly register a custom storage area using ::OrthancPluginRegisterStorageArea2().
* - Possibly register a custom database back-end area using OrthancPluginRegisterDatabaseBackendV3().
* - Possibly register a handler for C-Find SCP using OrthancPluginRegisterFindCallback().
* - Possibly register a handler for C-Find SCP against DICOM worklists using OrthancPluginRegisterWorklistCallback().
* - Possibly register a handler for C-Move SCP using OrthancPluginRegisterMoveCallback().
* - Possibly register a custom decoder for DICOM images using OrthancPluginRegisterDecodeImageCallback().
* - Possibly register a callback to filter incoming HTTP requests using OrthancPluginRegisterIncomingHttpRequestFilter2().
* - Possibly register a callback to unserialize jobs using OrthancPluginRegisterJobsUnserializer().
* - Possibly register a callback to refresh its metrics using OrthancPluginRegisterRefreshMetricsCallback().
* - Possibly register a callback to answer chunked HTTP transfers using ::OrthancPluginRegisterChunkedRestCallback().
* - Possibly register a callback for Storage Commitment SCP using ::OrthancPluginRegisterStorageCommitmentScpCallback().
* - Possibly register a callback to filter incoming DICOM instance using OrthancPluginRegisterIncomingDicomInstanceFilter().
* - Possibly register a custom transcoder for DICOM images using OrthancPluginRegisterTranscoderCallback().
* -# <tt>void OrthancPluginFinalize()</tt>:
* This function is invoked by Orthanc during its shutdown. The plugin
* must free all its memory.
* -# <tt>const char* OrthancPluginGetName()</tt>:
* The plugin must return a short string to identify itself.
* -# <tt>const char* OrthancPluginGetVersion()</tt>:
* The plugin must return a string containing its version number.
*
* The name and the version of a plugin is only used to prevent it
* from being loaded twice. Note that, in C++, it is mandatory to
* declare these functions within an <tt>extern "C"</tt> section.
*
* To ensure multi-threading safety, the various REST callbacks are
* guaranteed to be executed in mutual exclusion since Orthanc
* 0.8.5. If this feature is undesired (notably when developing
* high-performance plugins handling simultaneous requests), use
* ::OrthancPluginRegisterRestCallbackNoLock().
**/
/**
* @defgroup Images Images and compression
* @brief Functions to deal with images and compressed buffers.
*
* @defgroup REST REST
* @brief Functions to answer REST requests in a callback.
*
* @defgroup Callbacks Callbacks
* @brief Functions to register and manage callbacks by the plugins.
*
* @defgroup DicomCallbacks DicomCallbacks
* @brief Functions to register and manage DICOM callbacks (worklists, C-FIND, C-MOVE, storage commitment).
*
* @defgroup Orthanc Orthanc
* @brief Functions to access the content of the Orthanc server.
*
* @defgroup DicomInstance DicomInstance
* @brief Functions to access DICOM images that are managed by the Orthanc core.
**/
/**
* @defgroup Toolbox Toolbox
* @brief Generic functions to help with the creation of plugins.
**/
/**
* Orthanc - A Lightweight, RESTful DICOM Store
* Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
* Department, University Hospital of Liege, Belgium
* Copyright (C) 2017-2021 Osimis S.A., Belgium
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#pragma once
#include <stdio.h>
#include <string.h>
#ifdef WIN32
# define ORTHANC_PLUGINS_API __declspec(dllexport)
#elif __GNUC__ >= 4
# define ORTHANC_PLUGINS_API __attribute__ ((visibility ("default")))
#else
# define ORTHANC_PLUGINS_API
#endif
#define ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER 1
#define ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER 9
#define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER 2
#if !defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)
#define ORTHANC_PLUGINS_VERSION_IS_ABOVE(major, minor, revision) \
(ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER > major || \
(ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER == major && \
(ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER > minor || \
(ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER == minor && \
ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER >= revision))))
#endif
/********************************************************************
** Check that function inlining is properly supported. The use of
** inlining is required, to avoid the duplication of object code
** between two compilation modules that would use the Orthanc Plugin
** API.
********************************************************************/
/* If the auto-detection of the "inline" keyword below does not work
automatically and that your compiler is known to properly support
inlining, uncomment the following #define and adapt the definition
of "static inline". */
/* #define ORTHANC_PLUGIN_INLINE static inline */
#ifndef ORTHANC_PLUGIN_INLINE
# if __STDC_VERSION__ >= 199901L
/* This is C99 or above: http://predef.sourceforge.net/prestd.html */
# define ORTHANC_PLUGIN_INLINE static inline
# elif defined(__cplusplus)
/* This is C++ */
# define ORTHANC_PLUGIN_INLINE static inline
# elif defined(__GNUC__)
/* This is GCC running in C89 mode */
# define ORTHANC_PLUGIN_INLINE static __inline
# elif defined(_MSC_VER)
/* This is Visual Studio running in C89 mode */
# define ORTHANC_PLUGIN_INLINE static __inline
# else
# error Your compiler is not known to support the "inline" keyword
# endif
#endif
/********************************************************************
** Inclusion of standard libraries.
********************************************************************/
/**
* For Microsoft Visual Studio, a compatibility "stdint.h" can be
* downloaded at the following URL:
* https://hg.orthanc-server.com/orthanc/raw-file/tip/Resources/ThirdParty/VisualStudio/stdint.h
**/
#include <stdint.h>
#include <stdlib.h>
/********************************************************************
** Definition of the Orthanc Plugin API.
********************************************************************/
/** @{ */
#ifdef __cplusplus
extern "C"
{
#endif
/**
* The various error codes that can be returned by the Orthanc core.
**/
typedef enum
{
OrthancPluginErrorCode_InternalError = -1 /*!< Internal error */,
OrthancPluginErrorCode_Success = 0 /*!< Success */,
OrthancPluginErrorCode_Plugin = 1 /*!< Error encountered within the plugin engine */,
OrthancPluginErrorCode_NotImplemented = 2 /*!< Not implemented yet */,
OrthancPluginErrorCode_ParameterOutOfRange = 3 /*!< Parameter out of range */,
OrthancPluginErrorCode_NotEnoughMemory = 4 /*!< The server hosting Orthanc is running out of memory */,
OrthancPluginErrorCode_BadParameterType = 5 /*!< Bad type for a parameter */,
OrthancPluginErrorCode_BadSequenceOfCalls = 6 /*!< Bad sequence of calls */,
OrthancPluginErrorCode_InexistentItem = 7 /*!< Accessing an inexistent item */,
OrthancPluginErrorCode_BadRequest = 8 /*!< Bad request */,
OrthancPluginErrorCode_NetworkProtocol = 9 /*!< Error in the network protocol */,
OrthancPluginErrorCode_SystemCommand = 10 /*!< Error while calling a system command */,
OrthancPluginErrorCode_Database = 11 /*!< Error with the database engine */,
OrthancPluginErrorCode_UriSyntax = 12 /*!< Badly formatted URI */,
OrthancPluginErrorCode_InexistentFile = 13 /*!< Inexistent file */,
OrthancPluginErrorCode_CannotWriteFile = 14 /*!< Cannot write to file */,
OrthancPluginErrorCode_BadFileFormat = 15 /*!< Bad file format */,
OrthancPluginErrorCode_Timeout = 16 /*!< Timeout */,
OrthancPluginErrorCode_UnknownResource = 17 /*!< Unknown resource */,
OrthancPluginErrorCode_IncompatibleDatabaseVersion = 18 /*!< Incompatible version of the database */,
OrthancPluginErrorCode_FullStorage = 19 /*!< The file storage is full */,
OrthancPluginErrorCode_CorruptedFile = 20 /*!< Corrupted file (e.g. inconsistent MD5 hash) */,
OrthancPluginErrorCode_InexistentTag = 21 /*!< Inexistent tag */,
OrthancPluginErrorCode_ReadOnly = 22 /*!< Cannot modify a read-only data structure */,
OrthancPluginErrorCode_IncompatibleImageFormat = 23 /*!< Incompatible format of the images */,
OrthancPluginErrorCode_IncompatibleImageSize = 24 /*!< Incompatible size of the images */,
OrthancPluginErrorCode_SharedLibrary = 25 /*!< Error while using a shared library (plugin) */,
OrthancPluginErrorCode_UnknownPluginService = 26 /*!< Plugin invoking an unknown service */,
OrthancPluginErrorCode_UnknownDicomTag = 27 /*!< Unknown DICOM tag */,
OrthancPluginErrorCode_BadJson = 28 /*!< Cannot parse a JSON document */,
OrthancPluginErrorCode_Unauthorized = 29 /*!< Bad credentials were provided to an HTTP request */,
OrthancPluginErrorCode_BadFont = 30 /*!< Badly formatted font file */,
OrthancPluginErrorCode_DatabasePlugin = 31 /*!< The plugin implementing a custom database back-end does not fulfill the proper interface */,
OrthancPluginErrorCode_StorageAreaPlugin = 32 /*!< Error in the plugin implementing a custom storage area */,
OrthancPluginErrorCode_EmptyRequest = 33 /*!< The request is empty */,
OrthancPluginErrorCode_NotAcceptable = 34 /*!< Cannot send a response which is acceptable according to the Accept HTTP header */,
OrthancPluginErrorCode_NullPointer = 35 /*!< Cannot handle a NULL pointer */,
OrthancPluginErrorCode_DatabaseUnavailable = 36 /*!< The database is currently not available (probably a transient situation) */,
OrthancPluginErrorCode_CanceledJob = 37 /*!< This job was canceled */,
OrthancPluginErrorCode_BadGeometry = 38 /*!< Geometry error encountered in Stone */,
OrthancPluginErrorCode_SslInitialization = 39 /*!< Cannot initialize SSL encryption, check out your certificates */,
OrthancPluginErrorCode_DiscontinuedAbi = 40 /*!< Calling a function that has been removed from the Orthanc Framework */,
OrthancPluginErrorCode_BadRange = 41 /*!< Incorrect range request */,
OrthancPluginErrorCode_DatabaseCannotSerialize = 42 /*!< Database could not serialize access due to concurrent update, the transaction should be retried */,
OrthancPluginErrorCode_Revision = 43 /*!< A bad revision number was provided, which might indicate conflict between multiple writers */,
OrthancPluginErrorCode_SQLiteNotOpened = 1000 /*!< SQLite: The database is not opened */,
OrthancPluginErrorCode_SQLiteAlreadyOpened = 1001 /*!< SQLite: Connection is already open */,
OrthancPluginErrorCode_SQLiteCannotOpen = 1002 /*!< SQLite: Unable to open the database */,
OrthancPluginErrorCode_SQLiteStatementAlreadyUsed = 1003 /*!< SQLite: This cached statement is already being referred to */,
OrthancPluginErrorCode_SQLiteExecute = 1004 /*!< SQLite: Cannot execute a command */,
OrthancPluginErrorCode_SQLiteRollbackWithoutTransaction = 1005 /*!< SQLite: Rolling back a nonexistent transaction (have you called Begin()?) */,
OrthancPluginErrorCode_SQLiteCommitWithoutTransaction = 1006 /*!< SQLite: Committing a nonexistent transaction */,
OrthancPluginErrorCode_SQLiteRegisterFunction = 1007 /*!< SQLite: Unable to register a function */,
OrthancPluginErrorCode_SQLiteFlush = 1008 /*!< SQLite: Unable to flush the database */,
OrthancPluginErrorCode_SQLiteCannotRun = 1009 /*!< SQLite: Cannot run a cached statement */,
OrthancPluginErrorCode_SQLiteCannotStep = 1010 /*!< SQLite: Cannot step over a cached statement */,
OrthancPluginErrorCode_SQLiteBindOutOfRange = 1011 /*!< SQLite: Bing a value while out of range (serious error) */,
OrthancPluginErrorCode_SQLitePrepareStatement = 1012 /*!< SQLite: Cannot prepare a cached statement */,
OrthancPluginErrorCode_SQLiteTransactionAlreadyStarted = 1013 /*!< SQLite: Beginning the same transaction twice */,
OrthancPluginErrorCode_SQLiteTransactionCommit = 1014 /*!< SQLite: Failure when committing the transaction */,
OrthancPluginErrorCode_SQLiteTransactionBegin = 1015 /*!< SQLite: Cannot start a transaction */,
OrthancPluginErrorCode_DirectoryOverFile = 2000 /*!< The directory to be created is already occupied by a regular file */,
OrthancPluginErrorCode_FileStorageCannotWrite = 2001 /*!< Unable to create a subdirectory or a file in the file storage */,
OrthancPluginErrorCode_DirectoryExpected = 2002 /*!< The specified path does not point to a directory */,
OrthancPluginErrorCode_HttpPortInUse = 2003 /*!< The TCP port of the HTTP server is privileged or already in use */,
OrthancPluginErrorCode_DicomPortInUse = 2004 /*!< The TCP port of the DICOM server is privileged or already in use */,
OrthancPluginErrorCode_BadHttpStatusInRest = 2005 /*!< This HTTP status is not allowed in a REST API */,
OrthancPluginErrorCode_RegularFileExpected = 2006 /*!< The specified path does not point to a regular file */,
OrthancPluginErrorCode_PathToExecutable = 2007 /*!< Unable to get the path to the executable */,
OrthancPluginErrorCode_MakeDirectory = 2008 /*!< Cannot create a directory */,
OrthancPluginErrorCode_BadApplicationEntityTitle = 2009 /*!< An application entity title (AET) cannot be empty or be longer than 16 characters */,
OrthancPluginErrorCode_NoCFindHandler = 2010 /*!< No request handler factory for DICOM C-FIND SCP */,
OrthancPluginErrorCode_NoCMoveHandler = 2011 /*!< No request handler factory for DICOM C-MOVE SCP */,
OrthancPluginErrorCode_NoCStoreHandler = 2012 /*!< No request handler factory for DICOM C-STORE SCP */,
OrthancPluginErrorCode_NoApplicationEntityFilter = 2013 /*!< No application entity filter */,
OrthancPluginErrorCode_NoSopClassOrInstance = 2014 /*!< DicomUserConnection: Unable to find the SOP class and instance */,
OrthancPluginErrorCode_NoPresentationContext = 2015 /*!< DicomUserConnection: No acceptable presentation context for modality */,
OrthancPluginErrorCode_DicomFindUnavailable = 2016 /*!< DicomUserConnection: The C-FIND command is not supported by the remote SCP */,
OrthancPluginErrorCode_DicomMoveUnavailable = 2017 /*!< DicomUserConnection: The C-MOVE command is not supported by the remote SCP */,
OrthancPluginErrorCode_CannotStoreInstance = 2018 /*!< Cannot store an instance */,
OrthancPluginErrorCode_CreateDicomNotString = 2019 /*!< Only string values are supported when creating DICOM instances */,
OrthancPluginErrorCode_CreateDicomOverrideTag = 2020 /*!< Trying to override a value inherited from a parent module */,
OrthancPluginErrorCode_CreateDicomUseContent = 2021 /*!< Use \"Content\" to inject an image into a new DICOM instance */,
OrthancPluginErrorCode_CreateDicomNoPayload = 2022 /*!< No payload is present for one instance in the series */,
OrthancPluginErrorCode_CreateDicomUseDataUriScheme = 2023 /*!< The payload of the DICOM instance must be specified according to Data URI scheme */,
OrthancPluginErrorCode_CreateDicomBadParent = 2024 /*!< Trying to attach a new DICOM instance to an inexistent resource */,
OrthancPluginErrorCode_CreateDicomParentIsInstance = 2025 /*!< Trying to attach a new DICOM instance to an instance (must be a series, study or patient) */,
OrthancPluginErrorCode_CreateDicomParentEncoding = 2026 /*!< Unable to get the encoding of the parent resource */,
OrthancPluginErrorCode_UnknownModality = 2027 /*!< Unknown modality */,
OrthancPluginErrorCode_BadJobOrdering = 2028 /*!< Bad ordering of filters in a job */,
OrthancPluginErrorCode_JsonToLuaTable = 2029 /*!< Cannot convert the given JSON object to a Lua table */,
OrthancPluginErrorCode_CannotCreateLua = 2030 /*!< Cannot create the Lua context */,
OrthancPluginErrorCode_CannotExecuteLua = 2031 /*!< Cannot execute a Lua command */,
OrthancPluginErrorCode_LuaAlreadyExecuted = 2032 /*!< Arguments cannot be pushed after the Lua function is executed */,
OrthancPluginErrorCode_LuaBadOutput = 2033 /*!< The Lua function does not give the expected number of outputs */,
OrthancPluginErrorCode_NotLuaPredicate = 2034 /*!< The Lua function is not a predicate (only true/false outputs allowed) */,
OrthancPluginErrorCode_LuaReturnsNoString = 2035 /*!< The Lua function does not return a string */,
OrthancPluginErrorCode_StorageAreaAlreadyRegistered = 2036 /*!< Another plugin has already registered a custom storage area */,
OrthancPluginErrorCode_DatabaseBackendAlreadyRegistered = 2037 /*!< Another plugin has already registered a custom database back-end */,
OrthancPluginErrorCode_DatabaseNotInitialized = 2038 /*!< Plugin trying to call the database during its initialization */,
OrthancPluginErrorCode_SslDisabled = 2039 /*!< Orthanc has been built without SSL support */,
OrthancPluginErrorCode_CannotOrderSlices = 2040 /*!< Unable to order the slices of the series */,
OrthancPluginErrorCode_NoWorklistHandler = 2041 /*!< No request handler factory for DICOM C-Find Modality SCP */,
OrthancPluginErrorCode_AlreadyExistingTag = 2042 /*!< Cannot override the value of a tag that already exists */,
OrthancPluginErrorCode_NoStorageCommitmentHandler = 2043 /*!< No request handler factory for DICOM N-ACTION SCP (storage commitment) */,
OrthancPluginErrorCode_NoCGetHandler = 2044 /*!< No request handler factory for DICOM C-GET SCP */,
OrthancPluginErrorCode_UnsupportedMediaType = 3000 /*!< Unsupported media type */,
_OrthancPluginErrorCode_INTERNAL = 0x7fffffff
} OrthancPluginErrorCode;
/**
* Forward declaration of one of the mandatory functions for Orthanc
* plugins.
**/
ORTHANC_PLUGINS_API const char* OrthancPluginGetName();
/**
* The various HTTP methods for a REST call.
**/
typedef enum
{
OrthancPluginHttpMethod_Get = 1, /*!< GET request */
OrthancPluginHttpMethod_Post = 2, /*!< POST request */
OrthancPluginHttpMethod_Put = 3, /*!< PUT request */
OrthancPluginHttpMethod_Delete = 4, /*!< DELETE request */
_OrthancPluginHttpMethod_INTERNAL = 0x7fffffff
} OrthancPluginHttpMethod;
/**
* @brief The parameters of a REST request.
* @ingroup Callbacks
**/
typedef struct
{
/**
* @brief The HTTP method.
**/
OrthancPluginHttpMethod method;
/**
* @brief The number of groups of the regular expression.
**/
uint32_t groupsCount;
/**
* @brief The matched values for the groups of the regular expression.
**/
const char* const* groups;
/**
* @brief For a GET request, the number of GET parameters.
**/
uint32_t getCount;
/**
* @brief For a GET request, the keys of the GET parameters.
**/
const char* const* getKeys;
/**
* @brief For a GET request, the values of the GET parameters.
**/
const char* const* getValues;
/**
* @brief For a PUT or POST request, the content of the body.
**/
const void* body;
/**
* @brief For a PUT or POST request, the number of bytes of the body.
**/
uint32_t bodySize;
/* --------------------------------------------------
New in version 0.8.1
-------------------------------------------------- */
/**
* @brief The number of HTTP headers.
**/
uint32_t headersCount;
/**
* @brief The keys of the HTTP headers (always converted to low-case).
**/
const char* const* headersKeys;
/**
* @brief The values of the HTTP headers.
**/
const char* const* headersValues;
} OrthancPluginHttpRequest;
typedef enum
{
/* Generic services */
_OrthancPluginService_LogInfo = 1,
_OrthancPluginService_LogWarning = 2,
_OrthancPluginService_LogError = 3,
_OrthancPluginService_GetOrthancPath = 4,
_OrthancPluginService_GetOrthancDirectory = 5,
_OrthancPluginService_GetConfigurationPath = 6,
_OrthancPluginService_SetPluginProperty = 7,
_OrthancPluginService_GetGlobalProperty = 8,
_OrthancPluginService_SetGlobalProperty = 9,
_OrthancPluginService_GetCommandLineArgumentsCount = 10,
_OrthancPluginService_GetCommandLineArgument = 11,
_OrthancPluginService_GetExpectedDatabaseVersion = 12,
_OrthancPluginService_GetConfiguration = 13,
_OrthancPluginService_BufferCompression = 14,
_OrthancPluginService_ReadFile = 15,
_OrthancPluginService_WriteFile = 16,
_OrthancPluginService_GetErrorDescription = 17,
_OrthancPluginService_CallHttpClient = 18,
_OrthancPluginService_RegisterErrorCode = 19,
_OrthancPluginService_RegisterDictionaryTag = 20,
_OrthancPluginService_DicomBufferToJson = 21,
_OrthancPluginService_DicomInstanceToJson = 22,
_OrthancPluginService_CreateDicom = 23,
_OrthancPluginService_ComputeMd5 = 24,
_OrthancPluginService_ComputeSha1 = 25,
_OrthancPluginService_LookupDictionary = 26,
_OrthancPluginService_CallHttpClient2 = 27,
_OrthancPluginService_GenerateUuid = 28,
_OrthancPluginService_RegisterPrivateDictionaryTag = 29,
_OrthancPluginService_AutodetectMimeType = 30,
_OrthancPluginService_SetMetricsValue = 31,
_OrthancPluginService_EncodeDicomWebJson = 32,
_OrthancPluginService_EncodeDicomWebXml = 33,
_OrthancPluginService_ChunkedHttpClient = 34, /* New in Orthanc 1.5.7 */
_OrthancPluginService_GetTagName = 35, /* New in Orthanc 1.5.7 */
_OrthancPluginService_EncodeDicomWebJson2 = 36, /* New in Orthanc 1.7.0 */
_OrthancPluginService_EncodeDicomWebXml2 = 37, /* New in Orthanc 1.7.0 */
_OrthancPluginService_CreateMemoryBuffer = 38, /* New in Orthanc 1.7.0 */
_OrthancPluginService_GenerateRestApiAuthorizationToken = 39, /* New in Orthanc 1.8.1 */
_OrthancPluginService_CreateMemoryBuffer64 = 40, /* New in Orthanc 1.9.0 */
_OrthancPluginService_CreateDicom2 = 41, /* New in Orthanc 1.9.0 */
/* Registration of callbacks */
_OrthancPluginService_RegisterRestCallback = 1000,
_OrthancPluginService_RegisterOnStoredInstanceCallback = 1001,
_OrthancPluginService_RegisterStorageArea = 1002,
_OrthancPluginService_RegisterOnChangeCallback = 1003,
_OrthancPluginService_RegisterRestCallbackNoLock = 1004,
_OrthancPluginService_RegisterWorklistCallback = 1005,
_OrthancPluginService_RegisterDecodeImageCallback = 1006,
_OrthancPluginService_RegisterIncomingHttpRequestFilter = 1007,
_OrthancPluginService_RegisterFindCallback = 1008,
_OrthancPluginService_RegisterMoveCallback = 1009,
_OrthancPluginService_RegisterIncomingHttpRequestFilter2 = 1010,
_OrthancPluginService_RegisterRefreshMetricsCallback = 1011,
_OrthancPluginService_RegisterChunkedRestCallback = 1012, /* New in Orthanc 1.5.7 */
_OrthancPluginService_RegisterStorageCommitmentScpCallback = 1013,
_OrthancPluginService_RegisterIncomingDicomInstanceFilter = 1014,
_OrthancPluginService_RegisterTranscoderCallback = 1015, /* New in Orthanc 1.7.0 */
_OrthancPluginService_RegisterStorageArea2 = 1016, /* New in Orthanc 1.9.0 */
/* Sending answers to REST calls */
_OrthancPluginService_AnswerBuffer = 2000,
_OrthancPluginService_CompressAndAnswerPngImage = 2001, /* Unused as of Orthanc 0.9.4 */
_OrthancPluginService_Redirect = 2002,
_OrthancPluginService_SendHttpStatusCode = 2003,
_OrthancPluginService_SendUnauthorized = 2004,
_OrthancPluginService_SendMethodNotAllowed = 2005,
_OrthancPluginService_SetCookie = 2006,
_OrthancPluginService_SetHttpHeader = 2007,
_OrthancPluginService_StartMultipartAnswer = 2008,
_OrthancPluginService_SendMultipartItem = 2009,
_OrthancPluginService_SendHttpStatus = 2010,
_OrthancPluginService_CompressAndAnswerImage = 2011,
_OrthancPluginService_SendMultipartItem2 = 2012,
_OrthancPluginService_SetHttpErrorDetails = 2013,
/* Access to the Orthanc database and API */
_OrthancPluginService_GetDicomForInstance = 3000,
_OrthancPluginService_RestApiGet = 3001,
_OrthancPluginService_RestApiPost = 3002,
_OrthancPluginService_RestApiDelete = 3003,
_OrthancPluginService_RestApiPut = 3004,
_OrthancPluginService_LookupPatient = 3005,
_OrthancPluginService_LookupStudy = 3006,
_OrthancPluginService_LookupSeries = 3007,
_OrthancPluginService_LookupInstance = 3008,
_OrthancPluginService_LookupStudyWithAccessionNumber = 3009,
_OrthancPluginService_RestApiGetAfterPlugins = 3010,
_OrthancPluginService_RestApiPostAfterPlugins = 3011,
_OrthancPluginService_RestApiDeleteAfterPlugins = 3012,
_OrthancPluginService_RestApiPutAfterPlugins = 3013,
_OrthancPluginService_ReconstructMainDicomTags = 3014,
_OrthancPluginService_RestApiGet2 = 3015,
_OrthancPluginService_CallRestApi = 3016, /* New in Orthanc 1.9.2 */
/* Access to DICOM instances */
_OrthancPluginService_GetInstanceRemoteAet = 4000,
_OrthancPluginService_GetInstanceSize = 4001,
_OrthancPluginService_GetInstanceData = 4002,
_OrthancPluginService_GetInstanceJson = 4003,
_OrthancPluginService_GetInstanceSimplifiedJson = 4004,
_OrthancPluginService_HasInstanceMetadata = 4005,
_OrthancPluginService_GetInstanceMetadata = 4006,
_OrthancPluginService_GetInstanceOrigin = 4007,
_OrthancPluginService_GetInstanceTransferSyntaxUid = 4008,
_OrthancPluginService_HasInstancePixelData = 4009,
_OrthancPluginService_CreateDicomInstance = 4010, /* New in Orthanc 1.7.0 */
_OrthancPluginService_FreeDicomInstance = 4011, /* New in Orthanc 1.7.0 */
_OrthancPluginService_GetInstanceFramesCount = 4012, /* New in Orthanc 1.7.0 */
_OrthancPluginService_GetInstanceRawFrame = 4013, /* New in Orthanc 1.7.0 */
_OrthancPluginService_GetInstanceDecodedFrame = 4014, /* New in Orthanc 1.7.0 */
_OrthancPluginService_TranscodeDicomInstance = 4015, /* New in Orthanc 1.7.0 */
_OrthancPluginService_SerializeDicomInstance = 4016, /* New in Orthanc 1.7.0 */
_OrthancPluginService_GetInstanceAdvancedJson = 4017, /* New in Orthanc 1.7.0 */
_OrthancPluginService_GetInstanceDicomWebJson = 4018, /* New in Orthanc 1.7.0 */
_OrthancPluginService_GetInstanceDicomWebXml = 4019, /* New in Orthanc 1.7.0 */
/* Services for plugins implementing a database back-end */
_OrthancPluginService_RegisterDatabaseBackend = 5000, /* New in Orthanc 0.8.6 */
_OrthancPluginService_DatabaseAnswer = 5001,
_OrthancPluginService_RegisterDatabaseBackendV2 = 5002, /* New in Orthanc 0.9.4 */
_OrthancPluginService_StorageAreaCreate = 5003,
_OrthancPluginService_StorageAreaRead = 5004,
_OrthancPluginService_StorageAreaRemove = 5005,
_OrthancPluginService_RegisterDatabaseBackendV3 = 5006, /* New in Orthanc 1.9.2 */
/* Primitives for handling images */
_OrthancPluginService_GetImagePixelFormat = 6000,
_OrthancPluginService_GetImageWidth = 6001,