Demo: Training data generation for isotropic reconstruction of Zebrafish retina

This notebook demonstrates training data generation for an isotropic reconstruction task, where the anisotropic distortions along the undersampled Z axis are simulated from isotropic 2D slices.

Note that training data can be created from existing acquisitions.

We will use a single Retina stack 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 single 3D Zebrafish retina stack.

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

- retina
- retina/cropped_farred_RFP_GFP_2109175_2color_sub_10.20.tif

We plot XY and XZ slices of the training stack:

In [3]:
x = imread('data/retina/cropped_farred_RFP_GFP_2109175_2color_sub_10.20.tif')
subsample = 10.2
print('image size         =', x.shape)
print('Z subsample factor =', subsample)

          title_list=[['XY slice','XY slice']],

          title_list=[['XZ slice','XZ slice']],
          pmin=2,pmax=99.8, aspect=subsample);
image size         = (35, 2, 768, 768)
Z subsample factor = 10.2