def setup_image_plane_pixelization_grid_from_galaxies_and_grid_stack(galaxies, grid_stack):
if not isinstance(grid_stack.regular, grids.PaddedRegularGrid):<EOL><INDENT>for galaxy in galaxies:<EOL><INDENT>if hasattr(galaxy, '<STR_LIT>'):<EOL><INDENT>if isinstance(galaxy.pixelization, ImagePlanePixelization):<EOL><INDENT>image_plane_pix_grid = galaxy.pixelization.image_plane_pix_grid_from_regular_grid(<EOL>regular_grid=grid_stack.regular)<EOL>return grid_stack.new_grid_stack_with_pix_grid_added(pix_grid=image_plane_pix_grid.sparse_grid,<EOL>regular_to_nearest_pix=image_plane_pix_grid.regular_to_sparse)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return grid_stack<EOL>
An image-plane pixelization is one where its pixel centres are computed by tracing a sparse grid of pixels from \
    the image's regular grid to other planes (e.g. the source-plane).

    Provided a galaxy has an image-plane pixelization, this function returns a new *GridStack* instance where the \
    image-plane pixelization's sparse grid is added to it as an attibute.

    Thus, when the *GridStack* are are passed to the *ray_tracing* module this sparse grid is also traced and the \
    traced coordinates represent the centre of each pixelization pixel.

    Parameters
    -----------
    galaxies : [model.galaxy.galaxy.Galaxy]
        A list of galaxies, which may contain pixelizations and an *ImagePlanePixelization*.
    grid_stacks : image.array.grid_stacks.GridStack
        The collection of grid_stacks (regular, sub, etc.) which the image-plane pixelization grid (referred to as pix) \
        may be added to.