application_vnd.jupyter.stderr_output_1.png
import cv2

import os

import os

import pydicom

import numpy as np
import pandas as pd
import os

import cv2
import os
import pydicom
inputdir = '../input/sample images/'
outdir = './'
test_list = [os.path.basename(x) for x in glob.glob(inputdir + './*.dcm')]
for f in test_list:
    ds = pydicom.read_file(inputdir + f)
    img = ds.pixel_array
    cv2.imwrite(outdir + f.replace('.dcm', '.png'), img)