macros - ekatrukha/BigTrace GitHub Wiki

The plugin is scriptable, meaning that some functionality can be used in ImageJ/FIJI macro environment via extension interface.

For that, we implemented a set of commands/functions starting from "Ext." namespace.
To start, you always need to run BigTrace on some image file and then call the function, for example:

run("Open 3D image", "open=C:/path_to/my_file.tif"); //open my_file.tif in BigTrace
Ext.btLoadROIs("C:/path_to/Rois_btrois.csv","Clean"); //load ROIs from file
//run other commands ...
Ext.btClose(); //close BT

The description of available commands is shown below.
If you want new ones to be implemented or tweak existing ones, please reach out.

Settings

Ext.btShapeInterpolation (String sShapeInterpolation, Integer nSmoothWindow)

Specifies current ROI Shape Interpolation.
The first string parameter should be either "Voxel", "Smooth" or "Spline".
The second integer parameter specifies the smoothing window.

Ext.btIntensityInterpolation (String sIntInterpolation)

Sets current intensity interpolation.
A single string parameter with possible values of "Neighbor", "Linear", or "Lanczos".

Ext.btSetActiveChannel (Integer nActiveChannel)

Specifies the channel used for tracing and measurements (channel numbering starts from 1).

Ext.btSetTracingThickness (Double sigmaX, Double sigmaY, Double sigmaZ)

Sets the approximate thickness of curves in each dimension for semi-auto, one-click and full-auto tracings (in pixels!).
Those are the values set for General tracing parameters.

Ext.btSetTracingROI (Boolean bEnable, Double dCoeff, String sMethod)

Sets the diameter of ROIs created by semi-, one-click and full-auto tracing routines
using values of "tracing thickness". Basically, the same as in General tracing parameters panel (see for more details).
The bEnable string can have values "true" and "false", activating this feature.
dCoeff variable specifies a multiplication factor used to calculate the diameter
using sMethod ("MAX", "AVG" or "MIN") from tracing SD thickness (see above).

Ext.btSetOneClickParameters(Integer nVertexPlacementPointN, Double dDirectionality, Boolean sOCIntensityStop, Double dMinIntensityThreshold)

Sets parameters for one-click tracing.
nVertexPlacementPointN is a "distance" between intermediate vertex placement (pixels, >=3). Specifies how often intermediate points (vertices) will be placed on the curve during auto-tracing.
dDirectionality is the value for the directionality constraint.
sOCIntensityStop is logical ("true" or "false"), whether to stop tracing if the current curve passes through
a voxel with intensity below dMinIntensityThreshold.

Commands

btRunFullAutoTrace(Integer nMinIntensity, Integer nMinNumPoints, Integer nFirstFrame, Integer nLastFrame)

Launches Full auto tracing with provided parameters values:
nMinIntensity is the minimum intensity to start tracing curve;
nMinNumPoints specifies the minimum number of points in a curve;
nFirstFrame and nLastFrame (optional) specify the time range. When omitted, all time points are traced.
Additional parameters can be set up using settings function above.

Ext.btStraighten (Integer nAxis, String sOutputFolder, String sShape)

This command runs straighten function on all visible ROIs in the list.
It takes an integer and two strings as arguments:
Ext.btStraighten(1, "C:/path_to_store_output/", "Round");
The nAxis integer specifies the axis of the output, which becomes the centerline of an ROI curve.
The value of 0 corresponds to the X axis, 1 to Y, and 2 to Z.
Note that the output depends on the Intensity Interpolation and ROI Shape Interpolation,
which can be specified by the two functions above.
The string argument sOutputFolder is the path to the folder for the output.
The sShape (optional) string argument specifies the shape of the extracted volume around the centerline,
it could be either "Square" (default) or "Round".

Ext.btClose()

Closes the current session of BigTrace (if there is one).

ROIs IO

Ext.btLoadROIs (String sFile, String sMode)

Takes two string arguments as input:
Ext.btLoadROIs("C:/path_to/Rois_btrois.csv","Clean");
The first sFile parameter is the full path to ROIs csv file. The second sMode parameter can be "Clean", i.e. delete all ROIs and load new ones from the file.
Or it can be "Append", so the newly loaded ROIs will be added to existing ones.

Ext.btSaveROIs (String sFile, String sMode)

Takes two string arguments as input, for example:
Ext.btSaveROIs("C:/path_to/Rois_btrois.csv","CSV");
The first sFile parameter is the full path + filename for saving.
The second sMode (optional) parameter can be "BigTrace" (default), "CSV", or "SWC".

⚠️ **GitHub.com Fallback** ⚠️