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 = '4.1'
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 |
|
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
128 129 130 131 132 133 134 135 136 137 |
|
FindAddAnswer(*args)
Generated from C function OrthancPluginFindAddAnswer()
Source code in pyorthanc/orthanc_sdk.py
131 132 133 |
|
FindMarkIncomplete(*args)
Generated from C function OrthancPluginFindMarkIncomplete()
Source code in pyorthanc/orthanc_sdk.py
135 136 137 |
|
FindMatcher
Generated from Orthanc C class: OrthancPluginFindMatcher
Source code in pyorthanc/orthanc_sdk.py
140 141 142 143 144 145 |
|
FindMatcherIsMatch(*args)
Generated from C function OrthancPluginFindMatcherIsMatch()
Source code in pyorthanc/orthanc_sdk.py
143 144 145 |
|
FindQuery
Generated from Orthanc C class: OrthancPluginFindQuery
Source code in pyorthanc/orthanc_sdk.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
GetFindQuerySize(*args)
Generated from C function OrthancPluginGetFindQuerySize()
Source code in pyorthanc/orthanc_sdk.py
151 152 153 |
|
GetFindQueryTagElement(*args)
Generated from C function OrthancPluginGetFindQueryTag()
Source code in pyorthanc/orthanc_sdk.py
155 156 157 |
|
GetFindQueryTagGroup(*args)
Generated from C function OrthancPluginGetFindQueryTag()
Source code in pyorthanc/orthanc_sdk.py
159 160 161 |
|
GetFindQueryTagName(*args)
Generated from C function OrthancPluginGetFindQueryTagName()
Source code in pyorthanc/orthanc_sdk.py
163 164 165 |
|
GetFindQueryValue(*args)
Generated from C function OrthancPluginGetFindQueryValue()
Source code in pyorthanc/orthanc_sdk.py
167 168 169 |
|
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
172 173 174 175 176 177 |
|
SubmitJob(*args)
Generated from C function OrthancPluginSubmitJob()
Source code in pyorthanc/orthanc_sdk.py
175 176 177 |
|
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
180 181 182 183 184 185 |
|
with_traceback(*args)
Exception.with_traceback(tb) -- set self.traceback to tb and return self.
Source code in pyorthanc/orthanc_sdk.py
183 184 185 |
|
Peers
Generated from Orthanc C class: OrthancPluginPeers
Source code in pyorthanc/orthanc_sdk.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
GetPeerName(*args)
Generated from C function OrthancPluginGetPeerName()
Source code in pyorthanc/orthanc_sdk.py
191 192 193 |
|
GetPeerUrl(*args)
Generated from C function OrthancPluginGetPeerUrl()
Source code in pyorthanc/orthanc_sdk.py
195 196 197 |
|
GetPeerUserProperty(*args)
Generated from C function OrthancPluginGetPeerUserProperty()
Source code in pyorthanc/orthanc_sdk.py
199 200 201 |
|
GetPeersCount(*args)
Generated from C function OrthancPluginGetPeersCount()
Source code in pyorthanc/orthanc_sdk.py
203 204 205 |
|
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
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 |
|
AnswerBuffer(*args)
Generated from C function OrthancPluginAnswerBuffer()
Source code in pyorthanc/orthanc_sdk.py
211 212 213 |
|
CompressAndAnswerJpegImage(*args)
Generated from C function OrthancPluginCompressAndAnswerJpegImage()
Source code in pyorthanc/orthanc_sdk.py
215 216 217 |
|
CompressAndAnswerPngImage(*args)
Generated from C function OrthancPluginCompressAndAnswerPngImage()
Source code in pyorthanc/orthanc_sdk.py
219 220 221 |
|
Redirect(*args)
Generated from C function OrthancPluginRedirect()
Source code in pyorthanc/orthanc_sdk.py
223 224 225 |
|
SendHttpStatus(*args)
Generated from C function OrthancPluginSendHttpStatus()
Source code in pyorthanc/orthanc_sdk.py
227 228 229 |
|
SendHttpStatusCode(*args)
Generated from C function OrthancPluginSendHttpStatusCode()
Source code in pyorthanc/orthanc_sdk.py
231 232 233 |
|
SendMethodNotAllowed(*args)
Generated from C function OrthancPluginSendMethodNotAllowed()
Source code in pyorthanc/orthanc_sdk.py
235 236 237 |
|
SendMultipartItem(*args)
Generated from C function OrthancPluginSendMultipartItem()
Source code in pyorthanc/orthanc_sdk.py
239 240 241 |
|
SendUnauthorized(*args)
Generated from C function OrthancPluginSendUnauthorized()
Source code in pyorthanc/orthanc_sdk.py
243 244 245 |
|
SetCookie(*args)
Generated from C function OrthancPluginSetCookie()
Source code in pyorthanc/orthanc_sdk.py
247 248 249 |
|
SetHttpErrorDetails(*args)
Generated from C function OrthancPluginSetHttpErrorDetails()
Source code in pyorthanc/orthanc_sdk.py
251 252 253 |
|
SetHttpHeader(*args)
Generated from C function OrthancPluginSetHttpHeader()
Source code in pyorthanc/orthanc_sdk.py
255 256 257 |
|
StartMultipartAnswer(*args)
Generated from C function OrthancPluginStartMultipartAnswer()
Source code in pyorthanc/orthanc_sdk.py
259 260 261 |
|
ServerChunkedRequestReader
Generated from Orthanc C class: OrthancPluginServerChunkedRequestReader
Source code in pyorthanc/orthanc_sdk.py
264 265 |
|
StorageArea
Generated from Orthanc C class: OrthancPluginStorageArea
Source code in pyorthanc/orthanc_sdk.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
ReconstructMainDicomTags(*args)
Generated from C function OrthancPluginReconstructMainDicomTags()
Source code in pyorthanc/orthanc_sdk.py
271 272 273 |
|
StorageAreaCreate(*args)
Generated from C function OrthancPluginStorageAreaCreate()
Source code in pyorthanc/orthanc_sdk.py
275 276 277 |
|
StorageAreaRead(*args)
Generated from C function OrthancPluginStorageAreaRead()
Source code in pyorthanc/orthanc_sdk.py
279 280 281 |
|
StorageAreaRemove(*args)
Generated from C function OrthancPluginStorageAreaRemove()
Source code in pyorthanc/orthanc_sdk.py
283 284 285 |
|
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
288 289 290 291 292 293 294 295 296 297 |
|
WorklistAddAnswer(*args)
Generated from C function OrthancPluginWorklistAddAnswer()
Source code in pyorthanc/orthanc_sdk.py
291 292 293 |
|
WorklistMarkIncomplete(*args)
Generated from C function OrthancPluginWorklistMarkIncomplete()
Source code in pyorthanc/orthanc_sdk.py
295 296 297 |
|
WorklistQuery
Generated from Orthanc C class: OrthancPluginWorklistQuery
Source code in pyorthanc/orthanc_sdk.py
300 301 302 303 304 305 306 307 308 309 |
|
WorklistGetDicomQuery(*args)
Generated from C function OrthancPluginWorklistGetDicomQuery()
Source code in pyorthanc/orthanc_sdk.py
303 304 305 |
|
WorklistIsMatch(*args)
Generated from C function OrthancPluginWorklistIsMatch()
Source code in pyorthanc/orthanc_sdk.py
307 308 309 |
|
__loader__
Meta path import for built-in modules.
Source code in pyorthanc/orthanc_sdk.py
878 879 |
|
AutodetectMimeType(*args)
Generated from C function OrthancPluginAutodetectMimeType()
Source code in pyorthanc/orthanc_sdk.py
312 313 314 |
|
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
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 |
|
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
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 |
|
CheckVersionAdvanced(*args)
Generated from C function OrthancPluginCheckVersionAdvanced()
Source code in pyorthanc/orthanc_sdk.py
366 367 368 |
|
CompressJpegImage(*args)
Generated from C function OrthancPluginCompressJpegImage()
Source code in pyorthanc/orthanc_sdk.py
371 372 373 |
|
CompressPngImage(*args)
Generated from C function OrthancPluginCompressPngImage()
Source code in pyorthanc/orthanc_sdk.py
376 377 378 |
|
ComputeMd5(*args)
Generated from C function OrthancPluginComputeMd5()
Source code in pyorthanc/orthanc_sdk.py
381 382 383 |
|
ComputeSha1(*args)
Generated from C function OrthancPluginComputeSha1()
Source code in pyorthanc/orthanc_sdk.py
386 387 388 |
|
CreateDicom(*args)
None
Source code in pyorthanc/orthanc_sdk.py
391 392 393 |
|
CreateDicomInstance(*args)
Generated from C function OrthancPluginCreateDicomInstance()
Source code in pyorthanc/orthanc_sdk.py
396 397 398 |
|
CreateFindMatcher(*args)
Generated from C function OrthancPluginCreateFindMatcher()
Source code in pyorthanc/orthanc_sdk.py
401 402 403 |
|
CreateImage(*args)
Generated from C function OrthancPluginCreateImage()
Source code in pyorthanc/orthanc_sdk.py
406 407 408 |
|
CreateImageFromBuffer(*args)
None
Source code in pyorthanc/orthanc_sdk.py
411 412 413 |
|
CreateMemoryBuffer(*args)
Generated from C function OrthancPluginCreateMemoryBuffer()
Source code in pyorthanc/orthanc_sdk.py
416 417 418 |
|
DecodeDicomImage(*args)
Generated from C function OrthancPluginDecodeDicomImage()
Source code in pyorthanc/orthanc_sdk.py
421 422 423 |
|
DicomBufferToJson(*args)
Generated from C function OrthancPluginDicomBufferToJson()
Source code in pyorthanc/orthanc_sdk.py
426 427 428 |
|
DicomInstanceToJson(*args)
Generated from C function OrthancPluginDicomInstanceToJson()
Source code in pyorthanc/orthanc_sdk.py
431 432 433 |
|
ExtendOrthancExplorer(*args)
Generated from C function OrthancPluginExtendOrthancExplorer()
Source code in pyorthanc/orthanc_sdk.py
436 437 438 |
|
GenerateRestApiAuthorizationToken(*args)
Generated from C function OrthancPluginGenerateRestApiAuthorizationToken()
Source code in pyorthanc/orthanc_sdk.py
441 442 443 |
|
GenerateUuid(*args)
Generated from C function OrthancPluginGenerateUuid()
Source code in pyorthanc/orthanc_sdk.py
446 447 448 |
|
GetCommandLineArgument(*args)
Generated from C function OrthancPluginGetCommandLineArgument()
Source code in pyorthanc/orthanc_sdk.py
451 452 453 |
|
GetCommandLineArgumentsCount(*args)
Generated from C function OrthancPluginGetCommandLineArgumentsCount()
Source code in pyorthanc/orthanc_sdk.py
456 457 458 |
|
GetConfiguration(*args)
Generated from C function OrthancPluginGetConfiguration()
Source code in pyorthanc/orthanc_sdk.py
461 462 463 |
|
GetConfigurationPath(*args)
Generated from C function OrthancPluginGetConfigurationPath()
Source code in pyorthanc/orthanc_sdk.py
466 467 468 |
|
GetDicomForInstance(*args)
Generated from C function OrthancPluginGetDicomForInstance()
Source code in pyorthanc/orthanc_sdk.py
471 472 473 |
|
GetErrorDescription(*args)
Generated from C function OrthancPluginGetErrorDescription()
Source code in pyorthanc/orthanc_sdk.py
476 477 478 |
|
GetExpectedDatabaseVersion(*args)
Generated from C function OrthancPluginGetExpectedDatabaseVersion()
Source code in pyorthanc/orthanc_sdk.py
481 482 483 |
|
GetFontName(*args)
Generated from C function OrthancPluginGetFontName()
Source code in pyorthanc/orthanc_sdk.py
486 487 488 |
|
GetFontSize(*args)
Generated from C function OrthancPluginGetFontSize()
Source code in pyorthanc/orthanc_sdk.py
491 492 493 |
|
GetFontsCount(*args)
Generated from C function OrthancPluginGetFontsCount()
Source code in pyorthanc/orthanc_sdk.py
496 497 498 |
|
GetGlobalProperty(*args)
Generated from C function OrthancPluginGetGlobalProperty()
Source code in pyorthanc/orthanc_sdk.py
501 502 503 |
|
GetOrthancDirectory(*args)
Generated from C function OrthancPluginGetOrthancDirectory()
Source code in pyorthanc/orthanc_sdk.py
506 507 508 |
|
GetOrthancPath(*args)
Generated from C function OrthancPluginGetOrthancPath()
Source code in pyorthanc/orthanc_sdk.py
511 512 513 |
|
GetPeers(*args)
Generated from C function OrthancPluginGetPeers()
Source code in pyorthanc/orthanc_sdk.py
516 517 518 |
|
GetTagName(*args)
Generated from C function OrthancPluginGetTagName()
Source code in pyorthanc/orthanc_sdk.py
521 522 523 |
|
HttpDelete(*args)
Generated from C function OrthancPluginHttpDelete()
Source code in pyorthanc/orthanc_sdk.py
526 527 528 |
|
HttpGet(*args)
Generated from C function OrthancPluginHttpGet()
Source code in pyorthanc/orthanc_sdk.py
531 532 533 |
|
HttpPost(*args)
Generated from C function OrthancPluginHttpPost()
Source code in pyorthanc/orthanc_sdk.py
536 537 538 |
|
HttpPut(*args)
Generated from C function OrthancPluginHttpPut()
Source code in pyorthanc/orthanc_sdk.py
541 542 543 |
|
LogError(*args)
Generated from C function OrthancPluginLogError()
Source code in pyorthanc/orthanc_sdk.py
546 547 548 |
|
LogInfo(*args)
Generated from C function OrthancPluginLogInfo()
Source code in pyorthanc/orthanc_sdk.py
551 552 553 |
|
LogWarning(*args)
Generated from C function OrthancPluginLogWarning()
Source code in pyorthanc/orthanc_sdk.py
556 557 558 |
|
LookupDictionary(*args)
None
Source code in pyorthanc/orthanc_sdk.py
561 562 563 |
|
LookupInstance(*args)
Generated from C function OrthancPluginLookupInstance()
Source code in pyorthanc/orthanc_sdk.py
566 567 568 |
|
LookupPatient(*args)
Generated from C function OrthancPluginLookupPatient()
Source code in pyorthanc/orthanc_sdk.py
571 572 573 |
|
LookupSeries(*args)
Generated from C function OrthancPluginLookupSeries()
Source code in pyorthanc/orthanc_sdk.py
576 577 578 |
|
LookupStudy(*args)
Generated from C function OrthancPluginLookupStudy()
Source code in pyorthanc/orthanc_sdk.py
581 582 583 |
|
LookupStudyWithAccessionNumber(*args)
Generated from C function OrthancPluginLookupStudyWithAccessionNumber()
Source code in pyorthanc/orthanc_sdk.py
586 587 588 |
|
ReadFile(*args)
Generated from C function OrthancPluginReadFile()
Source code in pyorthanc/orthanc_sdk.py
591 592 593 |
|
RegisterDictionaryTag(*args)
Generated from C function OrthancPluginRegisterDictionaryTag()
Source code in pyorthanc/orthanc_sdk.py
596 597 598 |
|
RegisterErrorCode(*args)
Generated from C function OrthancPluginRegisterErrorCode()
Source code in pyorthanc/orthanc_sdk.py
601 602 603 |
|
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
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 |
|
RegisterIncomingCStoreInstanceFilter(*args)
None
Source code in pyorthanc/orthanc_sdk.py
637 638 639 |
|
RegisterIncomingHttpRequestFilter(*args)
None
Source code in pyorthanc/orthanc_sdk.py
642 643 644 |
|
RegisterMoveCallback(func)
None
Source code in pyorthanc/orthanc_sdk.py
647 648 649 |
|
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
652 653 654 |
|
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
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 |
|
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
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 |
|
RegisterPrivateDictionaryTag(*args)
Generated from C function OrthancPluginRegisterPrivateDictionaryTag()
Source code in pyorthanc/orthanc_sdk.py
715 716 717 |
|
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
720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 |
|
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
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 |
|
RegisterStorageArea(*args)
None
Source code in pyorthanc/orthanc_sdk.py
774 775 776 |
|
RegisterStorageCommitmentScpCallback(*args)
None
Source code in pyorthanc/orthanc_sdk.py
779 780 781 |
|
RegisterWorklistCallback(*args)
None
Source code in pyorthanc/orthanc_sdk.py
784 785 786 |
|
RestApiDelete(*args)
Generated from C function OrthancPluginRestApiDelete()
Source code in pyorthanc/orthanc_sdk.py
789 790 791 |
|
RestApiDeleteAfterPlugins(*args)
Generated from C function OrthancPluginRestApiDeleteAfterPlugins()
Source code in pyorthanc/orthanc_sdk.py
794 795 796 |
|
RestApiGet(*args)
Generated from C function OrthancPluginRestApiGet()
Source code in pyorthanc/orthanc_sdk.py
799 800 801 |
|
RestApiGetAfterPlugins(*args)
Generated from C function OrthancPluginRestApiGetAfterPlugins()
Source code in pyorthanc/orthanc_sdk.py
804 805 806 |
|
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
809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 |
|
RestApiPostAfterPlugins(*args)
Generated from C function OrthancPluginRestApiPostAfterPlugins()
Source code in pyorthanc/orthanc_sdk.py
828 829 830 |
|
RestApiPut(*args)
Generated from C function OrthancPluginRestApiPut()
Source code in pyorthanc/orthanc_sdk.py
833 834 835 |
|
RestApiPutAfterPlugins(*args)
Generated from C function OrthancPluginRestApiPutAfterPlugins()
Source code in pyorthanc/orthanc_sdk.py
838 839 840 |
|
SetDescription(*args)
Generated from C function OrthancPluginSetDescription()
Source code in pyorthanc/orthanc_sdk.py
843 844 845 |
|
SetGlobalProperty(*args)
Generated from C function OrthancPluginSetGlobalProperty()
Source code in pyorthanc/orthanc_sdk.py
848 849 850 |
|
SetMetricsValue(*args)
Generated from C function OrthancPluginSetMetricsValue()
Source code in pyorthanc/orthanc_sdk.py
853 854 855 |
|
SetRootUri(*args)
Generated from C function OrthancPluginSetRootUri()
Source code in pyorthanc/orthanc_sdk.py
858 859 860 |
|
TranscodeDicomInstance(*args)
Generated from C function OrthancPluginTranscodeDicomInstance()
Source code in pyorthanc/orthanc_sdk.py
863 864 865 |
|
UncompressImage(*args)
Generated from C function OrthancPluginUncompressImage()
Source code in pyorthanc/orthanc_sdk.py
868 869 870 |
|
WriteFile(*args)
Generated from C function OrthancPluginWriteFile()
Source code in pyorthanc/orthanc_sdk.py
873 874 875 |
|