Demo: Apply trained CARE model for denoising of Tribolium castaneum

This notebook demonstrates applying a CARE model for a 3D denoising task, assuming that training was already completed via 2_training.ipynb.
The trained model is assumed to be located in the folder models with the name my_model.

More documentation is available at

In [1]:
from __future__ import print_function, unicode_literals, absolute_import, division
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format = 'retina'

from tifffile import imread
from csbdeep.utils import Path, download_and_extract_zip_file, plot_some
from import save_tiff_imagej_compatible
from csbdeep.models import CARE
Using TensorFlow backend.

Download example data

The example data (also for testing) should have been downloaded in 1_datagen.ipynb.
Just in case, we will download it here again if it's not already present.

In [2]:
download_and_extract_zip_file (
    url       = '',
    targetdir = 'data',
Files found, nothing to download.

- tribolium
- tribolium/test
- tribolium/test/GT
- tribolium/test/GT/nGFP_0.1_0.2_0.5_20_14_late.tif
- tribolium/test/low
- tribolium/test/low/nGFP_0.1_0.2_0.5_20_14_late.tif
- tribolium/train
- tribolium/train/GT
- tribolium/train/GT/nGFP_0.1_0.2_0.5_20_13_late.tif
- tribolium/train/low
- tribolium/train/low/nGFP_0.1_0.2_0.5_20_13_late.tif

Raw low-SNR image and associated high-SNR ground truth

Plot the test stack pair and define its image axes, which will be needed later for CARE prediction.

In [3]:
y = imread('data/tribolium/test/GT/nGFP_0.1_0.2_0.5_20_14_late.tif')
x = imread('data/tribolium/test/low/nGFP_0.1_0.2_0.5_20_14_late.tif')

axes = 'ZYX'
print('image size =', x.shape)
print('image axes =', axes)

          title_list=[['low (maximum projection)','GT (maximum projection)']], 
image size = (45, 954, 486)
image axes = ZYX