Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEA] Support PDF report as DCM #365

Closed
a-parida12 opened this issue Oct 9, 2022 · 5 comments
Closed

[FEA] Support PDF report as DCM #365

a-parida12 opened this issue Oct 9, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@a-parida12
Copy link

Is your feature request related to a problem? Please describe.
Most of the time we generate automatic reports in markdown format to be exported as pdf. It is possible to encapsulate the pdf inside a DCM to be stored back in the PACS/RIS systems.

Describe the solution you'd like
I have created this PyPI package (pdf2dcm)[https://github.com/a-parida12/pdf2dcm]. Wouldn't it be a good idea to integrate it within the deploy SDK to support storing PDF reports as DICOMs?

@a-parida12 a-parida12 added the enhancement New feature or request label Oct 9, 2022
@MMelQin
Copy link
Collaborator

MMelQin commented Oct 16, 2022

Thanks @a-parida12 for the issue. We had been discussing the need of DICOM Encapsulated PDF support for a bit, and since I had already contributed reusable code, it was a matter of properly arranging the classes and create the DICOM PDF IOD with very few lines of new code.

Please see the closed issue #362 and the closed pull request #366

Since content for DICOM Encapsulated PDF can come from many sources, e.g. scanned doc or dynamically created with certain template wrapping AI result, the decision was made to separate the generation of PDF from the DICOM PDF creation with the latter taking in the PDF bytes or a path to PDF file. This way, a user can create specifically formatted PDF generators for use with the App SDK writer. More flexibility, and the App SDK Application has been tailored made for support this paradigm.

Please see what can be enhanced and create PR to get your contribution in the SDK.

@a-parida12
Copy link
Author

# pip install pdf2dcm

from pdf2dcm import Pdf2EncapsDCM

converter = Pdf2EncapsDCM()
converted_dcm = converter.run(path_pdf='tests/test_data/test_file.pdf', path_template_dcm='tests/test_data/CT_small.dcm', suffix =".dcm")
print(converted_dcm)
# [ 'tests/test_data/test_file.dcm' ]

Could you please try this on the files that you internally test. path_template_dcm is optional and can be used add specific UID that helps matching the file and its corresponding report.

@MMelQin
Copy link
Collaborator

MMelQin commented Oct 24, 2022

# pip install pdf2dcm

from pdf2dcm import Pdf2EncapsDCM

converter = Pdf2EncapsDCM()
converted_dcm = converter.run(path_pdf='tests/test_data/test_file.pdf', path_template_dcm='tests/test_data/CT_small.dcm', suffix =".dcm")
print(converted_dcm)
# [ 'tests/test_data/test_file.dcm' ]

Could you please try this on the files that you internally test. path_template_dcm is optional and can be used add specific UID that helps matching the file and its corresponding report.

Hi @a-parida12, I did get you package a try, and found errors (semantical or design errors, not necessarily code error).

  • Your API optionally takes a template DCM file, for copying some tags. But your code copies the SOP instance UID, violating DICOM standard
  • Same error for the Series Instance UID

Writing a DICOM Encapsulated PDF is super simple, once the PDF bytes or file is available. The MONAI Deploy App SDK's DICOM PDF Writer has more features in that it gives the App dev users flexibility to associating the DICOM PDF instance with existing study or in a completely new study, supports setting important tags called for by IHE Profiles, properly setting the date/time/timezone even in on-cloud execution, etc.

Your implementation is a good attempt, but unfortunately does not satisfy App SDK requirements. Please use App SDK's DCOM PDF Writer.

@a-parida12
Copy link
Author

@MMelQin Thanks for running the analysis and pointing out the flaws in the setup. I will work on improving it on a later date. For now closing the issue as it does makes sense to keep it open.

@MMelQin
Copy link
Collaborator

MMelQin commented Oct 25, 2022

@MMelQin Thanks for running the analysis and pointing out the flaws in the setup. I will work on improving it on a later date. For now closing the issue as it does makes sense to keep it open.

@a-parida12 Thank you so much for your contribution. The DICOM Encapsulated PDF in the App SDK is designed to fit into App SDK realm, so I do see your standalone package is good for general use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants