This notebook demonstrates applying a CARE model for a combined denoising and upsampling 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
More documentation is available at http://csbdeep.bioimagecomputing.com/doc/.
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 csbdeep.io import save_tiff_imagej_compatible from csbdeep.models import UpsamplingCARE
Using TensorFlow backend.
download_and_extract_zip_file ( url = 'http://csbdeep.bioimagecomputing.com/example_data/synthetic_upsampling.zip', targetdir = 'data', )
Files found, nothing to download. data: - synthetic_upsampling - synthetic_upsampling/test_stacks_sub_4 - synthetic_upsampling/test_stacks_sub_4/stack_low_sub_4_03.tif - synthetic_upsampling/training_stacks - synthetic_upsampling/training_stacks/high - synthetic_upsampling/training_stacks/high/stack_01.tif - synthetic_upsampling/training_stacks/high/stack_02.tif - synthetic_upsampling/training_stacks/high/stack_00.tif - synthetic_upsampling/training_stacks/low - synthetic_upsampling/training_stacks/low/stack_01.tif - synthetic_upsampling/training_stacks/low/stack_02.tif - synthetic_upsampling/training_stacks/low/stack_00.tif
We plot XY and ZY slices of the stack and define the image axes and subsampling factor, which will be needed later for prediction.
x = imread('data/synthetic_upsampling/test_stacks_sub_4/stack_low_sub_4_03.tif') axes = 'ZYX' subsample = 4 print('image size =', x.shape) print('image axes =', axes) print('subsample factor =', subsample) plt.figure(figsize=(12,12)) plt.imshow(x,cmap='magma') plt.title('XY slice') plt.axis('off') plt.figure(figsize=(12,12)) plt.imshow(x[...,20],aspect=subsample,cmap='magma') plt.title('ZY slice') plt.axis('off') None;
image size = (32, 512, 512) image axes = ZYX subsample factor = 4