Untitled
unknown
plain_text
a year ago
647 B
0
Indexable
Never
# -*- coding: utf-8 -*- """ Created on Sat May 13 23:25:56 2023 @author: suyas """ import tifffile import numpy as np # Path to your TIFF file tiff_file = 'D:/btp/master.tif' # Read the TIFF file using tifffile.imread() image_data = tifffile.imread(tiff_file) arr_float16 = image_data.astype(np.float16) # Normalize the data to the range [0, 1] normalized_data = np.float16(arr_float16 - np.min(image_data)) / np.float16(np.max(image_data) - np.min(image_data)) # Save the normalized data to a new TIFF file normalized_tiff_file = 'D:/btp/master_normalized.tif' tifffile.imwrite(normalized_tiff_file, normalized_data)