Medical Image Preprocessing with python
1. Load data and get to know the meta data import pydicom raw_medical_image = pydicom.read_file(file_path) print(raw_medical_image) medical_image = raw_medical_image.pixel_array plt.imshow(medical_image, cmap='gray') # cmap -- color map 2. Five steps of processing 2.1 Transforming to HU: obtain the HU by using Rescale_Intercept and Rescale_Slope headers: hu_image = image * medical_image.RescaleSlope + medical_image.RescaleIntercept #window_image: img_min = window_center - window_width // 2 img_max = window_center + window_width // 2 window_image = image.copy() window_image[window_image < img_min] = img_min window_image[window_image > img_max] = img_max 2.2 Removing Noises segmentation = morphology.
…