Skip to content

Instantly share code, notes, and snippets.

@pieper
Last active December 20, 2015 19:58
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save pieper/6186477 to your computer and use it in GitHub Desktop.
"""
The following can be pasted into the python console to examine the headers
of all the dicom objects in the database
"""
import DICOMLib
parent = qt.QWidget()
layout = qt.QVBoxLayout()
parent.setLayout(layout)
slider = ctk.ctkSliderWidget()
header = DICOMLib.DICOMHeaderWidget(parent)
layout.addWidget(slider)
layout.addWidget(header.widget)
parent.show()
db = slicer.dicomDatabase
files = []
for patient in db.patients():
for study in db.studiesForPatient(patient):
for series in db.seriesForStudy(study):
for file in db.filesForSeries(series):
files.append(file)
slider.decimals = 0
slider.maximum = len(files)-1
callback = lambda v: header.setHeader(files[int(v)])
slider.connect('valueChanged(double)',callback)
# dcmdump + textBrowser option
textBrowser = qt.QTextBrowser()
layout.addWidget(textBrowser)
callback = lambda v: textBrowser.setText(str(DICOMLib.DICOMCommand('dcmdump', [files[int(v)]] ).start()))
slider.connect('valueChanged(double)',callback)
@pieper
Copy link
Author

pieper commented Oct 11, 2013

Just paste this into the python interpreter and it will let you look at all the headers in your database. Use the raw text link (click on the icon on the top right that looks like <> next to the little chain link icon.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment