diff --git a/scripts/process_dm.py b/scripts/process_dm.py index 1de82c9b..7691be97 100644 --- a/scripts/process_dm.py +++ b/scripts/process_dm.py @@ -2,6 +2,7 @@ from pathlib import Path import numpy as np +from skimage.exposure import rescale_intensity from PIL import Image from instamatic.processing.ImgConversionDM import ImgConversionDM as ImgConversion @@ -123,7 +124,7 @@ def extract_image_number(s): if img.dtype != np.uint16: # cast to 16 bit uint16 - img = (2**16 - 1) * (img - img.min()) / (img.max() - img.min()) + img = rescale_intensity(img, out_range='uint16') h = {'ImageGetTime': timestamp, 'ImageExposureTime': exposure_time} buffer.append((j, img, h))