Skip to content

Instantly share code, notes, and snippets.

@pieper pieper/gist:6186477
Last active Dec 20, 2015

Embed
What would you like to do?
"""
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

This comment has been minimized.

Copy link
Owner Author

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
You can’t perform that action at this time.