Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/tapenade/preprocessing/_intensity_normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ def _normalize_intensity(
array_norm[sl_norm]
) / np.nanmedian(array[sl])

if np.isnan(array_normalization_factor) or array_normalization_factor == 0 or np.isinf(array_normalization_factor):
print(
"Normalization factor is NaN or inf or zero. "
"Check whether the signals are not saturated by 0s."
)

array_normalization_factor = np.nanmean(array_norm[sl_norm]) / np.nanmean(array[sl])

array_norm = array_norm / array_normalization_factor

return array_norm
16 changes: 12 additions & 4 deletions src/tapenade/reconstruction/_reconstruct.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,22 @@ def create_folders(
Path(folder_sample / "weights" / "before_trsf").mkdir(exist_ok=True)
Path(folder_sample / "weights" / "after_trsf").mkdir(exist_ok=True)

image_ref = io.imread(Path(folder_experiment) / f"{filename_ref}.tif")
image_float = io.imread(
# image_ref = io.imread(Path(folder_experiment) / f"{filename_ref}.tif")
# image_float = io.imread(
# Path(folder_experiment) / f"{filename_float}.tif"
# )
image_ref = tifffile.imread(Path(folder_experiment) / f"{filename_ref}.tif")
image_float = tifffile.imread(
Path(folder_experiment) / f"{filename_float}.tif"
)


if len(channels) > 1:
for ind_ch, ch in enumerate(channels):
imref = image_ref[:, :, :, ind_ch]
imfloat = image_float[:, :, :, ind_ch]
# imref = image_ref[:, :, :, ind_ch]
# imfloat = image_float[:, :, :, ind_ch]
imref=image_ref[:,ind_ch,:,:]
imfloat=image_float[:,ind_ch,:,:]
io.imsave(
Path(folder_sample) / "raw" / f"{filename_ref}_{ch}.tif",
imref, ##CAREFUL needs to be float32 or uint16 orint16 otherwise the blockmatching does not compute/save the result
Expand Down
Loading