neuron_morphology.snap_polygons._from_lims

This module contains utilities for running snap_polygons directly from the Allen Institute’s internal Laboratory Information Management System.

Example Usage

python -m neuron_morphology.snap_polygons
–host <lims host> –port <lims port> –user <username> –password <password> –database <lims db> –focal_plane_image_series_id 522408212 # for instance –image_output_root /some_directory

Module Contents

Classes

PostgresInputConfigSchema The parameters required to query a postgres database.
FromLimsSchema The parameters required to query LIMS for a set of cortical layer
FromLimsSource An alternate argschema source which gets its inputs from lims directly

Functions

query_for_layer_polygons(query_engine: QueryEngineType, focal_plane_image_series_id: int, validate_polys: bool = True, treatment: str = ‘Biocytin’) → List[Dict[str, Union[NicePathType, str]]] Get all layer polygons for this image series
query_for_cortical_surfaces(query_engine: QueryEngineType, focal_plane_image_series_id: int) → Tuple[Dict[str, Union[NicePathType, str]], Dict[str, Union[NicePathType, str]]] Return the pia and white matter surface drawings for this image series
query_for_images(query_engine: QueryEngineType, focal_plane_image_series_id: int, output_dir: str) → List[Dict[str, str]] Return Biocytin and DAPI images associated with a focal plane image
query_for_image_dims(query_engine: QueryEngineType, focal_plane_image_series_id: int) → Tuple[float, float] Find the dimensions of the Biocytin image associated with a focal plane
get_inputs_from_lims(host: str, port: int, database: str, user: str, password: str, imser_id: int, image_output_root: Optional[str]) Utility for building module inputs from a direct LIMS query
neuron_morphology.snap_polygons._from_lims.QueryEngineType
neuron_morphology.snap_polygons._from_lims.query_for_layer_polygons(query_engine: QueryEngineType, focal_plane_image_series_id: int, validate_polys: bool = True, treatment: str = 'Biocytin') → List[Dict[str, Union[NicePathType, str]]]

Get all layer polygons for this image series

Parameters:
query_engine : executes a query, passed in as a string. Must not require

any additional database information.

focal_plane_image_series_id : used to determine which polygons to fetch
validate_polys : if True, fail when
  • a label is associated with multiple distinct valid geometries
  • a label is associated with one or more geometries, but none are valid
treatment: The layer polygons are associated with Biocytin and DAPI

treatments. We only need one.

Returns:
A collection of labelled polygons.
neuron_morphology.snap_polygons._from_lims.query_for_cortical_surfaces(query_engine: QueryEngineType, focal_plane_image_series_id: int) → Tuple[Dict[str, Union[NicePathType, str]], Dict[str, Union[NicePathType, str]]]

Return the pia and white matter surface drawings for this image series

neuron_morphology.snap_polygons._from_lims.query_for_images(query_engine: QueryEngineType, focal_plane_image_series_id: int, output_dir: str) → List[Dict[str, str]]

Return Biocytin and DAPI images associated with a focal plane image series

neuron_morphology.snap_polygons._from_lims.query_for_image_dims(query_engine: QueryEngineType, focal_plane_image_series_id: int) → Tuple[float, float]

Find the dimensions of the Biocytin image associated with a focal plane image series

neuron_morphology.snap_polygons._from_lims.get_inputs_from_lims(host: str, port: int, database: str, user: str, password: str, imser_id: int, image_output_root: Optional[str])

Utility for building module inputs from a direct LIMS query

class neuron_morphology.snap_polygons._from_lims.PostgresInputConfigSchema(only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)

Bases: marshmallow.Schema

The parameters required to query a postgres database.

host
database
user
password
port
class neuron_morphology.snap_polygons._from_lims.FromLimsSchema(only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)

Bases: neuron_morphology.snap_polygons._from_lims.PostgresInputConfigSchema

The parameters required to query LIMS for a set of cortical layer polygons and cortical surface boundaries.

focal_plane_image_series_id
image_output_root
class neuron_morphology.snap_polygons._from_lims.FromLimsSource

Bases: argschema.sources.ArgSource

An alternate argschema source which gets its inputs from lims directly

ConfigSchema
get_dict(self)