Spaces:
Sleeping
Sleeping
File size: 351 Bytes
8e0b903 |
1 2 3 4 5 6 7 8 9 10 11 |
import streamlit as st
import pydicom
import cv2
import numpy as np
@st.cache_resource
def convert_dcm_to_png(input_image_path, output_image_path='a.png'):
ds = pydicom.dcmread(input_image_path)
img = ds.pixel_array
img = cv2.normalize(img, None, 0, 255, cv2.NORM_MINMAX).astype(np.uint8)
cv2.imwrite(output_image_path, img) |