Mercurial > hg > orthanc-book
comparison Sphinx/source/users/anonymization.rst @ 970:bc531449c024
altering the content of a single instance
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 24 Aug 2023 09:56:03 +0200 |
parents | a6bf749b3c04 |
children | 1316bc62b5d5 |
comparison
equal
deleted
inserted
replaced
969:7abb7c8ff544 | 970:bc531449c024 |
---|---|
409 * ``Resources`` gives the list of source studies or source series | 409 * ``Resources`` gives the list of source studies or source series |
410 that are to be merged into the target study. | 410 that are to be merged into the target study. |
411 * ``KeepSource`` (Boolean value), if set to ``true``, instructs | 411 * ``KeepSource`` (Boolean value), if set to ``true``, instructs |
412 Orthanc to keep the source studies and series. By default, the | 412 Orthanc to keep the source studies and series. By default, the |
413 original resources are deleted from Orthanc. | 413 original resources are deleted from Orthanc. |
414 | |
415 | |
416 .. _altering-dicom: | |
417 | |
418 Altering the content of a single instance | |
419 ----------------------------------------- | |
420 | |
421 People often want to add/remove specific DICOM tags in an existing | |
422 DICOM instance, i.e. to ask ``/instances/{id}/modify`` to keep the | |
423 existing ``SOPInstanceUID (0008,0018)``. This operation is **strongly | |
424 discouraged**, as it **breaks medical traceability** by dropping the | |
425 history of the modifications that were applied to a DICOM | |
426 instance. Furthermore, the altered DICOM instance may be ignored by | |
427 further DICOM software. Indeed, the DICOM standard expects two DICOM | |
428 instances with the same SOP Instance UID to contain exactly the same | |
429 set of DICOM tags. Consequently, a DICOM software could perfectly | |
430 decide to only consider the original version of the DICOM instance. | |
431 | |
432 Consequently, **Orthanc implements safeguards** in its REST API to | |
433 avoid such dangerous situations to occur. That being said, **if you | |
434 understand the risks**, it is possible to bypass those safeguards. The | |
435 trick is to pass both the ``Keep`` and ``Force`` arguments to the | |
436 ``/instances/{id}/modify`` call. Here is a sample Python script that | |
437 implements this trick: | |
438 | |
439 .. literalinclude:: anonymization_bypass.py | |
440 :language: python | |
441 | |
442 This sample script downloads an altered version of a DICOM instance | |
443 from Orthanc (with the same ``SOPInstanceUID``), then uploads it again | |
444 to Orthanc. By default, Orthanc will ignore the upload of the altered | |
445 DICOM instance and will answer with the ``AlreadyStored`` message, | |
446 because ``SOPInstanceUID`` is already present in the Orthanc database. | |
447 To force the upload of the altered DICOM instance, one can either | |
448 (1) DELETE the instance before POST-ing it again, or (2) set the | |
449 ``OverwriteInstances`` :ref:`configuration option <configuration>` of | |
450 Orthanc to ``true``. Both strategies are implemented in the sample | |
451 script. |