Package sc.fiji.snt.analysis
Class PathProfiler
java.lang.Object
org.scijava.module.AbstractModule
org.scijava.module.DefaultMutableModule
org.scijava.command.DynamicCommand
sc.fiji.snt.gui.cmds.CommonDynamicCmd
sc.fiji.snt.analysis.PathProfiler
- All Implemented Interfaces:
Runnable,org.scijava.Cancelable,org.scijava.command.Command,org.scijava.Contextual,org.scijava.module.Module,org.scijava.module.MutableModule,org.scijava.plugin.SciJavaPlugin
- Direct Known Subclasses:
TimeProfiler
Command to retrieve Path profiles (plots of voxel intensities values along a
Path)
- Author:
- Tiago Ferreira, Cameron Arshadi
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected net.imagej.Datasetprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected Treeprotected booleanstatic final StringKey for retrieving distances fromgetValues(Path)static final StringKey for retrieving intensities fromgetValues(Path)Fields inherited from class sc.fiji.snt.gui.cmds.CommonDynamicCmd
EMPTY_LABEL, HEADER_HTML, snt, sntService, statusService, ui, uiServiceFields inherited from class org.scijava.command.DynamicCommand
moduleService, pluginService -
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructor used by CommandService before callingrun().PathProfiler(Path path, ij.ImagePlus imp) Deprecated.PathProfiler(Path path, net.imagej.Dataset dataset) Instantiates a new Profiler from a single path.PathProfiler(Tree tree, ij.ImagePlus imp) Deprecated.PathProfiler(Tree tree, net.imagej.Dataset dataset) Instantiates a new Profiler. -
Method Summary
Modifier and TypeMethodDescriptionvoidCallsassignValues(Path)on the Paths of the profiled TreevoidassignValues(int channel) Retrieves pixel intensities at each node of the Path storing them as PathvaluesvoidassignValues(Path p) Retrieves pixel intensities at each node of the Path storing them as Pathvalues<T extends net.imglib2.type.numeric.RealType<T>>
voidassignValues(Path p, int channel) Retrieves pixel intensities at each node of the Path storing them as Pathvalues<T extends net.imglib2.type.numeric.RealType<T>>
voidassignValues(Path p, int channel, int frame) Retrieves pixel intensities at each node of the Path storing them as Pathvaluesprotected voidint[]findMaxima(Path path, int channel) Finds the maxima in the profile of the specified path.int[]findMinima(Path path, int channel) Finds the minima in the profile of the specified path.double[][]getMultiFrameProfile(List<Path> paths, int channel, int nSamples, boolean normalizeDistance) Builds a multi-frame intensity profile matrix from a list of matched paths (one per time frame, ordered by frame number), suitable for kymograph-style visualization viaSNTChart.showHeatmap(double[][], net.imglib2.display.ColorTable, java.lang.String...).ij.gui.PlotgetPlot()Gets the plot profile as an ImageJPlot(all channels).ij.gui.PlotgetPlot(int channel) Gets the plot profile as an ImageJ plot (single-channel).ij.gui.PlotGets the plot profile as an ImageJ plot (all channels included).double[]getResampledValues(Path p, int channel, int nSamples, double gridMax) Resamples the intensity profile of a path onto a uniform distance grid via linear interpolation.double[]getResampledValues(Path p, int channel, int frame, int nSamples, double gridMax) Resamples the intensity profile of a path onto a uniform distance grid via linear interpolation.getTimeProfile(Path path, int channel) Gets the time profile for the specified path as a list ofgetValues(Path, int, int)profiles, with one entry per frame of the dataset.Gets the profile for the specified path as a map of lists, with distances (or indices) stored underX_VALUES("x-values") and intensities underY_VALUES("y-values").Gets the profile for the specified path as a map of lists, with distances (or indices) stored underX_VALUES("x-values") and intensities underY_VALUES("y-values").Gets the profile for the specified path as a map of lists, with distances (or indices) stored underX_VALUES("x-values") and intensities underY_VALUES("y-values").protected Stringorg.scijava.plot.XYPlotGets the plot profile as anPlotServiceplot.org.scijava.plot.XYPlotgetXYPlot(int channel) Gets the plot profile as anPlotServiceplot.protected StringgetYAxisLabel(int channel) protected voidinit()static voidvoidrun()voidsetMetric(ProfileProcessor.Metric metric) voidsetNodeIndicesAsDistances(boolean nodeIndices) Sets whether the profile abscissae should be reported in real-word units (the default) or node indices (zero-based).voidsetRadius(int radius) voidsetShape(ProfileProcessor.Shape shape) Methods inherited from class sc.fiji.snt.gui.cmds.CommonDynamicCmd
cancel, cancel, error, getPromptWithCloseHandler, getPromptWithCloseHandler, init, isCanceled, msg, notifyExternalDataLoaded, notifyLoadingEnd, notifyLoadingStart, resetUI, resetUI, resetUI, statusMethods inherited from class org.scijava.command.DynamicCommand
context, getCancelReason, getContext, getInfo, getInput, getOutput, saveInputs, setContext, setInput, setOutput, uncancelMethods inherited from class org.scijava.module.AbstractModule
getDelegateObject, getInputs, getOutputs, initialize, isInputResolved, isOutputResolved, preview, resolveInput, resolveOutput, setInputs, setOutputs, unresolveInput, unresolveOutputMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.scijava.module.Module
getDelegateObject, getInputs, getOutputs, initialize, isInputResolved, isOutputResolved, isResolved, preview, resolveInput, resolveOutput, setInputs, setOutputs, setResolved, unresolveInput, unresolveOutputMethods inherited from interface org.scijava.module.MutableModule
addInput, addInput, addOutput, addOutput, removeInput, removeOutput
-
Field Details
-
CIRCLE2D
- See Also:
-
CIRCLE3D
- See Also:
-
DISK2D
- See Also:
-
DISK3D
- See Also:
-
SPHERE
- See Also:
-
LINE2D
- See Also:
-
LINE3D
- See Also:
-
NONE
- See Also:
-
X_VALUES
Key for retrieving distances fromgetValues(Path)- See Also:
-
Y_VALUES
Key for retrieving intensities fromgetValues(Path)- See Also:
-
usePhysicalUnits
protected boolean usePhysicalUnits -
tree
-
dataset
protected net.imagej.Dataset dataset
-
-
Constructor Details
-
PathProfiler
public PathProfiler()Empty constructor used by CommandService before callingrun(). Should not be called directly. -
PathProfiler
Deprecated. -
PathProfiler
Deprecated. -
PathProfiler
Instantiates a new Profiler.- Parameters:
tree- the Tree to be profileddataset- the dataset from which pixel intensities will be retrieved. Note that no effort is made to ensure that the image is suitable for profiling.
-
PathProfiler
Instantiates a new Profiler from a single path.- Parameters:
path- the path to be profileddataset- the dataset from which pixel intensities will be retrieved.Note that no effort is made to ensure that the image is suitable for profiling
-
-
Method Details
-
init
protected void init() -
evalParameters
protected void evalParameters() -
setShape
- Parameters:
shape- EitherProfileProcessor.Shape
-
setMetric
-
setRadius
public void setRadius(int radius) -
run
public void run()- Specified by:
runin interfaceorg.scijava.module.MutableModule- Specified by:
runin interfaceRunnable- Overrides:
runin classCommonDynamicCmd
-
getChannels
-
assignValues
CallsassignValues(Path)on the Paths of the profiled Tree- Throws:
IllegalArgumentException
-
assignValues
public void assignValues(int channel) throws IllegalArgumentException, ArrayIndexOutOfBoundsException Retrieves pixel intensities at each node of the Path storing them as Pathvalues- Parameters:
channel- the channel to be parsed (base-0 index)- Throws:
IllegalArgumentException- if image does not contain the path's channelArrayIndexOutOfBoundsException
-
assignValues
Retrieves pixel intensities at each node of the Path storing them as Pathvalues- Parameters:
p- the Path to be profiled- Throws:
IllegalArgumentException- if image does not contain the path's channel- See Also:
-
assignValues
public <T extends net.imglib2.type.numeric.RealType<T>> void assignValues(Path p, int channel) throws ArrayIndexOutOfBoundsException Retrieves pixel intensities at each node of the Path storing them as Pathvalues- Parameters:
p- the Path to be profiledchannel- the channel to be parsed (base-0 index)- Throws:
IllegalArgumentException- if image does not contain the path's channelArrayIndexOutOfBoundsException- See Also:
-
assignValues
public <T extends net.imglib2.type.numeric.RealType<T>> void assignValues(Path p, int channel, int frame) throws ArrayIndexOutOfBoundsException Retrieves pixel intensities at each node of the Path storing them as Pathvalues- Parameters:
p- the Path to be profiledchannel- the channel to be parsed (base-0 index)frame- the frame to be parsed (base-0 index)- Throws:
IllegalArgumentException- if image does not contain the path's channelArrayIndexOutOfBoundsException- See Also:
-
findMaxima
Finds the maxima in the profile of the specified path.A maxima (peak) will only be considered if protruding more than the profile's standard deviation from the ridge to a higher maximum
- Parameters:
channel- the channel to be parsed (base-0 index)- Returns:
- the indices of the maxima
-
findMinima
Finds the minima in the profile of the specified path.A maxima (peak) will only be considered if protruding less than the profile's standard deviation from the ridge to a lower minimum
- Parameters:
channel- the channel to be parsed (base-0 index)- Returns:
- the indices of the minima
-
setNodeIndicesAsDistances
public void setNodeIndicesAsDistances(boolean nodeIndices) Sets whether the profile abscissae should be reported in real-word units (the default) or node indices (zero-based). Must be called before callinggetValues(Path),getPlot()orgetXYPlot().- Parameters:
nodeIndices- If true, distances will be reported as indices.
-
getValues
Gets the profile for the specified path as a map of lists, with distances (or indices) stored underX_VALUES("x-values") and intensities underY_VALUES("y-values").- Parameters:
p- the path to be profiled- Returns:
- the profile
-
getValues
Gets the profile for the specified path as a map of lists, with distances (or indices) stored underX_VALUES("x-values") and intensities underY_VALUES("y-values"). If dataset is a time-lapse, the path's assigned frame is profiled.- Parameters:
p- the path to be profiledchannel- the channel to be parsed (base-0 index)- Returns:
- the profile map
-
getValues
Gets the profile for the specified path as a map of lists, with distances (or indices) stored underX_VALUES("x-values") and intensities underY_VALUES("y-values").- Parameters:
p- the path to be profiledchannel- the channel to be parsed (base-0 index)frame- the frame to be parsed (base-0 index)- Returns:
- the profile map
-
getXAxisLabel
-
getYAxisLabel
-
getPlot
Gets the plot profile as an ImageJPlot(all channels).- Returns:
- the plot
- Throws:
IllegalArgumentExceptionArrayIndexOutOfBoundsException
-
getPlot
public ij.gui.Plot getPlot(int channel) throws IllegalArgumentException, ArrayIndexOutOfBoundsException Gets the plot profile as an ImageJ plot (single-channel).- Parameters:
channel- the channel to be parsed (base-0 index)- Returns:
- the plot
- Throws:
IllegalArgumentExceptionArrayIndexOutOfBoundsException
-
getPlot
Gets the plot profile as an ImageJ plot (all channels included).- Returns:
- the plot
-
getXYPlot
public org.scijava.plot.XYPlot getXYPlot()Gets the plot profile as anPlotServiceplot. It is recommended to callDynamicCommand.setContext(org.scijava.Context)beforehand.- Returns:
- the plot
-
getXYPlot
Gets the plot profile as anPlotServiceplot. It is recommended to callDynamicCommand.setContext(org.scijava.Context)beforehand.- Parameters:
channel- the channel to be parsed (base-0 index)- Returns:
- the plot
- Throws:
IllegalArgumentException
-
getResampledValues
Resamples the intensity profile of a path onto a uniform distance grid via linear interpolation. Entries beyond the path's actual length are set toDouble.NaN, which allows variable-length paths to be compared in the same matrix without padding with zeros.- Parameters:
p- the path to profile (values are assigned if not yet set)channel- the channel to sample (base-0 index)nSamples- the number of output grid points (>= 2)gridMax- the upper bound of the distance grid. Use the path's actual length for a per-path-normalized grid (0..length), or a shared maximum across all paths for an absolute grid- Returns:
- array of length
nSampleswith interpolated intensities
-
getResampledValues
Resamples the intensity profile of a path onto a uniform distance grid via linear interpolation. Entries beyond the path's actual length are set toDouble.NaN, which allows variable-length paths to be compared in the same matrix without padding with zeros.- Parameters:
p- the path to profile (values are assigned if not yet set)channel- the channel to sample (base-0 index)frame- the frame to sample (base-0 index)nSamples- the number of output grid points (>= 2)gridMax- the upper bound of the distance grid. Use the path's actual length for a per-path-normalized grid (0..length), or a shared maximum across all paths for an absolute grid- Returns:
- array of length
nSampleswith interpolated intensities
-
getMultiFrameProfile
public double[][] getMultiFrameProfile(List<Path> paths, int channel, int nSamples, boolean normalizeDistance) Builds a multi-frame intensity profile matrix from a list of matched paths (one per time frame, ordered by frame number), suitable for kymograph-style visualization viaSNTChart.showHeatmap(double[][], net.imglib2.display.ColorTable, java.lang.String...).The returned matrix has dimensions [nPaths][nSamples], where
matrix[i][j]is the interpolated intensity at distance sample j for the i-th path. Entries beyond a path's actual length areDouble.NaN.- Parameters:
paths- ordered list of paths, one per time framechannel- the channel to sample (base-0 index)nSamples- number of distance samples (columns in the result)normalizeDistance- if true, distances are normalized to [0,1] so all rows span the full width regardless of path length; if false, absolute distances are used and the grid max equals the longest path in the list- Returns:
- a 2D array [nPaths][nSamples] of intensity values
-
getTimeProfile
Gets the time profile for the specified path as a list ofgetValues(Path, int, int)profiles, with one entry per frame of the dataset.- Parameters:
path- the path to be profiledchannel- the channel to be parsed (base-0 index)- Returns:
- the list of profile values (one entry per frame)
-
main
-
PathProfiler(Path, Dataset)