Class TabularParser
- All Implemented Interfaces:
Parser,ProfileProperties
Parser for extracting Sholl profiles from tabular data.
TabularParser processes data from tables (CSV files, ResultsTables, etc.) containing radial distance and intersection count columns to generate Sholl analysis profiles. This is useful for analyzing pre-computed Sholl data or importing results from external analysis tools.
The parser supports both ImageJ1 (ResultsTable) and ImageJ2
(DoubleTable) table formats, and can automatically
detect spatial calibration units from column headers.
// Parse from CSV file
TabularParser parser = new TabularParser("data.csv", "Distance_um", "Intersections");
parser.parse();
Profile profile = parser.getProfile();
// Parse subset of rows from ResultsTable
TabularParser parser2 = new TabularParser(resultsTable, "Radius", "Count", 5, 25);
parser2.parse();
- Author:
- Tiago Ferreira
- See Also:
-
Field Summary
Fields inherited from interface sc.fiji.snt.analysis.sholl.ProfileProperties
HEMI_EAST, HEMI_NONE, HEMI_NORTH, HEMI_SOUTH, HEMI_WEST, INTG_MEAN, INTG_MEDIAN, INTG_MODE, KEY_2D3D, KEY_CALIBRATION, KEY_CENTER, KEY_CHANNEL_POS, KEY_EFFECTIVE_STEP_SIZE, KEY_EXTRA_MEASUREMENT, KEY_FRAME_POS, KEY_HEMISHELLS, KEY_ID, KEY_NSAMPLES, KEY_NSAMPLES_INTG, KEY_SLICE_POS, KEY_SOURCE, KEY_THRESHOLD_RANGE, SRC_IMG, SRC_TABLE, SRC_TRACES, UNSET -
Constructor Summary
ConstructorsConstructorDescriptionTabularParser(ij.measure.ResultsTable table, String radiiColumnHeader, String countsColumnHeader, int startRow, int endRow) Constructs a TabularParser from an ImageJ1 ResultsTable with row range specification.TabularParser(File table, String radiiColumnHeader, String countsColumnHeader) Constructs a TabularParser from a table file.TabularParser(String filePath, String radiiColumnHeader, String countsColumnHeader) Constructs a TabularParser from a table file path.TabularParser(net.imagej.table.ResultsTable table, String radiiColumnHeader, String countsColumnHeader) Constructs a TabularParser from an ImageJ2 ResultsTable.TabularParser(org.scijava.table.DoubleTable table, String radiiColumnHeader, String countsColumnHeader) Constructs a TabularParser from a DoubleTable. -
Method Summary
Modifier and TypeMethodDescriptionGets the Sholl profile generated by the parsing operation.static voidvoidparse()Parses the tabular data to extract the Sholl profile.voidrestrictToSubset(int firstRow, int lastRow) booleanChecks if the parsing operation was successful.voidTerminates the parsing operation.
-
Constructor Details
-
TabularParser
public TabularParser(File table, String radiiColumnHeader, String countsColumnHeader) throws IOException Constructs a TabularParser from a table file.Loads and parses a table file (CSV, TSV, etc.) containing Sholl analysis data. The file should have columns for radial distances and intersection counts.
- Parameters:
table- the File containing the tabular dataradiiColumnHeader- the header name of the column containing radial distancescountsColumnHeader- the header name of the column containing intersection counts- Throws:
IOException- if the file cannot be read or parsedIllegalArgumentException- if the specified column headers are not found
-
TabularParser
public TabularParser(String filePath, String radiiColumnHeader, String countsColumnHeader) throws IOException Constructs a TabularParser from a table file path.Convenience constructor that accepts a file path string instead of a File object.
- Parameters:
filePath- the path to the file containing the tabular dataradiiColumnHeader- the header name of the column containing radial distancescountsColumnHeader- the header name of the column containing intersection counts- Throws:
IOException- if the file cannot be read or parsedIllegalArgumentException- if the specified column headers are not found
-
TabularParser
public TabularParser(ij.measure.ResultsTable table, String radiiColumnHeader, String countsColumnHeader, int startRow, int endRow) Constructs a TabularParser from an ImageJ1 ResultsTable with row range specification.This constructor allows parsing a specific subset of rows from the table, which is useful for analyzing partial data or excluding outliers.
- Parameters:
table- the ImageJ1 ResultsTable containing the dataradiiColumnHeader- the header name of the column containing radial distancescountsColumnHeader- the header name of the column containing intersection countsstartRow- the first row to include in parsing (0-based, -1 for start of table)endRow- the last row to include in parsing (0-based, -1 for end of table)- Throws:
IllegalArgumentException- if the table is null/empty or column headers are not found
-
TabularParser
public TabularParser(net.imagej.table.ResultsTable table, String radiiColumnHeader, String countsColumnHeader) Constructs a TabularParser from an ImageJ2 ResultsTable.Convenience constructor for ImageJ2 ResultsTable objects.
- Parameters:
table- the ImageJ2 ResultsTable containing the dataradiiColumnHeader- the header name of the column containing radial distancescountsColumnHeader- the header name of the column containing intersection counts- Throws:
IllegalArgumentException- if the table is null/empty or column headers are not found
-
TabularParser
public TabularParser(org.scijava.table.DoubleTable table, String radiiColumnHeader, String countsColumnHeader) Constructs a TabularParser from a DoubleTable.This constructor works with SciJava DoubleTable objects, providing compatibility with the ImageJ2 table framework.
- Parameters:
table- the DoubleTable containing the dataradiiColumnHeader- the header name of the column containing radial distancescountsColumnHeader- the header name of the column containing intersection counts- Throws:
IllegalArgumentException- if the table is null/empty or column headers are not found
-
-
Method Details
-
parse
public void parse()Parses the tabular data to extract the Sholl profile.This method reads the specified columns from the table, creates ProfileEntry objects for each row, and builds a complete Sholl profile. It also attempts to automatically detect spatial calibration units from the radii column header.
The parsing process:- Creates a new Profile object
- Reads data from the specified radii and counts columns
- Creates ProfileEntry objects for each data row
- Sets profile metadata and properties
- Attempts to detect and set spatial calibration
-
restrictToSubset
public void restrictToSubset(int firstRow, int lastRow) -
successful
public boolean successful()Description copied from interface:ParserChecks if the parsing operation was successful.This method should be called after
Parser.parse()to determine if the parsing completed without errors and produced a valid profile.- Specified by:
successfulin interfaceParser- Returns:
- true if parsing was successful, false otherwise
-
terminate
public void terminate()Description copied from interface:ParserTerminates the parsing operation.This method should be called to clean up resources and stop any ongoing parsing operations. It may be used to interrupt long-running analyses or to ensure proper cleanup when the parser is no longer needed.
-
getProfile
Description copied from interface:ParserGets the Sholl profile generated by the parsing operation.This method returns the profile containing intersection counts at various radial distances. The profile should only be retrieved after calling
Parser.parse()and verifying success withParser.successful().- Specified by:
getProfilein interfaceParser- Returns:
- the Sholl profile, or null if parsing has not been performed or was unsuccessful
-
main
-