reshape_and_normalize_data#

cellpose_omni.transforms.reshape_and_normalize_data(train_data, test_data=None, channels=None, channel_axis=0, normalize=True, omni=False, dim=2)[source]#

inputs converted to correct shapes for training and rescaled so that 0.0=1st percentile and 1.0=99th percentile of image intensities in each channel

Parameters
  • train_data (list of ND-arrays, float) -- list of training images of size [Ly x Lx], [nchan x Ly x Lx], or [Ly x Lx x nchan]

  • test_data (list of ND-arrays, float (optional, default None)) -- list of testing images of size [Ly x Lx], [nchan x Ly x Lx], or [Ly x Lx x nchan]

  • channels (list of int of length 2 (optional, default None)) -- First element of list is the channel to segment (0=grayscale, 1=red, 2=green, 3=blue). Second element of list is the optional nuclear channel (0=none, 1=red, 2=green, 3=blue). For instance, to train on grayscale images, input [0,0]. To train on images with cells in green and nuclei in blue, input [2,3].

  • normalize (bool (optional, True)) -- normalize data so 0.0=1st percentile and 1.0=99th percentile of image intensities in each channel

Returns

  • train_data (list of ND-arrays, float) -- list of training images of size [2 x Ly x Lx]

  • test_data (list of ND-arrays, float (optional, default None)) -- list of testing images of size [2 x Ly x Lx]

  • run_test (bool) -- whether or not test_data was correct size and is useable during training