Skip to content

Instantly share code, notes, and snippets.

View neurosnap's full-sized avatar

Eric Bower neurosnap

View GitHub Profile
@neurosnap
neurosnap / gist:3a1824c31643367bbb0e
Created June 30, 2014 13:29
gdcmswig.py -- DataElement
class DataElement(_object):
"""
Class to represent a Data Element either Implicit or Explicit.
DATA ELEMENT: A unit of information as defined by a single entry in
the data dictionary. An encoded Information Object Definition ( IOD)
Attribute that is composed of, at a minimum, three fields: a Data
Element Tag, a Value Length, and a Value Field. For some specific
Transfer Syntaxes, a Data Element also contains a VR Field where the
Value Representation of that Data Element is specified explicitly.
upstream eaa_app_server {
server unix:/srv/www/eaa/run/gunicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name eaa.neurosnap.net;
client_max_body_size 4G;
@neurosnap
neurosnap / gist:9360098
Created March 5, 2014 02:31
Anonymize a DICOM
def anonymize(filename, output_filename, new_person_name="anonymous",
new_patient_id="id", remove_curves=True, remove_private_tags=True):
def sanitize_html(dataset):
"""Removing all potential XSS attacks embedded within the dicom file"""
dataset.walk(sanitize_callback)
return dataset
def sanitize_callback(dataset, data_element):
"""Call from dataset "walk" recursive function for all data elements. """