Python convert .dcm to .png, images are too bright
问题 I have to convert some files which come by default as .dcm to .png , I've found some code samples to achieve that around here but the end results are too bright. Could anybody have a look at this, please? def convert_to_png(file): ds = pydicom.dcmread(file) shape = ds.pixel_array.shape # Convert to float to avoid overflow or underflow losses. image_2d = ds.pixel_array.astype(float) # Rescaling grey scale between 0-255 image_2d_scaled = (np.maximum(image_2d,0) / image_2d.max()) * 255.0 #