Skip to content
Snippets Groups Projects
Commit 1f9899fd authored by Hugo chauvet's avatar Hugo chauvet
Browse files

correct bug in multi emission filter and multi exposure

parent 086b44c8
No related branches found
No related tags found
No related merge requests found
......@@ -346,6 +346,9 @@ def correct_dark_white(images: str, dark: str = '', white: str = '' ,
# find the position in the white of this excitation
i_white_ex = all_white_ex_wavelength.index(img_ex_wavelengths)
# Print the paired
print(f'for channel {img_ch_names[chan]} pos {chan} in data use white position {i_white_ex}')
# Put the white (corrected from the dark of white) value at the good place in the new_white
n_white[0, 0, chan, 0] = final_white[0, 0, i_white_ex, 0]
......@@ -367,17 +370,28 @@ def correct_dark_white(images: str, dark: str = '', white: str = '' ,
diff_im_darks[diff_im_darks < 0 ] = 0
if version == 2:
powerEallfilter = np.copy(powerEstimation)
# Need to check all wavelength in the dataset
powerEallfilter = np.ones(images.shape[2])
# Check if the white has the same number of filter that the images
if diff_im_darks.shape[2] != len(powerEstimation):
# If not Need to find the visible to put it's power to one
i_vis=0
for chan in range(diff_im_darks.shape[2]):
if 'vis' in img_ch_names[chan].lower():
i_vis = chan
break
print(f'Visible power set to 1 on position {i_vis}')
powerEallfilter = np.insert(powerEstimation, i_vis, 1.0)
if 'vis' not in img_ch_names[chan].lower():
# get the excitation wavelength of the image for this channel
img_ex_wavelengths = get_mono_position(meta, chan)
# find the position in the white of this excitation
i_white_ex = all_white_ex_wavelength.index(img_ex_wavelengths)
# Print the paired
print(f'for channel {img_ch_names[chan]} pos {chan} in data use the power estimation position {i_white_ex}')
powerEallfilter[chan] = powerEstimation[i_white_ex]
else:
print(f'Power estimation set to 1 for channel {img_ch_names[chan]} pos {chan}')
# divide the data by the power estimation
diff_im_darks = diff_im_darks / powerEallfilter[None, None, :, None, None, None]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment