Orthanc SDK
The orthanc_sdk is useful when developing with the Orthanc's Python Plugin,
it exposes orthanc module when available (i.e. used as an Orthanc script),
or expose the functions/classes signatures when not for linting and autocomplete.
Use it the same way you would use the Python Plugin:
from pyorthanc import orthanc_sdk
def on_get(output: orthanc_sdk.RestOutput, *_, **__):
output.AnswerBuffer('ok', 'text/plain')
orthanc_sdk.RegisterRestCallback('/test', on_get)
How it works
When developing importing the Orthanc Python Plugin with import orthanc will raise a ModuleNotFoundError.
This where the orthanc_sdk submodule is interesting. When orthanc is available, it uses it.
When not, orthanc_sdk expose mock functions/classes of everything available from orthanc, however, these functions/classes does nothing.
try:
from orthanc import *
except ModuleNotFoundError:
"""Orthanc SDK methods wrapped in python (plugin version 4.0)"""
...
Reference
pyorthanc.orthanc_sdk
Orthanc SDK methods wrapped in python
VERSION = '7.0'
module-attribute
ChangeType
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginChangeType
Source code in pyorthanc/_orthanc_sdk_enums.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
CompressionType
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginCompressionType
Source code in pyorthanc/_orthanc_sdk_enums.py
27 28 29 30 31 32 | |
ConstraintType
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginConstraintType
Source code in pyorthanc/_orthanc_sdk_enums.py
35 36 37 38 39 40 41 | |
ContentType
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginContentType
Source code in pyorthanc/_orthanc_sdk_enums.py
44 45 46 47 48 49 | |
CreateDicomFlags
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginCreateDicomFlags
Source code in pyorthanc/_orthanc_sdk_enums.py
52 53 54 55 56 | |
DicomConnection
Generated from Orthanc C class: OrthancPluginDicomConnection
Source code in pyorthanc/orthanc_sdk.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
GetConnectionCalledAet(*args)
Generated from C function OrthancPluginGetConnectionCalledAet()
Source code in pyorthanc/orthanc_sdk.py
131 132 133 | |
GetConnectionRemoteAet(*args)
Generated from C function OrthancPluginGetConnectionRemoteAet()
Source code in pyorthanc/orthanc_sdk.py
135 136 137 | |
GetConnectionRemoteIp(*args)
Generated from C function OrthancPluginGetConnectionRemoteIp()
Source code in pyorthanc/orthanc_sdk.py
139 140 141 | |
DicomInstance
Generated from Orthanc C class: OrthancPluginDicomInstance
Source code in pyorthanc/orthanc_sdk.py
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 | |
GetInstanceAdvancedJson(*args, **kwargs)
This function outputs a JSON string representing the tags of this DICOM file.
Source code in pyorthanc/orthanc_sdk.py
44 45 46 | |
GetInstanceData()
This function returns the content of the given DICOM instance.
Source code in pyorthanc/orthanc_sdk.py
48 49 50 | |
GetInstanceDecodedFrame(frameIndex)
This function decodes one frame of a DICOM image that is managed by the Orthanc core.
Source code in pyorthanc/orthanc_sdk.py
52 53 54 | |
GetInstanceFramesCount()
This function returns the number of frames that are part of a DICOM image managed by the Orthanc core.
Source code in pyorthanc/orthanc_sdk.py
56 57 58 | |
GetInstanceJson()
This function returns a string containing a JSON file. This JSON file encodes the tag hierarchy of the given DICOM instance.
Source code in pyorthanc/orthanc_sdk.py
60 61 62 63 64 65 | |
GetInstanceMetadata(metadata)
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 HasInstanceMetadata().
Source code in pyorthanc/orthanc_sdk.py
67 68 69 70 71 72 | |
GetInstanceOrigin()
This function returns the origin of a DICOM instance that has been received by Orthanc.
Source code in pyorthanc/orthanc_sdk.py
74 75 76 | |
GetInstanceRawFrame(*args)
Generated from C function OrthancPluginGetInstanceRawFrame()
Source code in pyorthanc/orthanc_sdk.py
78 79 80 | |
GetInstanceRemoteAet()
This function returns the Application Entity Title (AET) of the DICOM modality from which a DICOM instance originates.
Source code in pyorthanc/orthanc_sdk.py
82 83 84 85 86 87 | |
GetInstanceSimplifiedJson()
This function returns a string containing a JSON file. This JSON file encodes the tag hierarchy of the given DICOM instance. In contrast with GetInstanceJson(), the returned JSON file is in its simplified version.
Source code in pyorthanc/orthanc_sdk.py
89 90 91 92 93 94 95 | |
GetInstanceSize()
This function returns the number of bytes of the given DICOM instance.
Source code in pyorthanc/orthanc_sdk.py
97 98 99 | |
GetInstanceTransferSyntaxUid()
This function returns a string that contains the transfer syntax UID of the DICOM instance. The empty string might be returned if this information is unknown.
Source code in pyorthanc/orthanc_sdk.py
101 102 103 104 105 106 | |
HasInstanceMetadata(metadata)
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 OnStoredInstanceCallback(), the only possibly available metadata are "ReceptionDate", "RemoteAET" and "IndexInSeries".
Source code in pyorthanc/orthanc_sdk.py
108 109 110 111 112 113 114 | |
HasInstancePixelData()
This function returns a Boolean value indicating whether the DICOM instance contains the pixel data (7FE0,0010) tag.
Source code in pyorthanc/orthanc_sdk.py
116 117 118 119 120 121 | |
SerializeDicomInstance(*args)
Generated from C function OrthancPluginSerializeDicomInstance()
Source code in pyorthanc/orthanc_sdk.py
123 124 125 | |
DicomToJsonFlags
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginDicomToJsonFlags
Source code in pyorthanc/_orthanc_sdk_enums.py
59 60 61 62 63 64 65 66 67 68 69 | |
DicomToJsonFormat
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginDicomToJsonFormat
Source code in pyorthanc/_orthanc_sdk_enums.py
72 73 74 75 76 | |
DicomWebBinaryMode
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginDicomWebBinaryMode
Source code in pyorthanc/_orthanc_sdk_enums.py
79 80 81 82 83 | |
DicomWebNode
Generated from Orthanc C class: OrthancPluginDicomWebNode
Source code in pyorthanc/_orthanc_sdk_enums.py
86 87 | |
ErrorCode
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginErrorCode
Source code in pyorthanc/_orthanc_sdk_enums.py
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 | |
FindAnswers
Generated from Orthanc C class: OrthancPluginFindAnswers
Source code in pyorthanc/orthanc_sdk.py
144 145 146 147 148 149 150 151 152 153 | |
FindAddAnswer(*args)
Generated from C function OrthancPluginFindAddAnswer()
Source code in pyorthanc/orthanc_sdk.py
147 148 149 | |
FindMarkIncomplete(*args)
Generated from C function OrthancPluginFindMarkIncomplete()
Source code in pyorthanc/orthanc_sdk.py
151 152 153 | |
FindMatcher
Generated from Orthanc C class: OrthancPluginFindMatcher
Source code in pyorthanc/orthanc_sdk.py
156 157 158 159 160 161 | |
FindMatcherIsMatch(*args)
Generated from C function OrthancPluginFindMatcherIsMatch()
Source code in pyorthanc/orthanc_sdk.py
159 160 161 | |
FindQuery
Generated from Orthanc C class: OrthancPluginFindQuery
Source code in pyorthanc/orthanc_sdk.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
GetFindQuerySize(*args)
Generated from C function OrthancPluginGetFindQuerySize()
Source code in pyorthanc/orthanc_sdk.py
167 168 169 | |
GetFindQueryTagElement(*args)
Generated from C function OrthancPluginGetFindQueryTag()
Source code in pyorthanc/orthanc_sdk.py
171 172 173 | |
GetFindQueryTagGroup(*args)
Generated from C function OrthancPluginGetFindQueryTag()
Source code in pyorthanc/orthanc_sdk.py
175 176 177 | |
GetFindQueryTagName(*args)
Generated from C function OrthancPluginGetFindQueryTagName()
Source code in pyorthanc/orthanc_sdk.py
179 180 181 | |
GetFindQueryValue(*args)
Generated from C function OrthancPluginGetFindQueryValue()
Source code in pyorthanc/orthanc_sdk.py
183 184 185 | |
HttpMethod
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginHttpMethod
Source code in pyorthanc/_orthanc_sdk_enums.py
201 202 203 204 205 206 | |
IdentifierConstraint
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginIdentifierConstraint
Source code in pyorthanc/_orthanc_sdk_enums.py
209 210 211 212 213 214 | |
Image
Generated from Orthanc C class: OrthancPluginImage
Source code in pyorthanc/orthanc_sdk.py
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 | |
ConvertPixelFormat(*args)
Generated from C function OrthancPluginConvertPixelFormat()
Source code in pyorthanc/orthanc_sdk.py
12 13 14 | |
DrawText(*args)
Generated from C function OrthancPluginDrawText()
Source code in pyorthanc/orthanc_sdk.py
16 17 18 | |
GetImageBuffer(*args)
Generated from C function OrthancPluginGetImageBuffer()
Source code in pyorthanc/orthanc_sdk.py
20 21 22 | |
GetImageHeight(*args)
Generated from C function OrthancPluginGetImageHeight()
Source code in pyorthanc/orthanc_sdk.py
24 25 26 | |
GetImagePitch(*args)
Generated from C function OrthancPluginGetImagePitch()
Source code in pyorthanc/orthanc_sdk.py
28 29 30 | |
GetImagePixelFormat(*args)
Generated from C function OrthancPluginGetImagePixelFormat()
Source code in pyorthanc/orthanc_sdk.py
32 33 34 | |
GetImageWidth(*args)
Generated from C function OrthancPluginGetImageWidth()
Source code in pyorthanc/orthanc_sdk.py
36 37 38 | |
ImageFormat
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginImageFormat
Source code in pyorthanc/_orthanc_sdk_enums.py
217 218 219 220 221 | |
InstanceOrigin
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginInstanceOrigin
Source code in pyorthanc/_orthanc_sdk_enums.py
224 225 226 227 228 229 230 231 | |
Job
Generated from Orthanc C class: OrthancPluginJob
Source code in pyorthanc/orthanc_sdk.py
188 189 190 191 192 193 | |
SubmitJob(*args)
Generated from C function OrthancPluginSubmitJob()
Source code in pyorthanc/orthanc_sdk.py
191 192 193 | |
JobStepStatus
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginJobStepStatus
Source code in pyorthanc/_orthanc_sdk_enums.py
234 235 236 237 238 | |
JobStopReason
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginJobStopReason
Source code in pyorthanc/_orthanc_sdk_enums.py
241 242 243 244 245 246 | |
MetricsType
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginMetricsType
Source code in pyorthanc/_orthanc_sdk_enums.py
249 250 251 252 | |
OrthancException
Common base class for all non-exit exceptions.
Source code in pyorthanc/orthanc_sdk.py
196 197 198 199 200 201 | |
with_traceback(*args)
Exception.with_traceback(tb) -- set self.traceback to tb and return self.
Source code in pyorthanc/orthanc_sdk.py
199 200 201 | |
Peers
Generated from Orthanc C class: OrthancPluginPeers
Source code in pyorthanc/orthanc_sdk.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |
GetPeerName(*args)
Generated from C function OrthancPluginGetPeerName()
Source code in pyorthanc/orthanc_sdk.py
207 208 209 | |
GetPeerUrl(*args)
Generated from C function OrthancPluginGetPeerUrl()
Source code in pyorthanc/orthanc_sdk.py
211 212 213 | |
GetPeerUserProperty(*args)
Generated from C function OrthancPluginGetPeerUserProperty()
Source code in pyorthanc/orthanc_sdk.py
215 216 217 | |
GetPeersCount(*args)
Generated from C function OrthancPluginGetPeersCount()
Source code in pyorthanc/orthanc_sdk.py
219 220 221 | |
PixelFormat
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginPixelFormat
Source code in pyorthanc/_orthanc_sdk_enums.py
255 256 257 258 259 260 261 262 263 264 265 266 267 | |
ReceivedInstanceAction
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginReceivedInstanceAction
Source code in pyorthanc/_orthanc_sdk_enums.py
270 271 272 273 274 | |
ResourceType
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginResourceType
Source code in pyorthanc/_orthanc_sdk_enums.py
277 278 279 280 281 282 283 | |
RestOutput
Generated from Orthanc C class: OrthancPluginRestOutput
Source code in pyorthanc/orthanc_sdk.py
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 | |
AnswerBuffer(*args)
Generated from C function OrthancPluginAnswerBuffer()
Source code in pyorthanc/orthanc_sdk.py
227 228 229 | |
CompressAndAnswerJpegImage(*args)
Generated from C function OrthancPluginCompressAndAnswerJpegImage()
Source code in pyorthanc/orthanc_sdk.py
231 232 233 | |
CompressAndAnswerPngImage(*args)
Generated from C function OrthancPluginCompressAndAnswerPngImage()
Source code in pyorthanc/orthanc_sdk.py
235 236 237 | |
Redirect(*args)
Generated from C function OrthancPluginRedirect()
Source code in pyorthanc/orthanc_sdk.py
239 240 241 | |
SendHttpStatus(*args)
Generated from C function OrthancPluginSendHttpStatus()
Source code in pyorthanc/orthanc_sdk.py
247 248 249 | |
SendHttpStatusCode(*args)
Generated from C function OrthancPluginSendHttpStatusCode()
Source code in pyorthanc/orthanc_sdk.py
251 252 253 | |
SendMethodNotAllowed(*args)
Generated from C function OrthancPluginSendMethodNotAllowed()
Source code in pyorthanc/orthanc_sdk.py
255 256 257 | |
SendMultipartItem(*args)
Generated from C function OrthancPluginSendMultipartItem()
Source code in pyorthanc/orthanc_sdk.py
259 260 261 | |
SendStreamChunk(*args)
Generated from C function OrthancPluginSendStreamChunk()
Source code in pyorthanc/orthanc_sdk.py
243 244 245 | |
SendUnauthorized(*args)
Generated from C function OrthancPluginSendUnauthorized()
Source code in pyorthanc/orthanc_sdk.py
263 264 265 | |
SetCookie(*args)
Generated from C function OrthancPluginSetCookie()
Source code in pyorthanc/orthanc_sdk.py
271 272 273 | |
SetHttpErrorDetails(*args)
Generated from C function OrthancPluginSetHttpErrorDetails()
Source code in pyorthanc/orthanc_sdk.py
275 276 277 | |
SetHttpHeader(*args)
Generated from C function OrthancPluginSetHttpHeader()
Source code in pyorthanc/orthanc_sdk.py
279 280 281 | |
StartMultipartAnswer(*args)
Generated from C function OrthancPluginStartMultipartAnswer()
Source code in pyorthanc/orthanc_sdk.py
283 284 285 | |
StartStreamAnswer(*args)
Generated from C function OrthancPluginStartStreamAnswer()
Source code in pyorthanc/orthanc_sdk.py
267 268 269 | |
ServerChunkedRequestReader
Generated from Orthanc C class: OrthancPluginServerChunkedRequestReader
Source code in pyorthanc/orthanc_sdk.py
288 289 | |
StorageArea
Generated from Orthanc C class: OrthancPluginStorageArea
Source code in pyorthanc/orthanc_sdk.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |
ReconstructMainDicomTags(*args)
Generated from C function OrthancPluginReconstructMainDicomTags()
Source code in pyorthanc/orthanc_sdk.py
295 296 297 | |
StorageAreaCreate(*args)
Generated from C function OrthancPluginStorageAreaCreate()
Source code in pyorthanc/orthanc_sdk.py
299 300 301 | |
StorageAreaRead(*args)
Generated from C function OrthancPluginStorageAreaRead()
Source code in pyorthanc/orthanc_sdk.py
303 304 305 | |
StorageAreaRemove(*args)
Generated from C function OrthancPluginStorageAreaRemove()
Source code in pyorthanc/orthanc_sdk.py
307 308 309 | |
StorageCommitmentFailureReason
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginStorageCommitmentFailureReason
Source code in pyorthanc/_orthanc_sdk_enums.py
286 287 288 289 290 291 292 293 294 | |
ValueRepresentation
Bases: Enum
Generated from C enumeration OrthancPluginOrthancPluginValueRepresentation
Source code in pyorthanc/_orthanc_sdk_enums.py
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 | |
WorklistAnswers
Generated from Orthanc C class: OrthancPluginWorklistAnswers
Source code in pyorthanc/orthanc_sdk.py
312 313 314 315 316 317 318 319 320 321 | |
WorklistAddAnswer(*args)
Generated from C function OrthancPluginWorklistAddAnswer()
Source code in pyorthanc/orthanc_sdk.py
315 316 317 | |
WorklistMarkIncomplete(*args)
Generated from C function OrthancPluginWorklistMarkIncomplete()
Source code in pyorthanc/orthanc_sdk.py
319 320 321 | |
WorklistQuery
Generated from Orthanc C class: OrthancPluginWorklistQuery
Source code in pyorthanc/orthanc_sdk.py
324 325 326 327 328 329 330 331 332 333 | |
WorklistGetDicomQuery(*args)
Generated from C function OrthancPluginWorklistGetDicomQuery()
Source code in pyorthanc/orthanc_sdk.py
327 328 329 | |
WorklistIsMatch(*args)
Generated from C function OrthancPluginWorklistIsMatch()
Source code in pyorthanc/orthanc_sdk.py
331 332 333 | |
__loader__
Meta path import for built-in modules.
Source code in pyorthanc/orthanc_sdk.py
963 964 | |
AcknowledgeQueueValue(*args)
Generated from C function OrthancPluginAcknowledgeQueueValue()
Source code in pyorthanc/orthanc_sdk.py
869 870 871 | |
AutodetectMimeType(*args)
Generated from C function OrthancPluginAutodetectMimeType()
Source code in pyorthanc/orthanc_sdk.py
336 337 338 | |
BufferCompression(memory_buffer, source, size, compression, uncompress)
Compress or decompress a buffer.
This function compresses or decompresses a buffer, using the version of the zlib library that is used by the Orthanc core.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
memory_buffer
|
Any
|
The target memory buffer. It must be freed with OrthancPluginFreeMemoryBuffer() |
required |
source
|
Any
|
The source buffer. |
required |
size
|
int
|
The size in bytes of the source buffer. |
required |
compression
|
CompressionType
|
The compression algorithm. |
required |
uncompress
|
int
|
If set to "0", the buffer must be compressed. |
required |
Returns:
| Type | Description |
|---|---|
0 if success, or the error code if failure.
|
|
Source code in pyorthanc/orthanc_sdk.py
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 | |
CheckVersion()
Check the compatibility of the plugin wrt. the version of its hosting Orthanc.
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.
Returns:
| Type | Description |
|---|---|
1 if and only if the versions are compatible. If the result is 0,
|
the initialization of the plugin should fail. |
Source code in pyorthanc/orthanc_sdk.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | |
CheckVersionAdvanced(*args)
Generated from C function OrthancPluginCheckVersionAdvanced()
Source code in pyorthanc/orthanc_sdk.py
390 391 392 | |
CompressJpegImage(*args)
Generated from C function OrthancPluginCompressJpegImage()
Source code in pyorthanc/orthanc_sdk.py
395 396 397 | |
CompressPngImage(*args)
Generated from C function OrthancPluginCompressPngImage()
Source code in pyorthanc/orthanc_sdk.py
400 401 402 | |
ComputeMd5(*args)
Generated from C function OrthancPluginComputeMd5()
Source code in pyorthanc/orthanc_sdk.py
405 406 407 | |
ComputeSha1(*args)
Generated from C function OrthancPluginComputeSha1()
Source code in pyorthanc/orthanc_sdk.py
410 411 412 | |
CreateDicom(*args)
None
Source code in pyorthanc/orthanc_sdk.py
415 416 417 | |
CreateDicomInstance(*args)
Generated from C function OrthancPluginCreateDicomInstance()
Source code in pyorthanc/orthanc_sdk.py
420 421 422 | |
CreateFindMatcher(*args)
Generated from C function OrthancPluginCreateFindMatcher()
Source code in pyorthanc/orthanc_sdk.py
425 426 427 | |
CreateImage(*args)
Generated from C function OrthancPluginCreateImage()
Source code in pyorthanc/orthanc_sdk.py
430 431 432 | |
CreateImageFromBuffer(*args)
None
Source code in pyorthanc/orthanc_sdk.py
435 436 437 | |
CreateMemoryBuffer(*args)
Generated from C function OrthancPluginCreateMemoryBuffer()
Source code in pyorthanc/orthanc_sdk.py
440 441 442 | |
DecodeDicomImage(*args)
Generated from C function OrthancPluginDecodeDicomImage()
Source code in pyorthanc/orthanc_sdk.py
445 446 447 | |
DicomBufferToJson(*args)
Generated from C function OrthancPluginDicomBufferToJson()
Source code in pyorthanc/orthanc_sdk.py
450 451 452 | |
DicomInstanceToJson(*args)
Generated from C function OrthancPluginDicomInstanceToJson()
Source code in pyorthanc/orthanc_sdk.py
455 456 457 | |
ExtendOrthancExplorer(*args)
Generated from C function OrthancPluginExtendOrthancExplorer()
Source code in pyorthanc/orthanc_sdk.py
460 461 462 | |
GenerateRestApiAuthorizationToken(*args)
Generated from C function OrthancPluginGenerateRestApiAuthorizationToken()
Source code in pyorthanc/orthanc_sdk.py
465 466 467 | |
GenerateUuid(*args)
Generated from C function OrthancPluginGenerateUuid()
Source code in pyorthanc/orthanc_sdk.py
470 471 472 | |
GetCommandLineArgument(*args)
Generated from C function OrthancPluginGetCommandLineArgument()
Source code in pyorthanc/orthanc_sdk.py
475 476 477 | |
GetCommandLineArgumentsCount(*args)
Generated from C function OrthancPluginGetCommandLineArgumentsCount()
Source code in pyorthanc/orthanc_sdk.py
480 481 482 | |
GetConfiguration(*args)
Generated from C function OrthancPluginGetConfiguration()
Source code in pyorthanc/orthanc_sdk.py
485 486 487 | |
GetConfigurationPath(*args)
Generated from C function OrthancPluginGetConfigurationPath()
Source code in pyorthanc/orthanc_sdk.py
490 491 492 | |
GetDicomForInstance(*args)
Generated from C function OrthancPluginGetDicomForInstance()
Source code in pyorthanc/orthanc_sdk.py
495 496 497 | |
GetErrorDescription(*args)
Generated from C function OrthancPluginGetErrorDescription()
Source code in pyorthanc/orthanc_sdk.py
500 501 502 | |
GetExpectedDatabaseVersion(*args)
Generated from C function OrthancPluginGetExpectedDatabaseVersion()
Source code in pyorthanc/orthanc_sdk.py
505 506 507 | |
GetFontName(*args)
Generated from C function OrthancPluginGetFontName()
Source code in pyorthanc/orthanc_sdk.py
510 511 512 | |
GetFontSize(*args)
Generated from C function OrthancPluginGetFontSize()
Source code in pyorthanc/orthanc_sdk.py
515 516 517 | |
GetFontsCount(*args)
Generated from C function OrthancPluginGetFontsCount()
Source code in pyorthanc/orthanc_sdk.py
520 521 522 | |
GetGlobalProperty(*args)
Generated from C function OrthancPluginGetGlobalProperty()
Source code in pyorthanc/orthanc_sdk.py
525 526 527 | |
GetOrthancDirectory(*args)
Generated from C function OrthancPluginGetOrthancDirectory()
Source code in pyorthanc/orthanc_sdk.py
530 531 532 | |
GetOrthancPath(*args)
Generated from C function OrthancPluginGetOrthancPath()
Source code in pyorthanc/orthanc_sdk.py
535 536 537 | |
GetPeers(*args)
Generated from C function OrthancPluginGetPeers()
Source code in pyorthanc/orthanc_sdk.py
540 541 542 | |
GetTagName(*args)
Generated from C function OrthancPluginGetTagName()
Source code in pyorthanc/orthanc_sdk.py
545 546 547 | |
HttpDelete(*args)
Generated from C function OrthancPluginHttpDelete()
Source code in pyorthanc/orthanc_sdk.py
550 551 552 | |
HttpGet(*args)
Generated from C function OrthancPluginHttpGet()
Source code in pyorthanc/orthanc_sdk.py
555 556 557 | |
HttpPost(*args)
Generated from C function OrthancPluginHttpPost()
Source code in pyorthanc/orthanc_sdk.py
560 561 562 | |
HttpPut(*args)
Generated from C function OrthancPluginHttpPut()
Source code in pyorthanc/orthanc_sdk.py
565 566 567 | |
LogError(*args)
Generated from C function OrthancPluginLogError()
Source code in pyorthanc/orthanc_sdk.py
570 571 572 | |
LogInfo(*args)
Generated from C function OrthancPluginLogInfo()
Source code in pyorthanc/orthanc_sdk.py
575 576 577 | |
LogWarning(*args)
Generated from C function OrthancPluginLogWarning()
Source code in pyorthanc/orthanc_sdk.py
580 581 582 | |
LookupDictionary(*args)
None
Source code in pyorthanc/orthanc_sdk.py
585 586 587 | |
LookupInstance(*args)
Generated from C function OrthancPluginLookupInstance()
Source code in pyorthanc/orthanc_sdk.py
590 591 592 | |
LookupPatient(*args)
Generated from C function OrthancPluginLookupPatient()
Source code in pyorthanc/orthanc_sdk.py
595 596 597 | |
LookupSeries(*args)
Generated from C function OrthancPluginLookupSeries()
Source code in pyorthanc/orthanc_sdk.py
600 601 602 | |
LookupStudy(*args)
Generated from C function OrthancPluginLookupStudy()
Source code in pyorthanc/orthanc_sdk.py
605 606 607 | |
LookupStudyWithAccessionNumber(*args)
Generated from C function OrthancPluginLookupStudyWithAccessionNumber()
Source code in pyorthanc/orthanc_sdk.py
610 611 612 | |
ReadFile(*args)
Generated from C function OrthancPluginReadFile()
Source code in pyorthanc/orthanc_sdk.py
615 616 617 | |
RegisterDictionaryTag(*args)
Generated from C function OrthancPluginRegisterDictionaryTag()
Source code in pyorthanc/orthanc_sdk.py
620 621 622 | |
RegisterErrorCode(*args)
Generated from C function OrthancPluginRegisterErrorCode()
Source code in pyorthanc/orthanc_sdk.py
625 626 627 | |
RegisterFindCallback(func)
Register on C-Find Callback
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable[[FindAnswers, FindQuery, str, str], None]
|
Function that is call when Orthanc receive an incoming C-Find request |
required |
Examples:
From https://orthanc.uclouvain.be/book/plugins/python.html#handling-dicom-scp-requests-new-in-3-2
def on_find(answers, query, issuerAet, calledAet):
print('Received incoming C-FIND request from %s:' % issuerAet)
answer = {}
for i in range(query.GetFindQuerySize()):
print(' %s (%04x,%04x) = [%s]' % (query.GetFindQueryTagName(i),
query.GetFindQueryTagGroup(i),
query.GetFindQueryTagElement(i),
query.GetFindQueryValue(i)))
answer[query.GetFindQueryTagName(i)] = ('HELLO%d-%s' % (i, query.GetFindQueryValue(i)))
answers.FindAddAnswer(orthanc.CreateDicom(json.dumps(answer), None, orthanc.CreateDicomFlags.NONE))
orthanc.RegisterFindCallback(on_find)
Source code in pyorthanc/orthanc_sdk.py
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 | |
RegisterFindCallback2(func)
(New from v 7.0) Register on C-Find Callback using the connection object
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable[[FindAnswers, FindQuery, DicomConnection], None]
|
Function that is call when Orthanc receive an incoming C-Find request |
required |
Examples:
From https://orthanc.uclouvain.be/book/plugins/python.html#id30
def on_find(answers, query, connection): # new from v 7.0: issuerAet and calledAet are available from the connection object
print('Received incoming C-FIND request from %s %s %s:' % (connection.GetConnectionRemoteAet(), connection.GetConnectionRemoteIp(), connection.GetConnectionCalledAet()))
# old prototype still available
# def OnFindLegacy(answers, query, issuerAet, calledAet):
# print('Received incoming C-FIND request from %s:' % issuerAet)
answer = {}
for i in range(query.GetFindQuerySize()):
print(' %s (%04x,%04x) = [%s]' % (query.GetFindQueryTagName(i),
query.GetFindQueryTagGroup(i),
query.GetFindQueryTagElement(i),
query.GetFindQueryValue(i)))
answer[query.GetFindQueryTagName(i)] = ('HELLO%d-%s' % (i, query.GetFindQueryValue(i)))
answers.FindAddAnswer(orthanc.CreateDicom(
json.dumps(answer), None, orthanc.CreateDicomFlags.NONE))
orthanc.RegisterFindCallback2(OnFind) # new from v 7.0
Source code in pyorthanc/orthanc_sdk.py
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 | |
RegisterIncomingCStoreInstanceFilter(*args)
None
Source code in pyorthanc/orthanc_sdk.py
697 698 699 | |
RegisterIncomingHttpRequestFilter(*args)
None
Source code in pyorthanc/orthanc_sdk.py
702 703 704 | |
RegisterMoveCallback(func)
None
Source code in pyorthanc/orthanc_sdk.py
707 708 709 | |
RegisterMoveCallback2(create_move_func, get_move_func, apply_move_func, free_move_func)
See https://github.com/orthanc-team/dicom-dicomweb-proxy/blob/main/proxy.py for an example from the OrthancTeam.
Source code in pyorthanc/orthanc_sdk.py
712 713 714 | |
RegisterMoveCallback3(create_move_func, get_move_func, apply_move_func, free_move_func)
None
Source code in pyorthanc/orthanc_sdk.py
717 718 719 | |
RegisterOnChangeCallback(func)
Register on change callback
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable[[ChangeType, ResourceType, str], None]
|
Function that is called as callback. |
required |
Examples:
From https://book.orthanc-server.com/plugins/python.html#listening-to-changes.
def on_change(change_type: orthanc_sdk.ChangeType, level: orthanc_sdk.ResourceType, resource: str) -> None:
if changeType == orthanc_sdk.ChangeType.ORTHANC_STARTED:
with open('/tmp/sample.dcm', 'rb') as f:
orthanc.RestApiPost('/instances', f.read())
elif changeType == orthanc_sdk.ChangeType.ORTHANC_STOPPED:
print('Stopped')
elif changeType == orthanc_sdk.ChangeType.NEW_INSTANCE:
print('A new instance was uploaded: %s' % resource)
orthanc_sdk.RegisterOnChangeCallback(on_change)
Source code in pyorthanc/orthanc_sdk.py
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 | |
RegisterOnStoredInstanceCallback(func)
Register a callback for when an instance is stored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable[[DicomInstance, str], None]
|
Function that is called as callback. |
required |
Examples:
Example from https://book.orthanc-server.com/plugins/python.html#accessing-the-content-of-a-new-instance
def on_store_instance(dicom: orthanc_sdk.DicomInstance, instance_id: str):
print('Received instance %s of size %d (transfer syntax %s, SOP class UID %s)' % (
instance_id, dicom.GetInstanceSize(),
dicom.GetInstanceMetadata('TransferSyntax'),
dicom.GetInstanceMetadata('SopClassUid')))
if dicom.GetInstanceOrigin() == orthanc_sdk.InstanceOrigin.DICOM_PROTOCOL:
print('This instance was received through the DICOM protocol')
elif dicom.GetInstanceOrigin() == orthanc_sdk.InstanceOrigin.REST_API:
print('This instance was received through the REST API')
orthanc_sdk.RegisterOnStoredInstanceCallback(on_store_instance)
Source code in pyorthanc/orthanc_sdk.py
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 | |
RegisterPrivateDictionaryTag(*args)
Generated from C function OrthancPluginRegisterPrivateDictionaryTag()
Source code in pyorthanc/orthanc_sdk.py
780 781 782 | |
RegisterReceivedInstanceCallback(func)
Register a callback for when an instance arrives (but hasn't been stored).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable[[DicomInstance, InstanceOrigin], Tuple[ReceivedInstanceAction, Optional[bytes]]]
|
Function that is called as callback. |
required |
Examples:
def on_received_instance(dicom: orthanc_sdk.DicomInstance, origin: orthanc_sdk.InstanceOrigin):
if origin == origin.REST_API:
LogInfo('Not accepting DICOM from REST API.')
return ReceivedInstanceAction.DISCARD, None
return ReceivedInstanceAction.KEEP_AS_IS, None
orthanc.RegisterReceivedInstanceCallback(on_received_instance)
Source code in pyorthanc/orthanc_sdk.py
785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 | |
RegisterRestCallback(new_route, func)
Register a REST callback.
This function registers a REST callback against a regular expression for a URI. This function must be called during the initialization of the plugin, i.e. inside the OrthancPluginInitialize() public function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
new_route
|
str
|
Regular expression for the URI. May contain groups. |
required |
func
|
Callable[[RestOutput, str, Any], None]
|
The callback function to handle the REST call. |
required |
Examples:
Example from https://book.orthanc-server.com/plugins/python.html#extending-the-rest-api
def on_rest(output: orthanc_sdk.RestOutput, uri: str, **request):
print(request)
output.AnswerBuffer('ok', 'text/plain')
orthanc.RegisterRestCallback('/tata', on_rest)
Source code in pyorthanc/orthanc_sdk.py
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 | |
RegisterStorageArea(*args)
None
Source code in pyorthanc/orthanc_sdk.py
839 840 841 | |
RegisterStorageCommitmentScpCallback(*args)
None
Source code in pyorthanc/orthanc_sdk.py
844 845 846 | |
RegisterStorageCommitmentScpCallback2(*args)
None
Source code in pyorthanc/orthanc_sdk.py
849 850 851 | |
RegisterWorklistCallback(*args)
None
Source code in pyorthanc/orthanc_sdk.py
854 855 856 | |
RegisterWorklistCallback2(*args)
None
Source code in pyorthanc/orthanc_sdk.py
859 860 861 | |
ReserveQueueValue(*args)
Generated from C function OrthancPluginReserveQueueValue()
Source code in pyorthanc/orthanc_sdk.py
864 865 866 | |
RestApiDelete(*args)
Generated from C function OrthancPluginRestApiDelete()
Source code in pyorthanc/orthanc_sdk.py
874 875 876 | |
RestApiDeleteAfterPlugins(*args)
Generated from C function OrthancPluginRestApiDeleteAfterPlugins()
Source code in pyorthanc/orthanc_sdk.py
879 880 881 | |
RestApiGet(*args)
Generated from C function OrthancPluginRestApiGet()
Source code in pyorthanc/orthanc_sdk.py
884 885 886 | |
RestApiGetAfterPlugins(*args)
Generated from C function OrthancPluginRestApiGetAfterPlugins()
Source code in pyorthanc/orthanc_sdk.py
889 890 891 | |
RestApiPost(uri, body, *args, **kwargs)
Make a POST call to the built-in Orthanc REST API.
Make a POST call to the built-in Orthanc REST API. The result to the query is stored into a newly allocated memory buffer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uri
|
str
|
The URI in the built-in Orthanc API. |
required |
body
|
Any
|
The body of the POST request. |
required |
*args
|
|
()
|
|
**kwargs
|
|
{}
|
Source code in pyorthanc/orthanc_sdk.py
894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 | |
RestApiPostAfterPlugins(*args)
Generated from C function OrthancPluginRestApiPostAfterPlugins()
Source code in pyorthanc/orthanc_sdk.py
913 914 915 | |
RestApiPut(*args)
Generated from C function OrthancPluginRestApiPut()
Source code in pyorthanc/orthanc_sdk.py
918 919 920 | |
RestApiPutAfterPlugins(*args)
Generated from C function OrthancPluginRestApiPutAfterPlugins()
Source code in pyorthanc/orthanc_sdk.py
923 924 925 | |
SetDescription(*args)
Generated from C function OrthancPluginSetDescription()
Source code in pyorthanc/orthanc_sdk.py
928 929 930 | |
SetGlobalProperty(*args)
Generated from C function OrthancPluginSetGlobalProperty()
Source code in pyorthanc/orthanc_sdk.py
933 934 935 | |
SetMetricsValue(*args)
Generated from C function OrthancPluginSetMetricsValue()
Source code in pyorthanc/orthanc_sdk.py
938 939 940 | |
SetRootUri(*args)
Generated from C function OrthancPluginSetRootUri()
Source code in pyorthanc/orthanc_sdk.py
943 944 945 | |
TranscodeDicomInstance(*args)
Generated from C function OrthancPluginTranscodeDicomInstance()
Source code in pyorthanc/orthanc_sdk.py
948 949 950 | |
UncompressImage(*args)
Generated from C function OrthancPluginUncompressImage()
Source code in pyorthanc/orthanc_sdk.py
953 954 955 | |
WriteFile(*args)
Generated from C function OrthancPluginWriteFile()
Source code in pyorthanc/orthanc_sdk.py
958 959 960 | |