16 lines
401 B
Python
16 lines
401 B
Python
import sys
|
|
import pydicom
|
|
|
|
|
|
def fmt_row(elem) -> str:
|
|
return f'<tr><td><code>{str(elem.tag)[1:-1].replace(" ", "")}</code></td><td>{elem.name}</td><td>{elem.repval}</td></tr>'
|
|
|
|
|
|
dcm = pydicom.dcmread(sys.argv[1], force=True, stop_before_pixels=True)
|
|
|
|
print('<table>')
|
|
print('<tr><th>Tag</th><th>Name</th><th>Value</th></tr>')
|
|
for elem in dcm.iterall():
|
|
print(fmt_row(elem))
|
|
|
|
print('</table>')
|