/z-spacing

Estimate the correct positions of sections of three dimensional image data.

Primary LanguageJavaGNU General Public License v2.0GPL-2.0

Z-Spacing Correction

Estimate the positions and spacing between sections (or at local points) of three dimensional image data. This method may be applied to any imaging modality that acquires 3-dimensional data as a stack of 2-dimensional sections. We provide plugins for both Fiji and TrakEM2.

Citation

Please note that the z-spacing correction plugin available through Fiji, is based on a publication. If you use it successfully for your research please cite our work:

P. Hanslovsky, J. Bogovic, S. Saalfeld (2015) Post-acquisition image based compensation for thickness variation in microscopy section series, In ''International Symposium on Biomedical Imaging (ISBI'15)'', New York [http://arxiv.org/abs/1411.6970]

Introduction

Serial section Microscopy, using either optical or physical sectioning, is an established method for volumetric anatomy reconstruction. Section series imaged with Electron Microscopy are currently vital for the reconstruction of the synaptic connectivity of entire animal brains such as that of Drosophila melanogaster. The process of removing ultrathin layers from a solid block containing the specimen, however, is a fragile procedure and has limited precision with respect to section thickness. Optical sectioning techniques often suffer from increasing distortion as sections deeper inside the tissue are imaged. On summary, section thickness that is supposed to be constant, in practice is not and has to be corrected where precise measurement is desired. We have developed a method to estimate the relative z-position of each individual section as a function of signal change across the section series. The Fiji plugin Transform > Z-Spacing Correction and the TrakEM2 plugin Plugins > LayerZPosition implement this method.

Parameters

Neighborhood range
Specifies the neighborhood around each section for which pairwise similarities are calculated.
Outer iterations
Specifies the number of iterations in the outer loop of the optimizer.
Outer regularization
Specifies the amount of regularization in the outer loop of the optimizer. 0 means no regularization, 1 means full regularization (no change). The regularizer in the outer loop damps the updates during each iteration by the specified fraction.
Inner Iterations
Specifies the number of iterations in inner loops of the optimizer.
Inner Regularization
Specifies the amount of regularization in the outer loop of the optimizer. 0 means no regularization, 1 means full regularization (no change). The per-section quality weight requires regularization to avoid trivial solutions. We use a Tikhonov regularizer towards 1.0 weight.
Allow reordering
Specifies whether layers/ sections can change their relative order in the series.

Visitors

z-spacing uses the Visitor interface to inspect the state of each iteration of the inference. Currently, two visitors are provided for use in the Z-Spacing Correction Fiji plugin:

lazy (default)
Do not inspect state of inference.
variables
Log a user specified selection of
  • the current (local) function estimate ("<root>/correlation-fit/%0nd.csv"),
  • scaling factors ("<root>/scaling-factors/%0nd.csv"),
  • coordinate transform/look-up table ("<root>/lut/%0nd.csv"), and
  • scaled and warped matrix ("<root>/matrices/%0nd.csv"),
where the <root> directory is specified by the user, and n is the minimum number of digits necessary for displaying the specified number of iterations.
### Adding Visitors Users can add their own visitors by calling one of ```java org.janelia.thickness.plugin.ZPositionCorrection.addVisitor( final String name, final Visitor visitor ) org.janelia.thickness.plugin.ZPositionCorrection.addVisitor( final String name, final VisitorFactory factory ) ``` from the script editor or the beanshell interpreter. The first option is the go-to choice for simple visitors. If the visitor needs specific information from the input matrix or options, the second option should be used. To that end, the user needs to implement the [VisitorFactory](https://github.com/saalfeldlab/z-spacing/blob/master/src/main/java/org/janelia/thickness/plugin/ZPositionCorrection.java#L138) interface. The following simple examples demonstrate how to add a visitor using both methods and can be easily extended for more specific tasks:
  • Simple Visitor
import ij.IJ;
import org.janelia.thickness.inference.visitor.Visitor;
import org.janelia.thickness.plugin.ZPositionCorrection;

ZPositionCorrection.addVisitor( "yay", new Visitor()
	{ 
		act( iteration, matrix, scaledMatrix, lut, permutation, inversePermutation, multipliers, estimatedFit ) {
		IJ.log( "Doing iteration " + iteration );
		}
	}
);
  • Using Factory
import ij.IJ;
import org.janelia.thickness.inference.visitor.Visitor;
import org.janelia.thickness.plugin.ZPositionCorrection;

factory = new ZPositionCorrection.VisitorFactory() {
	public Visitor create( matrix, options ) { 
		return new Visitor() {
			act( iteration, matrix, scaledMatrix, lut, permutation, inversePermutation, multipliers, estimatedFit )
			{
				IJ.log( "Doing iteration " + iteration + "/" + options.nIterations );
			}
		};
	}
};

ZPositionCorrection.addVisitor( "yay2", factory );

Note that manually added visitors will not be stored, i.e. they will be lost after re-starting Fiji, and the "lazy" visitor cannot be overwritten.