Class ImageParser
- All Implemented Interfaces:
Runnable,org.scijava.Cancelable,org.scijava.command.Command,org.scijava.Contextual,org.scijava.plugin.SciJavaPlugin,Parser,ProfileProperties
- Direct Known Subclasses:
ImageParser2D,ImageParser3D
Parser for extracting Sholl profiles from image data.
ImageParser analyzes 2D or 3D images to compute intersection counts at various radial distances from a center point. It supports thresholded analysis, multi-channel images, and various sampling strategies including hemishell analysis.
The parser can work with binary images, grayscale images with threshold ranges, or intensity-based analysis. It provides methods for setting analysis parameters such as center point, radii, thresholds, and sampling regions.
Key features include:- Support for 2D and 3D image analysis
- Flexible center point definition (manual coordinates or ROI-based)
- Customizable radial sampling with automatic or manual radius specification
- Threshold-based analysis for binary or grayscale images
- Hemishell analysis for directional sampling
- Integration with ImageJ's calibration system
- Author:
- Tiago Ferreira
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ij.measure.Calibrationprotected ShollPointprotected intprotected intprotected final ij.ImagePlusprotected doubleprotected intprotected intprotected intprotected intprotected intprotected intprotected Profileprotected Propertiesprotected booleanprotected longprotected org.scijava.app.StatusServiceprotected doubleprotected final doubleprotected intprotected intprotected intFields 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
ConstructorsModifierConstructorDescriptionprotectedImageParser(ij.ImagePlus imp) Deprecated.protectedImageParser(ij.ImagePlus imp, org.scijava.Context context) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidcheckUnsetFields(boolean includeThreshold) protected voidint[][]getCircumferencePoints(int cx, int cy, int radius) doubleGets the isotropic voxel size used for analysis.ij.ImagePlusgetMask()ij.process.ImageProcessorgetMaskProcessor(boolean floatProcessor, double[] maskValues) Creates a 2D 'Sholl heatmap' by applying measured values to the foreground pixels of a copy of the analyzed image.Gets the Sholl profile generated by the parsing operation.booleandoublevoidparse()Performs the parsing operation to extract the Sholl profile.voidreset()voidrun()voidsetCenter(double x, double y, double z) Sets the center of analysis using real world (calibrated) coordinates.voidComputes the center of analysis from the centroid of the active ROI.voidsetCenterFromROI(ij.gui.Roi roi) Computes the center of analysis from the centroid of the specified ROI.voidsetCenterPx(int x, int y, int z) Sets the center of analysis using image (pixel) coordinates.voidsetHemiShells(String flag) protected voidsetPosition(int channel, int frame) voidsetRadii(double[] radiiArray) voidsetRadii(double startRadius, double step, double endRadius) voidsetRetrieveIntDensities(boolean retrieveIntDensities) voidsetThreshold(double lower, double upper) Sets the threshold range for pixel inclusion in the analysis.booleanChecks if the parsing operation was successful.voidTerminates the parsing operation.protected booleanwithinBounds(int x, int y, int z) protected booleanwithinThreshold(double value) protected booleanwithinXYbounds(int x, int y) protected booleanwithinZbounds(int z) Methods inherited from class org.scijava.command.ContextCommand
cancel, getCancelReason, isCanceledMethods inherited from class org.scijava.AbstractContextual
context, getContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.scijava.Contextual
setContext
-
Field Details
-
statusService
protected org.scijava.app.StatusService statusService -
profile
-
properties
-
center
-
radii
-
imp
protected final ij.ImagePlus imp -
cal
protected final ij.measure.Calibration cal -
voxelSize
protected final double voxelSize -
lowerT
protected double lowerT -
upperT
protected double upperT -
channel
protected int channel -
frame
protected int frame -
minX
protected int minX -
maxX
protected int maxX -
minY
protected int minY -
maxY
protected int maxY -
minZ
protected int minZ -
maxZ
protected int maxZ -
xc
protected int xc -
yc
protected int yc -
zc
protected int zc -
start
protected long start -
running
protected volatile boolean running
-
-
Constructor Details
-
ImageParser
Deprecated. -
ImageParser
protected ImageParser(ij.ImagePlus imp, org.scijava.Context context)
-
-
Method Details
-
getIsotropicVoxelSize
public double getIsotropicVoxelSize()Gets the isotropic voxel size used for analysis.For 2D images, this is the average of pixel width and height. For 3D images, this is the average of pixel width, height, and depth. This value is used as the minimum step size for radial sampling.
- Returns:
- the isotropic voxel size in calibrated units
-
setCenterFromROI
Computes the center of analysis from the centroid of the active ROI.- Throws:
IllegalArgumentException- if image has no current selection or active ROI
-
setCenterFromROI
Computes the center of analysis from the centroid of the specified ROI.- Parameters:
roi- the selection from which the centroid will be computed- Throws:
IllegalArgumentException- if roi is null
-
setCenterPx
Sets the center of analysis using image (pixel) coordinates.- Parameters:
x- the x coordinate (in pixels)y- the y coordinate (in pixels)z- the z coordinate (in pixels), i.e., slice number (1-based index)- Throws:
IndexOutOfBoundsException- if specified coordinates extends beyond image dimensions
-
setCenter
public void setCenter(double x, double y, double z) Sets the center of analysis using real world (calibrated) coordinates.- Parameters:
x- the x coordinate (in calibrated units)y- the y coordinate (in calibrated units)z- the z coordinate (in calibrated units)
-
setThreshold
public void setThreshold(double lower, double upper) Sets the threshold range for pixel inclusion in the analysis.Only pixels with intensity values within the specified range will be considered as intersections during Sholl analysis. This is particularly useful for analyzing specific structures in grayscale images.
- Parameters:
lower- the lower threshold value (inclusive)upper- the upper threshold value (inclusive)
-
setRadii
public void setRadii(double[] radiiArray) -
setRadii
public void setRadii(double startRadius, double step, double endRadius) -
maxPossibleRadius
public double maxPossibleRadius() -
setRetrieveIntDensities
public void setRetrieveIntDensities(boolean retrieveIntDensities) -
isRetrieveIntDensitiesSet
public boolean isRetrieveIntDensitiesSet() -
checkUnsetFields
protected void checkUnsetFields(boolean includeThreshold) -
checkUnsetFields
protected void checkUnsetFields() -
setHemiShells
-
getCircumferencePoints
public int[][] getCircumferencePoints(int cx, int cy, int radius) -
getMask
public ij.ImagePlus getMask() -
getMaskProcessor
public ij.process.ImageProcessor getMaskProcessor(boolean floatProcessor, double[] maskValues) Creates a 2D 'Sholl heatmap' by applying measured values to the foreground pixels of a copy of the analyzed image.- Parameters:
floatProcessor- if true, a FloatProcessor is returned, if false, a ShortProcessor is returnedmaskValues- the mask values- Returns:
- the processor containing the heatmap
-
setPosition
protected void setPosition(int channel, int frame) -
withinThreshold
protected boolean withinThreshold(double value) -
withinXYbounds
protected boolean withinXYbounds(int x, int y) -
withinZbounds
protected boolean withinZbounds(int z) -
withinBounds
protected boolean withinBounds(int x, int y, int z) -
clearStatus
protected void clearStatus() -
parse
public void parse()Description copied from interface:ParserPerforms the parsing operation to extract the Sholl profile.This method analyzes the data source and computes intersection counts at various radial distances from the center point. The resulting profile can be retrieved using
Parser.getProfile().Implementations should handle any necessary preprocessing, validation, and error handling during the parsing process.
-
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
-
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.
-
reset
public void reset() -
run
public void run()
-