QIICR / dcmqi

dcmqi (DICOM for Quantitative Imaging) is a free, open source C++ library for conversion between imaging research formats and the standard DICOM representation for image analysis results
https://qiicr.gitbook.io/dcmqi-guide/
BSD 3-Clause "New" or "Revised" License
232 stars 62 forks source link

ENH: Added detailed logging option to itkimage2segimage and segimage2itkimage #409

Closed lassoan closed 3 years ago

lassoan commented 3 years ago

I had really hard time figuring out why segmentation export fails, and it turned out that the in the input DICOM images ProcedureCodeSequence was defined but did not contain any items, and because of this DCMTK refused to create the segmentation object. It took several hours of debugging to investigate this issue.

Along the way, I realized that DCMTK provides pretty detailed logging of all relevant details, but this logging is not enabled. To prevent such tedious investigations in the future, I added a --verbose command-line switch to segmentation converters, which enable printing of detailed information. It prints debug-level messages, which can be quite detailed, so by default the switch is disabled.

fedorov commented 3 years ago

@lassoan is this a Windows issue? For example, looking at this issue https://github.com/QIICR/dcmqi/issues/348, the warnings/errors are already being shown on the console. Or is this PR adding even further error reporting? I am not sure I have a problematic dataset handy to test this.

But I do not object to the PR - thank you for this contribution!

lassoan commented 3 years ago

No DCMTK logs appear on Windows by default. DCMTK uses log4cplus, which can may initialize logging settings from some system defaults, which may explain why some logs appeared on that configuration. The default configurator enables debug-level logging, so it provides more details anyway.

You can reproduce the problem if you want to export a segmentation for the CT volumein TCIA's TCGA-CV-A6JN data set. I also copied the input files here: https://1drv.ms/u/s!Arm_AFxB9yqHxKRuA_mba8epTDT0gQ?e=DzHlOs