neurom.check.structural_checks

Module with consistency/validity checks for raw data blocks.

Functions

has_all_finite_radius_neurites

Check that all points with neurite type have a finite radius.

has_increasing_ids

Check that IDs are increasing.

has_sequential_ids

Check that IDs are increasing and consecutive.

has_soma_points

Checks if the TYPE column of raw data block has an element of type soma.

has_valid_neurites

Check if any neurites can be reconstructed from data block.

has_valid_soma

Check if a data block has a valid soma.

is_single_tree

Check that data forms a single tree.

make_neurites

Build neurite trees from a raw data wrapper.

make_soma

Make a soma object from a set of points.

no_missing_parents

Check that all points have existing parents.

Classes

COLS

Column labels for internal data representation.

CheckResult

Class representing a check result.

POINT_TYPE

Point types.

Exceptions

SomaError

Exception for soma construction errors.

class neurom.check.structural_checks.COLS[source]

Bases: object

Column labels for internal data representation.

class neurom.check.structural_checks.CheckResult(status, info=None, title=None)[source]

Bases: object

Class representing a check result.

class neurom.check.structural_checks.POINT_TYPE[source]

Bases: object

Point types.

These follow SWC specification.

exception neurom.check.structural_checks.SomaError[source]

Bases: neurom.exceptions.NeuroMError

Exception for soma construction errors.

neurom.check.structural_checks.has_all_finite_radius_neurites(data_wrapper, threshold=0.0)[source]

Check that all points with neurite type have a finite radius.

Returns

CheckResult with result and list of IDs of neurite points with zero radius

neurom.check.structural_checks.has_increasing_ids(data_wrapper)[source]

Check that IDs are increasing.

Returns

CheckResult with result and list of IDs that are inconsistent with their predecessor

neurom.check.structural_checks.has_sequential_ids(data_wrapper)[source]

Check that IDs are increasing and consecutive.

returns tuple (bool, list of IDs that are not consecutive with their predecessor)

neurom.check.structural_checks.has_soma_points(data_wrapper)[source]

Checks if the TYPE column of raw data block has an element of type soma.

Returns

CheckResult with result

neurom.check.structural_checks.has_valid_neurites(data_wrapper)[source]

Check if any neurites can be reconstructed from data block.

Returns

CheckResult with result

neurom.check.structural_checks.has_valid_soma(data_wrapper)[source]

Check if a data block has a valid soma.

Returns

CheckResult with result

neurom.check.structural_checks.is_single_tree(data_wrapper)[source]

Check that data forms a single tree.

Only the first point has ID of -1.

Returns

CheckResult with result and list of IDs

Note

This assumes no_missing_parents passed.

neurom.check.structural_checks.make_neurites(rdw)[source]

Build neurite trees from a raw data wrapper.

neurom.check.structural_checks.make_soma(points, soma_check=None, soma_class='contour')[source]

Make a soma object from a set of points.

Infers the soma type (SomaSinglePoint, SomaSimpleContour) from the points and the ‘soma_class’

Parameters
  • points – collection of points forming a soma.

  • soma_check – optional validation function applied to points. Should

  • a SomaError if points not valid. (raise) –

  • soma_class (str) – one of ‘contour’ or ‘cylinder’ to specify the type

Raises
  • SomaError if no soma points found, points incompatible with soma, or

  • if soma_check(points) fails.

neurom.check.structural_checks.no_missing_parents(data_wrapper)[source]

Check that all points have existing parents.

Point’s parent ID must exist and parent must be declared before child.

Returns

CheckResult with result and list of IDs that have no parent