Fit Splines
All the analysis begin with the spline fitting.
Try it out with the demo data
Reconstructed, binned tomograms of short microtubules are available in the GitHub repository, which have been used for testing the programs. You can download it to try following instructions.
Draw Splines
API: register_path
GUI: or F1
You can use the built-in functionality of napari
to place points first, and fit
the points with a spline.
To delete the last spline, click .
Note
You can view the image from the different direction using the napari
viewer
buttons.
Auto-picking tool
The cylindra
toolbar has an auto-picking tool. If you have placed two or more
points, you can extend it with a fast auto-centering function ( or F3).
In the future version, other auto-picking tools (AI-powered, fully automated, etc) may be added.
Important: Configure the spline for your cylindric structure
Each spline is tagged with a SplineConfig
object, which describes the average
feature of the cylindric structure it represents. Default values are optimized for
microtubules. If you want to analyze other structures, see
here.
Fit Automatically
Manually drawn splines usually does not fit the cylindric structure well. cylindra
provides some automatic spline fitting methods using template-free image alignment.
Rough fitting
API: fit_splines
GUI: Splines > Fitting > Fit splines
This rough spline fitting method is based on the auto-correlation first introduced in Blestel et al., 2009, although the original method only applies to 2D images. In this method, Sub-volumes are sampled and the center of each sub-volume is estimated by the auto-correlation. Spline will try to pass nearby the estimated centers as much as possible, while avoiding the outliers.
List of parameters
- The registered splines should be shown in the top "splines" row.
- "max interval (nm)" is the maximum distance between sampling points along the spline. This value does not have to be too small. The regions between sampling points will be interpolated by cubic functions.
- Available bin sizes are listed up in the "bin size" combo box.
- "max fit error (nm)" is the maximum distance between the estimated center of each sub-volume and the spline that passes nearby. Setting this value larger will result in more smooth splines.
- "degree precision" is the precision of the spline tangent angle estimation.
- "edge σ" is the standard deviation used to mask the region outside the cylinder. This mask will lower the weight of the pixels outside the cylinder to exclude the outer components. However, if the initial spline is far from the actual center line, you should not mask the image.
- "max shift" is the maximum shift of the sampling points to the estimated center.
Note
If the filament is thin, fitting to the centroid may work better. To do this, use following methods instead.
GUI: Splines > Fitting > Fit splines by centroid
Refine the fitting
API: refine_splines
GUI: Splines > Fitting > Refine splines
This method is to further refine the splines after rough fitting. In this function, the lattice helical parameters at this moment are determined by global-CFT analysis, and the average projection along the spline axis is calculated. Each sub-volume along the spline is aligned to the average to update the spline positions.
List of parameters
- The registered splines should be shown in the top "splines" row.
- "max interval (nm)" is the maximum distance between sampling points along the spline. This value does not have to be too small. The regions between sampling points will be interpolated by cubic functions.
- "max fit error (nm)" is the maximum distance between the estimated center of each sub-volume and the spline that passes nearby. Setting this value larger will result in more smooth splines.
- "correlation allowed" is the top correlation coefficients allowed to make the average. Setting to <1 will exclude the badly aligned sub-volumes.
- Available bin sizes are listed up in the "bin size" combo box.
Fit Manually
GUI: Splines > Fitting > Fit splines manually
or Ctrl+K → Ctrl+/
Sometimes spline fitting may fail, probably due to the poor quality of the image or the fitting being affected by the nearby structures. In this case, you can carefully fit the splines manually in a new window.
In this window, you can left-click in the projection to select the center of the structure. You can move along the spline by changing the "Position" box (Up, Down), or go to other splines by changing the "Spline No." box (Left, Right).
The Spline Object
All the registered Spline
objects are stored in the ui.splines
property. It is a list
like structure with all the registered splines as its elements.
spl = ui.splines[0] # the first Spline object
spl
Spline[<edge coordinates shown here>]
The Spline
object has a props
property. This object stores the local and global properties of the spline. Since we have not run any analysis yet, the properties are empty.
spl.props
SplineProps(
local=
shape: (0, 0)
┌┐
╞╡
└┘
global=
shape: (0, 0)
┌┐
╞╡
└┘
)