tfmri.sampling.density_grid

density_grid(shape, inner_density=1.0, outer_density=1.0, inner_cutoff=0.0, outer_cutoff=1.0, transition_type='linear', name=None)[source]

Returns a density grid.

Creates a tensor containing a density grid. The density grid is a tensor of shape shape containing a density value for each point in the grid. The density of a given point can be interpreted as the probability of it being sampled.

The density grid has an inner region and an outer region with constant densities defined by inner_density and outer_density, respectively. Both regions are separated by a variable-density transition region whose extent is determined by inner_cutoff and outer_cutoff. The density variation in the transition region is controlled by the transition_type.

The output of this function may be passed to random_sampling_mask to generate a boolean sampling mask.

Parameters
  • shape – A tf.TensorShape or a list of ints. The shape of the output density grid.

  • inner_density – A float between 0.0 and 1.0. The density of the inner region.

  • outer_density

    A float between 0.0 and 1.0. The density of the outer region.

  • inner_cutoff

    A float between 0.0 and 1.0. The cutoff defining the limit between the inner region and the transition region.

  • outer_cutoff

    A float between 0.0 and 1.0. The cutoff defining the limit between the transition region and the outer region.

  • transition_type – A string. The type of transition to use. Must be one of ‘linear’, ‘quadratic’, or ‘hann’.

  • name – A name for this op.

Returns

A tensor containing the density grid.