Upright transform of the reconstructed morphology

This tutorial demonstrates how to perform the upright transform.

Reconstructed morphologies may be oriented in an arbitrary direction in the slice plane. For analysis of morphological features it is often necessary to bring reconstruction into a common reference frame with pia facing up. After the transform a tufted dendrite should be largely aligned with the vertical y-axis in the xy coordinates as shown below:

upright transform before and after

Method for finding the upright direction

The upright transform is found by findig the upright direction at the soma location in the slice coordinates and subsequently rotating the reconstruction to align the the upright direction with the vertical axis (y-axis)

The upright direction is found in two steps:

  1. Find the isocontours of the cortical depth field.
  2. The upright direction is found as a normal to the depth isocontours.

The isocontours are modeled as a solution of the Laplace equation with distinct Direchlet BC on the pia and white matter. The upright direction at any point in the domain is then modeled as a gradient of the depth field.

Load a reconstruction

Find depth field and the upright direction at the soma location

Rotate reconstruction by the upright angle along the z axis

Plot original morphological reconstruction and depth, upright directions

Plot the upright morphology