Skip to content

Instantly share code, notes, and snippets.

View asvcode's full-sized avatar

asvcode

View GitHub Profile
plt.imshow(patient6.windowed(l=100, w=700), cmap=plt.cm.bone);
plt.imshow(patient6.windowed(*dicom_windows.mediastinum), cmap=plt.cm.bone);
plt.imshow(patient6.windowed(*dicom_windows.lungs), cmap=plt.cm.bone);
high_level = patient6.windowed(w=200, l=200)
low_level = patient6.windowed(w=200, l=-200)
show_images([high_level, low_level], titles=['high window level', 'low window level'], figsize=(7,7))
high_width = patient6.windowed(w=1000, l=40)
low_width = patient6.windowed(w=100, l=40)
show_images([high_width, low_width], titles=['high window width', 'low window width'], figsize=(7,7))
windowed_image = cropped.windowed(*dicom_windows.lungs)
show_image(windowed_image, cmap=plt.cm.bone);
dfs = pd.DataFrame(windowed_image)
#uncomment below to view locally
#dfs.style.set_properties(**{'font-size':'6pt'}).background_gradient('bone').format("{:.1f}")
df = pd.DataFrame(cropped)
#uncomment below to view locally
#df.style.set_properties(**{'font-size':'8pt'}).background_gradient('bone').format("{:.1f}")
cropped = scaled[340:385,300:350]
show_image(cropped, cmap='bone');
from fastai.vision.all import *
from fastai.medical.imaging import *
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = (7,7)
source = 'D:/Datasets/rsna_pulmonary'
files = get_dicom_files(source)
patient6 = files[6].dcmread()