Mercurial > hg > orthanc-book
view Sphinx/source/plugins/python/multiprocessing-3.py @ 830:21a522ca4ce9
osimis/orthanc Docker: links to Github
author | Alain Mazy <am@osimis.io> |
---|---|
date | Fri, 25 Mar 2022 17:30:48 +0100 |
parents | 6e02cd89eb6a |
children |
line wrap: on
line source
import pydicom import io def OffloadedDicomParsing(dicom): # No access to the "orthanc" library here, as we are in the slave process dataset = pydicom.dcmread(io.BytesIO(dicom)) return str(dataset) def OnRest(output, uri, **request): # The call to "orthanc.RestApiGet()" is only possible in the master process dicom = orthanc.RestApiGet('/instances/19816330-cb02e1cf-df3a8fe8-bf510623-ccefe9f5/file') answer = POOL.apply(OffloadedDicomParsing, args = (dicom, )) output.AnswerBuffer(answer, 'text/plain')