Demo: Training data generation for combined denoising and upsamling of synthetic 3D data

This notebook demonstrates training data generation for a combined denoising and upsampling task of synthetic 3D data, where corresponding pairs of isotropic low and high quality stacks can be acquired. Anisotropic distortions along the Z axis will be simulated for the low quality stack, such that a CARE model trained on this data can be applied to images with anisotropic resolution along Z.

We will use only a few synthetically generated stacks for training data generation, whereas in your application you should aim to use stacks from different developmental timepoints to ensure a well trained 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 download_and_extract_zip_file, plot_some, axes_dict
from import save_training_data
from import RawData, create_patches
from import anisotropic_distortions

Download example data

First we download some example data, consisting of a synthetic 3D stacks with membrane-like structures.

In [2]:
download_and_extract_zip_file (
    url       = '',
    targetdir = 'data',
Files missing, downloading... extracting... done.

- 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 XZ slices of a training stack pair:

In [3]:
y = imread('data/synthetic_upsampling/training_stacks/high/stack_00.tif')
x = imread('data/synthetic_upsampling/training_stacks/low/stack_00.tif')
print('image size =', x.shape)

          title_list=[['XY slice (low)','XY slice (high)']],

          title_list=[['XZ slice (low)','XZ slice (high)']],
image size = (128, 512, 512)