Skip to content

Commit

Permalink
Use same factor for all images (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefsmeets committed Dec 18, 2023
1 parent 1a58f4c commit 51fcae4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scripts/process_dm.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,16 @@ def extract_image_number(s):
j = extract_image_number(fn)
img = np.array(Image.open(fn))

if img.dtype != np.uint16:
# cast to 16 bit uint16
img = rescale_intensity(img, out_range='uint16')

h = {'ImageGetTime': timestamp, 'ImageExposureTime': exposure_time}
buffer.append((j, img, h))

if img.dtype != np.uint16:
max_val = max(img.max() for _, img, _ in buffer)
min_val = min(img.min() for _, img, _ in buffer)
for item in buffer:
# cast to 16 bit uint16
item[1] = rescale_intensity(item[1], out_range='uint16', in_range=(min_val, max_val))

img_conv = ImgConversion(buffer=buffer,
osc_angle=osc_angle,
start_angle=start_angle,
Expand Down

0 comments on commit 51fcae4

Please sign in to comment.