-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added illumination correction option
- Loading branch information
Victor Perez Meza
committed
Oct 31, 2024
1 parent
a7a0720
commit b02f3e7
Showing
4 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from basicpy import BaSiC | ||
import numpy as np | ||
|
||
def indices_per_channel(total_imgs,no_of_channels): | ||
#total_imgs in the stack | ||
img_indices=[ list( range(ch,total_imgs,no_of_channels) ) for ch in range( 0, no_of_channels ) ] | ||
return img_indices | ||
|
||
def extract_channel_imgs (stack,indices): | ||
return stack[indices,:,:] | ||
|
||
def apply_corr(uncorr_stack,no_of_channels): | ||
corr_stack=np.zeros( uncorr_stack.shape,dtype=uncorr_stack.dtype ) | ||
total_imgs=uncorr_stack.shape[0] | ||
indices=indices_per_channel(total_imgs, no_of_channels) | ||
basic = BaSiC(get_darkfield=False, smoothness_flatfield=1.0,fitting_mode = "approximate", sort_intensity = True) | ||
for ind_list in indices: | ||
uncorr_imgs=extract_channel_imgs(uncorr_stack, ind_list) | ||
basic.fit(uncorr_imgs) | ||
ffp=basic.flatfield | ||
corr_stack[ind_list,:,:]=np.uint16( np.clip( uncorr_imgs.astype(float)/ffp ,0, 65535) ) | ||
return corr_stack | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters