Skip to content

File format

Eugene Katrukha edited this page Dec 31, 2024 · 11 revisions

Using Save ROIs button in the Panel Tracing offers options to save ROIs or export current interpolation shape.

Exporting ROIs

At this point, it is important to keep in mind, that BigTrace visualizes and measures ROIs using current ROI shape interpolation settings.

For the "outside" analysis and visualization, in most cases, you would need this interpolated shape.
To export ROIs coordinates using current settings, in the dialog of Save ROIs choose "Export interpolated traces CSV" option.
Exported csv has a first header line and comma-separated data below:
ROI_Number X_coord Y_coord Z_coord Radius ROI_Name ROI_Type ROI_Group ROI_TimePoint
1 28.41847 20.00892 14.20923 0.50747 trace1239043678 LineTrace *undefined* 0
1 28.41847 20.11145 ...
The coordinates and radius are provided in the scaled units, so make sure your pixel/voxel size is correct.
This file format can be easily imported to Matlab or Python.
As an alternative, by switching to file export in the Panel Measure and running plot intensity profile command,
you can get the same interpolated traces including measure intensity values along traces.
If you need "raw", non-interpolated traces, you can just select "Voxel" type of ROI shape interpolation before export.

If you traced some neurites, to export interpolated traces in SWC format (for using it in SNT, for example), choose "Export neurite SWC" option.
After the import, it is possible to categorize traces by type, fit thickness, etc in SNT later.

Saving ROIs in BigTrace format

This format includes raw traces and internal BigTrace information.
For now, ROIs and Groups are saved in a regular text-based CSV format.
Hopefully, it is organized in a self-explanatory manner.

Most importantly, the coordinates of points and lines are stored in "pixel/voxel" units, not in scaled units (micrometers, etc). So you need to know the voxel characteristics of the original dataset to convert it to "true" measurements.

Here is a typical structure of ROI file. It starts with a block about Groups:

BigTrace_groups	version	0.5.1		
GroupsNumber	2			
BT_Group	1			
Name	*undefined*
....  groups parameters ....						
End of BigTrace Groups				

Followed by a header and ROIs information:

BigTrace_ROIs	version	0.5.1
ImageUnits	micron
ImageVoxelWidth  0.1326897526490514
ImageVoxelHeight 0.1326897526490514
ImageVoxelDepth  0.3530060569122018
TimeUnits	ms
FrameInterval	100
Intensity Interpolation 1
ROI Shape Interpolation 0
Rotation min frame type 0
Smooth window 10
ROIsNumber	3	
BT_Roi	1	
....ROI parameters ....
BT_Roi	2
....ROI parameters ....
End of BigTrace ROIs

The header contains voxel's/time scale information and corresponding units.

Upon loading the ROIs file it will be applied to the current dataset (see Panel View Clip) panel).

Each ROI record starts with a header information about its appearance, type, and corresponding time point:

Type	Point               // (or Polyline or LineTrace)		
Name	polyl1479209238			
GroupInd	0 	    // (Group index starting from 0)
TimePoint	0 	    // (notice that the time frame index starts from 0!)		
PointSize	6	    // (in voxel units)
PointColor	0	255	0	255 // (alpha, RGB format 0-255)
LineThickness	4          // (in voxel units)	
LineColor	0	0	255	255 // (alpha, RGB format 0-255)
RenderType	1	       // (0 - center line, 1 - grid, 2 - surface)		

For Point and Polyline ROIs the next record is Vertices with a number of vertices (always equal to 1 for Point3D type ROI). Example:

Vertices	5		
314	346	191
309	307	136
302	269	118
297	233	103
296	208	92

Here in the case of Polyline we have 5 points, so there are five subsequent lines
with X, Y, Z coordinates. The last added point would be the last in the list.

The LineTrace ROIs description also starts with a list of vertices (3D points selected by the user, in the same XYZ format):

Vertices	5		
163	227	140
182	179	122
199	98	78
204	59	65
216	15	45

In addition, it has a record of traced curve segments connecting these vertices. I.e. segment 1 connects vertices 1 and 2, segment 2 -> vertices 2 and 3, etc.

These segments are made from a different number of points themself, specified in the Points field. In this example above, there are 5 points, so there should be 4 connecting segments:

SegmentsNumber	4		
Segment	1	Points	49
163	227	140
164	226	141
...
181	180	122
182	179	122
Segment	2	Points	82
182	179	122
182	178	122
...
199	99	78
199	98	78
Segment	3	Points	40
...
Segment	4	Points	45
....

Notice, that each segment includes two Vertices points' coordinates as its start and end. Therefore first point of Segment 2 is the last point of Segment 1 and the second value in the Vertices list.

I hope this description is clear for you. If you have questions, send me an email.

Clone this wiki locally