tasks.repair

Repair tasks.

Module Contents

Classes

CollectAnnotated

Collect annotated dataset to work with on this phase.

FixZeroDiameters

Fix zero diameters.

Unravel

Unravel morphologies.

RepairNeurites

Repair morphologies.

MakeCollage

Make collage plot of morphologies.

MakeRelease

Make a morpology release, with three possible folders: zero-diameter, unravel or repair.

PlotRepair

Plot the cut leaves on repaired cells.

SmoothDiameters

Smooth diameters.

PlotSmoothDiameters

Plot smoothed diameters versus originals.

FinalCheck

Detect and plot errors in curated morphologies.

Attributes

logger

tasks.repair.logger
class tasks.repair.CollectAnnotated(*args, **kwargs)

Bases: morphology_workflows.utils.StrIndexMixin, data_validation_framework.task.ElementValidationTask

Collect annotated dataset to work with on this phase.

class tasks.repair.FixZeroDiameters(*args, **kwargs)

Bases: morphology_workflows.utils.StrIndexMixin, SkippableMixin(), data_validation_framework.task.ElementValidationTask

Fix zero diameters.

This task applies a fix on zero diameters on dendrites, by calling neuror.zero_diameter_fixer.fix_zero_diameters().

class tasks.repair.Unravel(*args, **kwargs)

Bases: morphology_workflows.utils.StrIndexMixin, SkippableMixin(), data_validation_framework.task.ElementValidationTask

Unravel morphologies.

In-vitro morphologies produce recostruction with too much tortuosity, which is corrected for here, using neuror.unravel.unravel(). As this changes the location of the points, the cut leaves have to be updated, as well as the apical points, if any.

window_half_length

Size in path length of unravel window

Type:

float

Default value:

10

class tasks.repair.RepairNeurites(*args, **kwargs)

Bases: morphology_workflows.utils.StrIndexMixin, SkippableMixin(), data_validation_framework.task.ElementValidationTask

Repair morphologies.

Using the cut leaves, we recreate missing branches using neuror.main.Repair.

Todo

Currently, axons are not repaired, as they need other axons.

Improve repair of dendrite by using all dendrites of same type.

with_plot

Save plots with highlighted repaired branches

Type:

bool

Default value:

False

repair_params

Repair internal parameters (see details in https://neuror.readthedocs.io/en/stable/neuror.main.html#neuror.main.Repair)

Type:

dict

class tasks.repair.MakeCollage(*args, **kwargs)

Bases: morphology_workflows.utils.StrIndexMixin, SkippableMixin(), data_validation_framework.task.SetValidationTask

Make collage plot of morphologies.

collage_path

Path to collage plot

Type:

str

Default value:

collage.pdf

separation
layer_thickness
dpi
n_morph_per_page
class tasks.repair.MakeRelease(*args, **kwargs)

Bases: morphology_workflows.utils.StrIndexMixin, data_validation_framework.task.SetValidationTask

Make a morpology release, with three possible folders: zero-diameter, unravel or repair.

release_path

(Optional) Path to the directory in which all the releases will be exported

Type:

str

zero_diameter_path

(Optional) Path to zero diameter morphologies (not created if None)

Type:

str

unravel_path

(Optional) Path to unravel morphologies (not created if None)

Type:

str

repair_path

Path to repaired morphologies (not created if None)

Type:

str

Default value:

repaired_release

duplicate_layers

Duplicate entries with mixed layer mtypes, i.e. L23_PC.

Type:

bool

Default value:

True

nb_processes

The number of parallel processes to use.

Type:

int

extensions = ['.asc', '.h5', '.swc']
class tasks.repair.PlotRepair(*args, **kwargs)

Bases: morphology_workflows.utils.StrIndexMixin, SkippableMixin(), data_validation_framework.task.ElementValidationTask

Plot the cut leaves on repaired cells.

with_plotly

Use Plotly for plotting

Type:

bool

Default value:

False

class tasks.repair.SmoothDiameters(*args, **kwargs)

Bases: morphology_workflows.utils.StrIndexMixin, SkippableMixin(True), data_validation_framework.task.SetValidationTask

Smooth diameters.

This tasks uses diameter_synthesis.build_models.build() to learn a diameter model from the actual diameters which is then used by diameter_synthesis.build_diameters.build() to diametrize the morphology.

By default, this task is skipped.

neurite_types

List of neurite_types to smooth

Type:

list

class tasks.repair.PlotSmoothDiameters(*args, **kwargs)

Bases: morphology_workflows.utils.StrIndexMixin, SkippableMixin(True), data_validation_framework.task.ElementValidationTask

Plot smoothed diameters versus originals.

class tasks.repair.FinalCheck(*args, **kwargs)

Bases: morphology_workflows.utils.StrIndexMixin, SkippableMixin(), data_validation_framework.task.ElementValidationTask

Detect and plot errors in curated morphologies.

The checks are the same as in the tasks.curation.DetectErrors task.

This task uses neuror.sanitize.annotate_neurolucida(). This task creates new .asc file with error annotated so it can be red by Neurolucida, and a morphology_workflows.marker_helper.MarkerSet container of the errors, for later plotting. Basic plots are also exported when errors are detected

The strict_labels parameter can be used to select for which errors the morphologies are considered as invalid..

min_range

Minimum z-range to be an error.

Type:

float

Default value:

50

overlapping_point_tolerance

Tolerance used to detect overlapping points.

Type:

float

Default value:

1e-06

disabled_checker_labels

The listed checkers will not be processed.

Type:

list

Default value:

[‘back-tracking’]

strict_checker_labels

Morphologies with at least one of these errors are marked as invalid.

Type:

list

Default value:

[‘overlapping point’]

plot_errors

Plot the detected errors.

Type:

bool

Default value:

True