コード例 #1
0
    - A copy of the Mayo dataset, see
    https://www.aapm.org/GrandChallenge/LowDoseCT/#registration
"""

from __future__ import division
import numpy as np
import os
import dicom
import odl
import tqdm

from dicom.datadict import DicomDictionary, NameDict, CleanName
from odl.contrib.datasets.ct.mayo_dicom_dict import new_dict_items

# Update the DICOM dictionary with the extra Mayo tags
DicomDictionary.update(new_dict_items)
NameDict.update((CleanName(tag), tag) for tag in new_dict_items)

__all__ = ('load_projections', 'load_reconstruction')


def _read_projections(folder, indices):
    """Read mayo projections from a folder."""
    datasets = []

    # Get the relevant file names
    file_names = sorted([f for f in os.listdir(folder) if f.endswith(".dcm")])

    if len(file_names) == 0:
        raise ValueError('No DICOM files found in {}'.format(folder))
コード例 #2
0
# -*- coding: utf-8 -*-
"""
Created on Thu Jul  2 14:45:55 2015

@author: sansomk
"""

# D. Mason, Aug 2009 
from dicom.datadict import DicomDictionary, NameDict, CleanName 
import dicom 

new_dict_items = { 
0x10011001: ('UL', '1', "Test One", ''), 
0x10011002: ('OB', '1', "Test Two", ''), 
0x10011003: ('UI', '1', "Test Three", ''), 
} 
DicomDictionary.update(new_dict_items) 

new_names_dict = dict([(CleanName(tag), tag) for tag in 
new_dict_items]) 
NameDict.update(new_names_dict) 

filename = r"c:\co\pydicom\source\dicom\testfiles\CT_small.dcm" 
ds = dicom.read_file(filename) 

ds.TestOne = 42 
ds.TestTwo = '12345' 
ds.TestThree = '1.2.3.4.5' 

print ds.top()