Conversion of non-standard DICOM files to DICOM P10 compliant files:

2,606 views
Skip to first unread message

ted...@gmail.com

unread,
Feb 28, 2016, 12:06:41 PM2/28/16
to Orthanc Users
Hi guys,

Is there a way/plugin to convert a non-standard DICOM file to a standards compliant DICOM P10 file? I am currently using orthanc as a WADO server, and cornerstone on the frontend to display the DICOM images. cornerstone's dicomParser is very strict with standard-compliance, and keeps throwing the following error:

Uncaught dicomParser.parseDicom: DICM prefix not found at location 132

I had posted this question on cornerstone platform's group below: https://groups.google.com/forum/#!topic/cornerstone-platform/n6lSGyjoS8g

Is there any way around this?

Sébastien Jodogne

unread,
Feb 29, 2016, 3:11:24 AM2/29/16
to Orthanc Users, ted...@gmail.com
Sorry, but cannot provide any guidance without having access to sample data.

Note that Orthanc never modifies the files it receives through the DICOM protocol (apart possible repadding). If the file is corrupted, it is not up to Orthanc to correct it, but to another software. Get in touch with the support team of the manufacturer that generates such non-compliant files instead: You pay them for helping you.

As an alternative, have you tried with Orthanc's official Web viewer plugin instead of going through WADO?

Chris Hafey

unread,
Feb 29, 2016, 7:08:00 AM2/29/16
to Orthanc Users, ted...@gmail.com
Hi Sebastian,

The problematic file is one without a DICM prefix (no P10 header). I suspect this may have been uploaded manually via the web app and not received via DICOM.  I believe the problem would be solved if Orthanc could ensure that files uploaded this way were always written with a P10 header when saved to disk.

Chris

Sébastien Jodogne

unread,
Feb 29, 2016, 7:18:44 AM2/29/16
to Orthanc Users, ted...@gmail.com
Hi Chris,

As long as Orthanc acts as expected by storing exactly what it receives through its Web interface, I feel it is not up to Orthanc to reconstruct this header.

It should be up to the manufacturer to comply with the DICOM standard, instead of asking Cornerstone or Orthanc to take care of buggy files.

Sébastien-

Chris Hafey

unread,
Feb 29, 2016, 7:41:41 AM2/29/16
to Orthanc Users, ted...@gmail.com
I agree that the manufacturer is to blame here, but Orthanc doesn't even warn the user that they are uploading non standard files right now.  Here are some possible solutions:

1) Only allow files with the P10 header to be uploaded via the web interface.  Files without the P10 header would be rejected/ignored.  
2) Support uploading of non P10 header files via the web interface, but ask the user if they want to add the P10 header or reject them
3) Support uploading of non P10 header files via the web interface and automatically add the P10 header

I don't think the current behavior is desired as it allows the user to store non standard data which will create interoperability problems like Ted is running into.  Personally I would like to see Orthanc act as a VNA would and only store DICOM as DICOM P10.  Option #3 would be the most convenient for the end user I think.

Chris

Chris Hafey

unread,
Feb 29, 2016, 7:42:46 AM2/29/16
to Orthanc Users, ted...@gmail.com
OH - and I should clarify that the root problem here is that DCMTK can parse these non standard files.  It has some kind of heuristic to detect them and deal with them which works most of the time, but not always...

Sébastien Jodogne

unread,
Feb 29, 2016, 8:13:46 AM2/29/16
to Orthanc Users, ted...@gmail.com
Option (3) is not acceptable for the core Orthanc project, as our policy consists in never modifying incoming files (besides of simple architectural changes such as repadding). This behavior could however be implemented with an Orthanc plugin that would overwrite the POST call to "/instances", then check/patch the incoming DICOM files. Check out how to develop plugins here:

Option (2) is neither acceptable, as this would require to make the REST API more complex because of a non-complying DICOM modality. This extension to the REST API would consist in adding a new callback taking the DICOM file together with a Boolean flag saying whether to be tolerant or no. Once again, this behavior could nonetheless be implemented as an Orthanc plugin that would extend the core REST API.

Option (1) is the only one that sounds acceptable for the core of Orthanc. I will introduce a configuration option saying to accept or reject files without a P10 header. 

Be warned that I have no time to work on the plugin for option (2) or (3), external contributions are welcome.

Sébastien-

Sébastien Jodogne

unread,
Feb 29, 2016, 8:26:03 AM2/29/16
to Orthanc Users, ted...@gmail.com
BTW, I would still need sample DICOM data from you, Ted.

ted...@gmail.com

unread,
Mar 1, 2016, 1:14:17 AM3/1/16
to Orthanc Users, ted...@gmail.com
Thanks a lot Chris and Sébastien for your help in this. Attached is the DICOM file
17cc7e52-4f1a3e4d-9182f727-56e9cc71-c037892f.zip

Sébastien Jodogne

unread,
Mar 1, 2016, 3:35:56 AM3/1/16
to Orthanc Users, ted...@gmail.com
Hello,

Thanks for providing this file, but according to dciodvfy, it does contain a P10 header. This file is invalid for other reasons that cannot be fixed simply by adding the header:

# dciodvfy ./2016-03-01-TedDicomWithoutP10.dcm 
Error - Illegal negative value - SpacingBetweenSlices = -0.7
Error - Value invalid for this VR - (0x0002,0x0013) SH Implementation Version Name  SH - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0008,0x0070) LO Manufacturer  LO - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0008,0x0080) LO Institution Name  LO - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0008,0x1010) SH Station Name  SH - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0008,0x1030) LO Study Description  LO - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0008,0x0104) LO Code Meaning  LO - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0008,0x1090) LO Manufacturer's Model Name  LO - Trailing character invalid for this VR = '' (0)
Warning - Value dubious for this VR - (0x0010,0x0010) PN Patient's Name  PN [0] = <PHENIX> - Retired Person Name form
Error - Value invalid for this VR - (0x0018,0x0022) CS Scan Options  CS - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0018,0x0050) DS Slice Thickness  DS - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0018,0x0060) DS KVP  DS - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0018,0x0090) DS Data Collection Diameter  DS - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0018,0x1020) LO Software Version(s)  LO - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0018,0x1100) DS Reconstruction Diameter  DS - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0018,0x1120) DS Gantry/Detector Tilt  DS - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0018,0x1130) DS Table Height  DS - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0018,0x1151) IS X-Ray Tube Current  IS - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0018,0x1152) IS Exposure  IS - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0018,0x1160) SH Filter Type  SH - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0018,0x1210) SH Convolution Kernel  SH - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0018,0x5100) CS Patient Position  CS - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0020,0x0032) DS Image Position (Patient)  DS - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0020,0x0037) DS Image Orientation (Patient)  DS - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0028,0x0004) CS Photometric Interpretation  CS - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0028,0x0030) DS Pixel Spacing  DS - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0028,0x1050) DS Window Center  DS - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0028,0x1051) DS Window Width  DS - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0028,0x1052) DS Rescale Intercept  DS - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0028,0x1053) DS Rescale Slope  DS - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0032,0x1032) PN Requesting Physician  PN - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0032,0x1060) LO Requested Procedure Description  LO - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0040,0x0007) LO Scheduled Procedure Step Description  LO - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0008,0x0104) LO Code Meaning  LO - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0040,0x0254) LO Performed Procedure Step Description  LO - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0008,0x0104) LO Code Meaning  LO - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0040,0x0007) LO Scheduled Procedure Step Description  LO - Trailing character invalid for this VR = '' (0)
Error - Value invalid for this VR - (0x0008,0x0104) LO Code Meaning  LO - Trailing character invalid for this VR = '' (0)
Error - Dicom dataset contains invalid data values for Value Representations
CTImage
Warning - Unrecognized defined term <XPLORE> for value 1 of attribute <Coding Scheme Designator>
Error - Missing attribute Type 2C Conditional Element=<Laterality> Module=<GeneralSeries>
Warning - Unrecognized defined term <XPLORE> for value 1 of attribute <Coding Scheme Designator>
Warning - Unrecognized defined term <XPLORE> for value 1 of attribute <Coding Scheme Designator>
Error - Missing attribute Type 2 Required Element=<PositionReferenceIndicator> Module=<FrameOfReference>
Error - Missing attribute Type 2 Required Element=<AcquisitionNumber> Module=<CTImage>
Warning - Attribute is not present in standard DICOM IOD - (0x0018,0x0088) DS Spacing Between Slices 
Warning - Attribute is not present in standard DICOM IOD - (0x0032,0x1032) PN Requesting Physician 
Warning - Attribute is not present in standard DICOM IOD - (0x0032,0x1060) LO Requested Procedure Description 
Warning - Attribute is not present in standard DICOM IOD - (0x0040,0x0007) LO Scheduled Procedure Step Description 
Warning - Attribute is not present in standard DICOM IOD - (0x0008,0x0100) SH Code Value 
Warning - Attribute is not present in standard DICOM IOD - (0x0008,0x0102) SH Coding Scheme Designator 
Warning - Attribute is not present in standard DICOM IOD - (0x0008,0x0104) LO Code Meaning 
Warning - Attribute is not present in standard DICOM IOD - (0x0040,0x0008) SQ Scheduled Protocol Code Sequence 
Warning - Attribute is not present in standard DICOM IOD - (0x0040,0x0009) SH Scheduled Procedure Step ID 
Warning - Attribute is not present in standard DICOM IOD - (0x0040,0x1001) SH Requested Procedure ID 
Warning - Dicom dataset contains attributes not present in standard DICOM IOD - this is a Standard Extended SOP Class

Chris Hafey

unread,
Mar 1, 2016, 9:29:07 AM3/1/16
to Orthanc Users, ted...@gmail.com
Sebastian is correct - this file does have a DICOM P10 header, parses correctly with dicomParser:


and displays properly with the cornerstoneWADOImageLoader:


Perhaps you uploaded the wrong file?

ted...@gmail.com

unread,
Mar 10, 2016, 8:22:42 PM3/10/16
to Orthanc Users, ted...@gmail.com
Hi guys,

Sorry for taking a while to reply. Thank you so much Chafey and Sebastian for your invaluable help in this. I went back and looked at this again.

Turns out when I use the orthanc endpoint as provided by Chafey on the WADOImageLoader github readme, it loads without any issues, and the dicomParser parses it successfully.

Here is the url: http://localhost:8042/instances/8cce70aa-576ad738-b76cb63f-caedb3c7-2b213aae/file

Here is the url I was using previously:
http://localhost:8042/wado?studyUID=2.16.840.1.113669.632.20.1211.10000098591&seriesUID=1.2.840.113704.1.111.5692.1127829280.6&objectUID=1.2.840.113704.1.111.6168.1127829443.11443&requestType=WADO

Thank you so much guys.

Reply all
Reply to author
Forward
0 new messages