Class IJProcessing
This focuses especially on common processing operations involving ImageProcessor
, including the creation
of labeled images and Rois.
- Since:
- v0.6.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic int
Constant for 4-connectivity when tracing Rois.static int
Constant for 8-connectivity when tracing Rois. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends ImageProcessor>
Tadd
(T ip, ImageProcessor... ipOthers) Pixelwise sum of input images.static Roi
autoThresholdToRoi
(ImageProcessor ip, String method) Apply an auto-threshold to an image, and generate a Roi from the result.autoThresholdToSplitRois
(ImageProcessor ip, String method, int connectivity) Apply an auto-threshold to an image, and generate a zero or more Rois from the result based on connected components.static Overlay
createOverlay
(Collection<? extends Roi> rois) Create an overlay containing all the Rois in the provided collection.static <T extends ImageProcessor>
Tdivide
(T ip, ImageProcessor... ipOthers) Pixelwise division of the input images.static ImageProcessor
labelImage
(ImageProcessor ip, int connectivity) Create a labeled image using the thresholds set on anImageProcessor
(inclusive).static ImageProcessor
labelImage
(ImageProcessor ip, int connectivity, DoublePredicate predicate) Create a labeled image using the thresholds set on anImageProcessor
.labelsToRois
(ImageProcessor ipLabels) Create ImageJ Rois from labels in an image.static Roi[]
labelsToRoisArray
(ImageProcessor ipLabels) Create ImageJ Rois from labels in an image.static <T extends ImageProcessor>
Tmax
(T ip, ImageProcessor... ipOthers) Pixelwise maximum of the input images.static <T extends ImageProcessor>
Tmin
(T ip, ImageProcessor... ipOthers) Pixelwise minimum of the input images.static <T extends ImageProcessor>
Tmultiply
(T ip, ImageProcessor... ipOthers) Pixelwise multiplication of the input images.static <T extends ImageProcessor>
Tsubtract
(T ip, ImageProcessor... ipOthers) Pixelwise subtraction of one or more images from the first image passed as a parameter.static Roi
Create an ImageJ ROI from a thresholded image.thresholdToSplitRois
(ImageProcessor ip, int connectivity) Create a list of ImageJ ROIs by tracing connected components in a thresholded image.static PolygonRoi
Convert a traced outline from the ImageJ Wand into a PolygonRoi.
-
Field Details
-
CONNECTIVITY_4
public static int CONNECTIVITY_4Constant for 4-connectivity when tracing Rois. -
CONNECTIVITY_8
public static int CONNECTIVITY_8Constant for 8-connectivity when tracing Rois.
-
-
Constructor Details
-
IJProcessing
public IJProcessing()
-
-
Method Details
-
autoThresholdToRoi
Apply an auto-threshold to an image, and generate a Roi from the result.The threshold of the image will be set temporarily and then removed afterwards.
- Parameters:
ip
- the input imagemethod
- a method string, as accepted byImageProcessor.setAutoThreshold(String)
- Returns:
- the threshold Roi, or null if no thresholded pixels were found
-
autoThresholdToSplitRois
public static List<Roi> autoThresholdToSplitRois(ImageProcessor ip, String method, int connectivity) Apply an auto-threshold to an image, and generate a zero or more Rois from the result based on connected components.The threshold of the image will be set temporarily and then removed afterwards.
- Parameters:
ip
- the input imagemethod
- a method string, as accepted byImageProcessor.setAutoThreshold(String)
connectivity
- either 4 or 8- Returns:
- a list containing a Roi for each connected component
-
thresholdToRoi
Create an ImageJ ROI from a thresholded image.This makes use of
ThresholdToSelection
, and returns null if no Roi is found.- Parameters:
ip
- the image, with min and/or max thresholds already set.- Returns:
- a Roi generated by applying the threshold, or null if there are no thresholded pixels
-
thresholdToSplitRois
Create a list of ImageJ ROIs by tracing connected components in a thresholded image.This makes use of
ThresholdToSelection
, and returns null if no Roi is found.- Parameters:
ip
- the image, with min and/or max thresholds already setconnectivity
- may be 4 or 8- Returns:
- a Roi generated by applying the threshold, or null if there are no thresholded pixels
-
labelImage
Create a labeled image using the thresholds set on anImageProcessor
(inclusive).- Parameters:
ip
- the input imageconnectivity
- may be 4 or 8- Returns:
- labelled image, as a ShortProcessor (if possible) or FloatProcessor (if necessary)
-
labelImage
public static ImageProcessor labelImage(ImageProcessor ip, int connectivity, DoublePredicate predicate) Create a labeled image using the thresholds set on anImageProcessor
.- Parameters:
ip
- the input imageconnectivity
- may be 4 or 8predicate
- the predicate to determine if a pixel should be labeled based on its value- Returns:
- labelled image, as a ShortProcessor (if possible) or FloatProcessor (if necessary)
- Since:
- v0.6.0
-
labelsToRoisArray
Create ImageJ Rois from labels in an image.Note that this is intended to handle disconnected Rois and Rois that contain holes, such that the Roi contains all pixels with the given label and no other pixels.
- Parameters:
ipLabels
- the labeled image; generally this should be a ByteProcessor or ShortProcessor- Returns:
- an array of length n; output[i] is the ROI for label i+1, or null if no Roi is found with that label.
-
labelsToRois
Create ImageJ Rois from labels in an image.This is similar to
labelsToRoisArray(ImageProcessor)
but omits any null Rois. Consequently, when labels can be missing it is not possible to relate the index from the list to the original label.- Parameters:
ipLabels
- the labeled image; generally this should be a ByteProcessor or ShortProcessor- Returns:
- a list of Rois that were found
-
wandToRoi
Convert a traced outline from the ImageJ Wand into a PolygonRoi.- Parameters:
wand
-- Returns:
-
createOverlay
Create an overlay containing all the Rois in the provided collection.- Parameters:
rois
-- Returns:
-
subtract
Pixelwise subtraction of one or more images from the first image passed as a parameter. The input images are unchanged.- Parameters:
ip
- the first imageipOthers
- additional images- Returns:
- a new image representing the result of the subtraction.
-
add
Pixelwise sum of input images. The input images are unchanged.- Parameters:
ip
- the first imageipOthers
- additional images- Returns:
- a new image representing the result of the addition.
-
multiply
Pixelwise multiplication of the input images. The input images are unchanged.- Parameters:
ip
- the first imageipOthers
- additional images- Returns:
- a new image representing the result of the multiplication.
-
divide
Pixelwise division of the input images. The input images are unchanged.- Parameters:
ip
- the first imageipOthers
- additional images- Returns:
- a new image representing the result of the division.
-
max
Pixelwise maximum of the input images. The input images are unchanged.- Parameters:
ip
- the first imageipOthers
- additional images- Returns:
- a new image representing the result of the max operation.
-
min
Pixelwise minimum of the input images. The input images are unchanged.- Parameters:
ip
- the first imageipOthers
- additional images- Returns:
- a new image representing the result of the min operation.
-