Exemplo n.º 1
0
def get_single_cell_data(df=None, coords=None, max_cells=None, **kwargs):
    if df is None:
        df = get_tile_graph_data_selection(coords=coords)
    if df is None:
        return None, None

    # Downsample if necessary
    n_cells_in_tile = len(df)
    max_cells = max_cells or cfg.max_single_cells
    if len(df) > max_cells:
        logger.info(
            'Sampling single cell data for %s cells down to %s records %s',
            len(df), max_cells,
            '' if coords is None else '[tile = ' + str(coords) + ']')
        df = df.sample(n=max_cells, random_state=cfg.random_state)

    raw_tile = get_tile_image(apply_display_settings=False, coords=coords)
    display_tile = get_tile_image(apply_display_settings=True, coords=coords)
    channels = data.get_tile_image_channels()
    cell_data = lib.get_single_cell_data(df,
                                         raw_tile,
                                         display_tile,
                                         channels,
                                         cell_image_size=cfg.cell_image_size,
                                         **kwargs)
    return cell_data, n_cells_in_tile
Exemplo n.º 2
0
def get_tile_nchannels():
    return len(data.get_tile_image_channels())
Exemplo n.º 3
0
          children=[
              html.Div(html.H4('Selected Cells', style=TITLE_STYLE),
                       id='single-cells',
                       className='two columns'),
              html.Div([
                  html.Div(id='tile-title'),
                  lib.get_interactive_image(
                      'tile', ac['layouts']['tile'], style=TILE_IMAGE_STYLE)
              ],
                       className='seven columns',
                       style={
                           'overflowY': 'scroll',
                           'overflowX': 'scroll'
                       }),
              get_image_settings_layout('tile-ch-{}',
                                        data.get_tile_image_channels(),
                                        'three columns')
          ]),
 html.Div(className='row',
          children=[
              html.Div(html.Div([
                  dcc.Checklist(options=[{
                      'label': '',
                      'value': 'enabled'
                  }],
                                values=[],
                                id='enable-buffer',
                                style={
                                    'display': 'inline-block',
                                    'vertical-align': 'top',
                                    'margin-top': '5px',