View Issue Details

IDProjectCategoryView StatusLast Update
0004342Slicer4Core: Scripting (Wrapping, Python)public2018-05-29 23:19
ReporterkevinmaderAssigned Tojcfr 
Status assignedResolutionopen 
PlatformMacOSOS X OS Version10.12.3
Product VersionSlicer 4.6.1 
Target VersionbacklogFixed in Version 
Summary0004342: JSON Serializer creates invalid JSON files for DICOM tags

While not strictly speaking a Slicer problem, the issue could pose major issues for archiving or sending information via JSON from DICOM.
The json serializer creates invalid JSON files if there are DICOM tags involved since it incorrectly uses the string representation of these TupleTags (a tuple) which is not supported in JSON. There is no error or warning message given and the data must be manually reworked in order to be read in again. The problem arose when trying to save all the header tags from a working set of images into a JSON for later post-processing.

Steps To Reproduce

import json
from dicom.tag import TupleTag
out_json_str = json.dumps(TupleTag((123,456))) # '(007b, 01c8)'
json.loads(out_json_str) # ValueError: No JSON object could be decoded

Additional Information

In Python 3.6 with dicom 0.9.9 it works correctly returning 8061384 for the JSON loads (since the tag is a subtype of long)

TagsNo tags attached.




2018-05-29 23:19

developer   ~0015780

Retargeting stale issues to backlog.

Issue History

Date Modified Username Field Change
2017-02-10 19:58 kevinmader New Issue
2017-02-10 19:58 kevinmader Status new => assigned
2017-02-10 19:58 kevinmader Assigned To => jcfr
2018-05-29 23:19 lassoan Target Version => backlog
2018-05-29 23:19 lassoan Note Added: 0015780