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

public class PathProfiler extends CommonDynamicCmd
Command to retrieve Path profiles (plots of voxel intensities values along a Path)
Author:
Tiago Ferreira, Cameron Arshadi
  • Field Details

  • Constructor Details

    • PathProfiler

      public PathProfiler()
      Empty constructor used by CommandService before calling run(). Should not be called directly.
    • PathProfiler

      @Deprecated public PathProfiler(Tree tree, ij.ImagePlus imp)
    • PathProfiler

      @Deprecated public PathProfiler(Path path, ij.ImagePlus imp)
    • PathProfiler

      public PathProfiler(Tree tree, net.imagej.Dataset dataset)
      Instantiates a new Profiler.
      Parameters:
      tree - the Tree to be profiled
      dataset - 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

      public PathProfiler(Path path, net.imagej.Dataset dataset)
      Instantiates a new Profiler from a single path.
      Parameters:
      path - the path to be profiled
      dataset - 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

    • setShape

      public void setShape(ProfileProcessor.Shape shape)
      Parameters:
      shape - Either ProfileProcessor.Shape
    • setMetric

      public void setMetric(ProfileProcessor.Metric metric)
    • setRadius

      public void setRadius(int radius)
    • run

      public void run()
      Specified by:
      run in interface org.scijava.module.MutableModule
      Specified by:
      run in interface Runnable
      Overrides:
      run in class CommonDynamicCmd
    • assignValues

      public void assignValues() throws IllegalArgumentException
      Calls assignValues(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 Path values
      Parameters:
      channel - the channel to be parsed (base-0 index)
      Throws:
      IllegalArgumentException - if image does not contain the path's channel
      ArrayIndexOutOfBoundsException
    • assignValues

      public void assignValues(Path p) throws IllegalArgumentException
      Retrieves pixel intensities at each node of the Path storing them as Path values
      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 Path values
      Parameters:
      p - the Path to be profiled
      channel - the channel to be parsed (base-0 index)
      Throws:
      IllegalArgumentException - if image does not contain the path's channel
      ArrayIndexOutOfBoundsException
      See Also:
    • findMaxima

      public int[] findMaxima(Path path, int channel)
      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

      public int[] findMinima(Path path, int channel)
      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 calling getValues(Path), getPlot() or getXYPlot().
      Parameters:
      nodeIndices - If true, distances will be reported as indices.
    • getValues

      public Map<String,List<Double>> getValues(Path p)
      Gets the profile for the specified path as a map of lists, with distances (or indices) stored under X_VALUES ("x-values") and intensities under Y_VALUES ("y-values").
      Parameters:
      p - the path to be profiled
      Returns:
      the profile
    • getValues

      public Map<String,List<Double>> getValues(Path p, int channel)
      Gets the profile for the specified path as a map of lists, with distances (or indices) stored under X_VALUES ("x-values") and intensities under Y_VALUES ("y-values").
      Parameters:
      p - the path to be profiled
      channel - the channel to be parsed (base-0 index)
      Returns:
      the profile map
    • getPlot

      public ij.gui.Plot getPlot() throws IllegalArgumentException, ArrayIndexOutOfBoundsException
      Gets the plot profile as an ImageJ Plot (all channels).
      Returns:
      the plot
      Throws:
      IllegalArgumentException
      ArrayIndexOutOfBoundsException
    • 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:
      IllegalArgumentException
      ArrayIndexOutOfBoundsException
    • getPlot

      public ij.gui.Plot getPlot(Path path)
      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 an PlotService plot. It is recommended to call DynamicCommand.setContext(org.scijava.Context) beforehand.
      Returns:
      the plot
    • getXYPlot

      public org.scijava.plot.XYPlot getXYPlot(int channel) throws IllegalArgumentException
      Gets the plot profile as an PlotService plot. It is recommended to call DynamicCommand.setContext(org.scijava.Context) beforehand.
      Parameters:
      channel - the channel to be parsed (base-0 index)
      Returns:
      the plot
      Throws:
      IllegalArgumentException
    • main

      public static void main(String[] args)