public class FeatureStack extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ANISOTROPIC_DIFFUSION
Anisotropic diffusion filter flag index
|
static String[] |
availableFeatures
names of available filters
|
static int |
BILATERAL
Bilateral flag index
|
static int |
DERIVATIVES
Derivatives filter flag index
|
static int |
DOG
Difference of Gaussians filter flag index
|
static int |
ENTROPY
entropy filter flag index
|
static int |
GABOR
Gabor filter flag index
|
static int |
GAUSSIAN
Gaussian filter flag index
|
static int |
HESSIAN
Hessian filter flag index
|
static boolean[] |
IMAGESCIENCE_FEATURES
Features only available if the ImageScience library is present.
|
static int |
KUWAHARA
Kuwahara filter flag index
|
static int |
LAPLACIAN
Laplacian filter flag index
|
static int |
LIPSCHITZ
Lipschitz filter flag index
|
static int |
MAXIMUM
Maximum filter flag index
|
static int |
MEAN
Mean filter flag index
|
static int |
MEDIAN
Median filter flag index
|
static int |
MEMBRANE
Membrane filter flag index
|
static int |
MINIMUM
Minimum filter flag index
|
static int |
NEIGHBORS
neighbors feature flag index
|
static int |
SOBEL
Sobel filter flag index
|
static int |
STRUCTURE
structure tensor filter flag index
|
static int |
VARIANCE
Variance filter flag index
|
Constructor and Description |
---|
FeatureStack(ij.ImagePlus image)
Construct object to store stack of image features.
|
FeatureStack(ij.process.ImageProcessor ip)
Construct object to store stack of image features.
|
FeatureStack(int width,
int height,
boolean colorFeatures)
Initialize empty feature stack.
|
Modifier and Type | Method and Description |
---|---|
void |
addAnisotropicDiffusion(ij.ImagePlus originalImage,
int nb_iter,
int saveSteps,
int nb_smoothings,
float a1,
float a2,
float edgeThreshold)
Add anisotropic diffusion filtering images to current stack
|
void |
addBilateralFilter(ij.ImagePlus originalImage,
double spatialRadius,
double rangeRadius)
Add bilateral filter image to current stack
|
void |
addDefaultFeatures()
Add the default features to the feature stack
|
void |
addDerivatives(double sigma,
int xOrder,
int yOrder)
Add derivatives features to current stack
|
void |
addDoG(float sigma1,
float sigma2)
Add difference of Gaussians to feature stack (single thread version)
|
void |
addEntropy(int radius,
int numBins)
Add entropy filter to current stack
|
void |
addFeaturesMT(ij.ImagePlus filterList)
Add features based on a list of filters in a multi-thread fashion
|
void |
addGabor(ij.ImagePlus originalImage,
double sigma,
double gamma,
double psi,
double frequency,
int nAngles)
Add Gabor features to current stack
|
void |
addGaussianBlur(float sigma)
Add Gaussian blur slice to current stack
|
void |
addGradient(float sigma)
Add Sobel filter version of the original image
|
void |
addHessian(float sigma)
Add Hessian features from original image (single thread version).
|
void |
addHSB()
Add HSB features
|
void |
addKuwaharaFeatures(ij.ImagePlus originalImage,
int kernelSize,
int nAngles,
int criterion)
Add Kuwahara filter features to the current stack
|
void |
addLaplacian(double sigma)
Add Laplacian features to current stack
|
void |
addLipschitzFilter(ij.ImagePlus originalImage,
boolean downHat,
boolean topHat,
double slope)
Add Lipschitz filter image to current stack
|
void |
addMax(float radius)
Add maximum filter to current feature stack.
|
void |
addMean(float radius)
Add mean filter to current stack
|
void |
addMedian(float radius)
Add median filter to the current feature stack.
|
void |
addMembraneFeatures(int patchSize,
int membraneSize)
Add membrane features to the stack (single thread version)
|
void |
addMin(float radius)
Add minimum filter to current feature stack.
|
void |
addNeighbors(int minSigma,
int maxSigma)
Add 8 neighbors of the original image as features
|
void |
addStructure(double sigma,
double integrationScale)
Add structure tensor features to current stack
It computes, for all pixels in the input image, the eigenvalues of the so-called structure tensor.
|
void |
addVariance(float radius)
Add variance-filtered image to the stack (single thread version)
|
DenseInstance |
createInstance(int x,
int y)
Create instance (feature vector) of a specific coordinate without a class, to be used on unsupervised clustering.
|
DenseInstance |
createInstance(int x,
int y,
int classValue)
Create instance (feature vector) of a specific coordinate
|
void |
createInstanceInPlace(int x,
int y,
int classValue,
DenseInstance ins)
Create instance (feature vector) of a specific coordinate in place.
|
Instances |
createInstances(ArrayList<String> classes)
Create the instances for the whole stack
|
Callable<ij.ImagePlus> |
getAnisotropicDiffusion(ij.ImagePlus originalImage,
int nb_iter,
int saveSteps,
int nb_smoothings,
float a1,
float a2,
float edgeThreshold)
Apply anisotropic diffusion in a concurrent way (to be submitted in an ExecutorService)
|
Callable<ij.ImagePlus> |
getBilateralFilter(ij.ImagePlus originalImage,
double spatialRadius,
double rangeRadius)
Apply bilateral filter in a concurrent way (to be submitted in an ExecutorService)
|
Callable<ij.ImagePlus> |
getDerivatives(ij.ImagePlus originalImage,
double sigma,
int xOrder,
int yOrder)
Get derivatives features (to be submitted in an ExecutorService)
|
Callable<ij.ImagePlus> |
getDoG(ij.ImagePlus originalImage,
float sigma1,
float sigma2)
Get difference of Gaussians (to be submitted to an ExecutorService)
|
boolean[] |
getEnabledFeatures()
Get the list of enabled features flags
|
Callable<ij.ImagePlus> |
getEntropy(ij.ImagePlus originalImage,
int radius,
int numBins)
Calculate entropy filter filter concurrently
|
Callable<ij.ImagePlus> |
getFilter(ij.ImagePlus originalImage,
ij.process.ImageProcessor filter,
String title)
Apply a filter to the original image (to be submitted to an ExecutorService)
|
Callable<ij.ImagePlus> |
getGabor(ij.ImagePlus originalImage,
double sigma,
double gamma,
double psi,
double frequency,
int nAngles,
ExecutorService exec)
Get Gabor features (to be submitted in an ExecutorService)
|
Callable<ij.ImagePlus> |
getGaussianBlur(ij.ImagePlus originalImage,
float sigma)
Calculate Gaussian filter concurrently
|
Callable<ij.ImagePlus> |
getGradient(ij.ImagePlus originalImage,
float sigma)
Get Sobel filter version of the original image (to be called from an ExecutorService)
|
int |
getHeight()
Get stack height
|
Callable<ij.ImagePlus> |
getHessian(ij.ImagePlus originalImage,
float sigma)
Get Hessian features from original image (to be submitted in an ExecutorService).
|
Callable<ij.ImagePlus> |
getHSB(ij.ImagePlus originalImage)
Calculate HSB out of the RGB channels (to be submitted to an ExecutorService)
|
Callable<ij.ImagePlus> |
getKuwaharaFeatures(ij.ImagePlus originalImage,
int kernelSize,
int nAngles,
int criterion)
Get Kuwahara filter features (to be submitted in an ExecutorService)
|
Callable<ij.ImagePlus> |
getLaplacian(ij.ImagePlus originalImage,
double sigma)
Get Laplacian features (to be submitted in an ExecutorService)
|
Callable<ij.ImagePlus> |
getLipschitzFilter(ij.ImagePlus originalImage,
boolean downHat,
boolean topHat,
double slope)
Apply Lipschitz filter in a concurrent way (to be submitted in an ExecutorService)
|
Callable<ij.ImagePlus> |
getMax(ij.ImagePlus originalImage,
float radius)
Get original image after maximum filtering (to be called from an ExecutorService)
|
Callable<ij.ImagePlus> |
getMean(ij.ImagePlus originalImage,
float radius)
Get original image after mean filtering (to be called from an ExecutorService)
|
Callable<ij.ImagePlus> |
getMedian(ij.ImagePlus originalImage,
float radius)
Get original image after median filtering (to be called from an ExecutorService)
|
Callable<ij.ImagePlus> |
getMembraneFeatures(ij.ImagePlus originalImage,
int patchSize,
int membraneSize)
Get membrane features (to be submitted in an ExecutorService)
|
int |
getMembraneSize()
Get the current membrane thickness
|
Callable<ij.ImagePlus> |
getMin(ij.ImagePlus originalImage,
float radius)
Get original image after minimum filtering (to be called from an ExecutorService)
|
Callable<ij.ImagePlus> |
getNeighbors(ij.ImagePlus originalImage,
int minSigma,
int maxSigma)
Calculate 8 neighbors concurrently
|
ij.process.ImageProcessor |
getProcessor(int index)
Get slice image processor.
|
int |
getSize()
Get stack size
|
String |
getSliceLabel(int index)
Get slice label
|
ij.ImageStack |
getStack()
Get current stack of image features.
|
Callable<ij.ImagePlus> |
getStructure(ij.ImagePlus originalImage,
double sigma,
double integrationScale)
Get structure tensor features (to be submitted in an ExecutorService).
|
Callable<ij.ImagePlus> |
getVariance(ij.ImagePlus originalImage,
float radius)
Calculate variance filter concurrently
|
int |
getWidth()
Get stack width
|
boolean |
isEmpty()
Check if the stack has been initialized or not
|
boolean |
isOldColorFormat()
Check if the feature stack is using the old Hessian format (previous to
TWS 3.2.25).
|
boolean |
isOldHessianFormat()
Check if the feature stack is using the old Hessian format (previous to
TWS version 3.2.25).
|
void |
removeFeature(String featureName)
Remove feature from stack
|
boolean |
reorderFeatures(Instances data)
Reorder the feature stack to match the order given by a set of instances.
|
boolean |
saveStackAsTiff(String filename)
Save current whole stack as TIFF
|
boolean |
setEnabledFeature(String featureName,
boolean enable)
Enable/disable feature by name
|
void |
setEnabledFeatures(boolean[] enableFeatures)
Set list of boolean flags for enabled features
|
void |
setInstance(int x,
int y,
int classValue,
ReusableDenseInstance ins,
double[] auxArray)
Set values to an instance (feature vector) of a specific coordinate.
|
void |
setInstance(int x,
int y,
ReusableDenseInstance ins,
double[] auxArray)
without class parameter
|
void |
setMaximumSigma(float maxSigma)
Set the maximum sigma to use in the filters
|
void |
setMembranePatchSize(int patchSize)
Set the membrane patch size (it must be an odd number)
|
void |
setMembraneSize(int membraneSize)
Set the expected membrane thickness
|
void |
setMinimumSigma(float minSigma)
Set the minimum sigma to use in the filters
|
void |
setOldColorFormat(boolean b)
Set the use of old color format.
|
void |
setOldHessianFormat(boolean b)
Set the use of old Hessian format.
|
void |
setStack(ij.ImageStack stack)
Set an arbitrary stack as feature stack.
|
void |
setUseNeighbors(boolean useNeighbors)
Set the use of the neighbors as features
|
void |
show()
Display feature stack
|
void |
shutDownNow()
Shut down the executor service
|
void |
updateFeatures()
Deprecated.
|
boolean |
updateFeaturesMT()
Update features with current list in a multi-thread fashion.
|
boolean |
updateFeaturesMT(int numThreads)
Update features with current list in a multi-thread fashion.
|
boolean |
updateFeaturesST()
Update features with current list in a single-thread fashion
|
boolean |
useNeighborhood()
Check the use of the neighbors as features
|
void |
writeConfigurationToFile(String filename)
Write feature names in a file
|
public static final int GAUSSIAN
public static final int SOBEL
public static final int HESSIAN
public static final int DOG
public static final int MEMBRANE
public static final int VARIANCE
public static final int MEAN
public static final int MINIMUM
public static final int MAXIMUM
public static final int MEDIAN
public static final int ANISOTROPIC_DIFFUSION
public static final int BILATERAL
public static final int LIPSCHITZ
public static final int KUWAHARA
public static final int GABOR
public static final int DERIVATIVES
public static final int LAPLACIAN
public static final int STRUCTURE
public static final int ENTROPY
public static final int NEIGHBORS
public static final String[] availableFeatures
public static final boolean[] IMAGESCIENCE_FEATURES
public FeatureStack(ij.ImagePlus image)
image
- original 2D image (grayscale or RGB)public FeatureStack(int width, int height, boolean colorFeatures)
setStack
method. Use this method if
you want to use your own features (not compatible with the
Weka_Segmentation
GUI).width
- image widthheight
- image heightcolorFeatures
- color image flagpublic FeatureStack(ij.process.ImageProcessor ip)
ip
- original 2D image (grayscale or RGB)public void shutDownNow()
public void show()
public int getSize()
public String getSliceLabel(int index)
index
- slice index (from 1 to max size)public int getHeight()
public int getWidth()
public boolean useNeighborhood()
public void setUseNeighbors(boolean useNeighbors)
useNeighbors
- flag to decide the use of neighborspublic void setMembranePatchSize(int patchSize)
patchSize
- membrane patch sizepublic void addGaussianBlur(float sigma)
sigma
- Gaussian radiuspublic Callable<ij.ImagePlus> getGaussianBlur(ij.ImagePlus originalImage, float sigma)
originalImage
- original input imagesigma
- Gaussian sigmapublic void addEntropy(int radius, int numBins)
radius
- radius to use (in pixels)numBins
- number of bins to use in the histogrampublic Callable<ij.ImagePlus> getEntropy(ij.ImagePlus originalImage, int radius, int numBins)
originalImage
- original input imageradius
- radius to use (in pixels)numBins
- number of bins to use in the histogrampublic void addNeighbors(int minSigma, int maxSigma)
minSigma
- minimum sigmamaxSigma
- maximum sigmapublic Callable<ij.ImagePlus> getNeighbors(ij.ImagePlus originalImage, int minSigma, int maxSigma)
originalImage
- original input imageminSigma
- minimum sigmamaxSigma
- minimum sigmapublic void addVariance(float radius)
radius
- variance filter radiuspublic Callable<ij.ImagePlus> getVariance(ij.ImagePlus originalImage, float radius)
originalImage
- original input imageradius
- for variance filterpublic void addMean(float radius)
radius
- radius to usepublic Callable<ij.ImagePlus> getMean(ij.ImagePlus originalImage, float radius)
originalImage
- input imageradius
- filter radiuspublic void addMin(float radius)
radius
- radius of the minimum filter in pixelspublic Callable<ij.ImagePlus> getMin(ij.ImagePlus originalImage, float radius)
originalImage
- input imageradius
- filter radiuspublic void addMax(float radius)
radius
- radius of the maximum filter in pixelspublic Callable<ij.ImagePlus> getMax(ij.ImagePlus originalImage, float radius)
originalImage
- input imageradius
- filter radiuspublic void addMedian(float radius)
radius
- radius of the median filter in pixelspublic Callable<ij.ImagePlus> getMedian(ij.ImagePlus originalImage, float radius)
originalImage
- input imageradius
- filter radiuspublic void writeConfigurationToFile(String filename)
filename
- output file namepublic void addGradient(float sigma)
sigma
- radius of the Gaussian blue applied previous to the Sobel filteringpublic Callable<ij.ImagePlus> getGradient(ij.ImagePlus originalImage, float sigma)
originalImage
- input imagesigma
- radius of the Gaussian blur applied previous to the Sobel filteringpublic void addHessian(float sigma)
sigma
- radius of the Gaussian filter to usepublic Callable<ij.ImagePlus> getHessian(ij.ImagePlus originalImage, float sigma)
originalImage
- input imagesigma
- radius of the Gaussian filter to usepublic void addDoG(float sigma1, float sigma2)
sigma1
- first Gaussian sigmasigma2
- second Gaussian sigmapublic Callable<ij.ImagePlus> getDoG(ij.ImagePlus originalImage, float sigma1, float sigma2)
originalImage
- input imagesigma1
- first Gaussian sigmasigma2
- second Gaussian sigmapublic void addMembraneFeatures(int patchSize, int membraneSize)
patchSize
- size of the filter to be usedmembraneSize
- expected membrane thicknesspublic Callable<ij.ImagePlus> getMembraneFeatures(ij.ImagePlus originalImage, int patchSize, int membraneSize)
originalImage
- input imagepatchSize
- orientation kernel sizemembraneSize
- expected membrane thicknesspublic Callable<ij.ImagePlus> getFilter(ij.ImagePlus originalImage, ij.process.ImageProcessor filter, String title)
originalImage
- original imagefilter
- filter kerneltitle
- filter namepublic Callable<ij.ImagePlus> getDerivatives(ij.ImagePlus originalImage, double sigma, int xOrder, int yOrder)
originalImage
- input imagesigma
- smoothing scalexOrder
- x-order of differentiationyOrder
- y-order of differentiationpublic void addDerivatives(double sigma, int xOrder, int yOrder)
sigma
- smoothing scalexOrder
- x-order of differentiationyOrder
- y-order of differentiationpublic Callable<ij.ImagePlus> getLaplacian(ij.ImagePlus originalImage, double sigma)
originalImage
- input imagesigma
- smoothing scalepublic void addLaplacian(double sigma)
sigma
- smoothing scalepublic Callable<ij.ImagePlus> getStructure(ij.ImagePlus originalImage, double sigma, double integrationScale)
originalImage
- input imagesigma
- smoothing scaleintegrationScale
- integration scale (standard deviation of the Gaussian
kernel used for smoothing the elements of the structure tensor, must be larger than zero)public void addStructure(double sigma, double integrationScale)
sigma
- smoothing scaleintegrationScale
- integration scale (standard deviation of the Gaussian
kernel used for smoothing the elements of the structure tensor, must be larger than zero)public Callable<ij.ImagePlus> getGabor(ij.ImagePlus originalImage, double sigma, double gamma, double psi, double frequency, int nAngles, ExecutorService exec)
originalImage
- input imagesigma
- size of the Gaussian envelopegamma
- spatial aspect ratio, it specifies the ellipticity of the support of the Gabor functionpsi
- phase offsetfrequency
- frequency of the sinusoidal componentnAngles
- number of filter orientationsexec
- executor service to use on FFT convolutionspublic void addGabor(ij.ImagePlus originalImage, double sigma, double gamma, double psi, double frequency, int nAngles)
originalImage
- input imagesigma
- size of the Gaussian envelopegamma
- spatial aspect ratio, it specifies the ellipticity of the support of the Gabor functionpsi
- phase offsetfrequency
- frequency of the sinusoidal componentnAngles
- number of filter orientationspublic Callable<ij.ImagePlus> getKuwaharaFeatures(ij.ImagePlus originalImage, int kernelSize, int nAngles, int criterion)
originalImage
- input imagekernelSize
- orientation kernel sizenAngles
- number of anglescriterion
- public void addKuwaharaFeatures(ij.ImagePlus originalImage, int kernelSize, int nAngles, int criterion)
originalImage
- input imagekernelSize
- orientation kernel sizenAngles
- number of anglescriterion
- public Callable<ij.ImagePlus> getAnisotropicDiffusion(ij.ImagePlus originalImage, int nb_iter, int saveSteps, int nb_smoothings, float a1, float a2, float edgeThreshold)
originalImage
- input imagenb_iter
- number of iterationssaveSteps
- number of steps after which we save the intermediate resultsnb_smoothings
- number of smoothings per iterationa1
- diffusion limiter along minimal variationsa2
- diffusion limiter along maximal variationsedgeThreshold
- edge thresholdpublic void addAnisotropicDiffusion(ij.ImagePlus originalImage, int nb_iter, int saveSteps, int nb_smoothings, float a1, float a2, float edgeThreshold)
originalImage
- input imagenb_iter
- number of iterationssaveSteps
- number of steps after which we save the intermediate resultsnb_smoothings
- number of smoothings per iterationa1
- diffusion limiter along minimal variationsa2
- diffusion limiter along maximal variationsedgeThreshold
- edge thresholdpublic Callable<ij.ImagePlus> getBilateralFilter(ij.ImagePlus originalImage, double spatialRadius, double rangeRadius)
originalImage
- input imagespatialRadius
- spatial radiusrangeRadius
- range radiuspublic void addBilateralFilter(ij.ImagePlus originalImage, double spatialRadius, double rangeRadius)
originalImage
- input imagespatialRadius
- spatial radiusrangeRadius
- range radiuspublic Callable<ij.ImagePlus> getLipschitzFilter(ij.ImagePlus originalImage, boolean downHat, boolean topHat, double slope)
originalImage
- input imagedownHat
- flag to indicate covering from top to bottomtopHat
- flat to indicate computing lower (upper) Lipschitz coverslope
- maximum allowed difference between two neighboring pixelspublic void addLipschitzFilter(ij.ImagePlus originalImage, boolean downHat, boolean topHat, double slope)
originalImage
- input imagedownHat
- flag to indicate covering from top to bottomtopHat
- flat to indicate computing lower (upper) Lipschitz coverslope
- maximum allowed difference between two neighboring pixelspublic ij.process.ImageProcessor getProcessor(int index)
index
- selected slicepublic Instances createInstances(ArrayList<String> classes)
classes
- list of classes namespublic void addDefaultFeatures()
public void updateFeatures()
public void addFeaturesMT(ij.ImagePlus filterList)
filterList
- list of filterspublic boolean updateFeaturesST()
public void addHSB()
public Callable<ij.ImagePlus> getHSB(ij.ImagePlus originalImage)
originalImage
- original input imagepublic boolean updateFeaturesMT()
public boolean updateFeaturesMT(int numThreads)
numThreads
- number of threads to usepublic void setEnabledFeatures(boolean[] enableFeatures)
enableFeatures
- list of boolean flags to enable featurespublic boolean setEnabledFeature(String featureName, boolean enable)
featureName
- feature nameenable
- flag to enable/disable featurepublic boolean[] getEnabledFeatures()
public int getMembraneSize()
public void setMembraneSize(int membraneSize)
membraneSize
- membrane thicknesspublic boolean isEmpty()
public boolean saveStackAsTiff(String filename)
filename
- destination path and file namepublic void removeFeature(String featureName)
featureName
- complete name of the feature to removepublic void setMinimumSigma(float minSigma)
minSigma
- sigma valuepublic void setMaximumSigma(float maxSigma)
maxSigma
- sigma valuepublic DenseInstance createInstance(int x, int y, int classValue)
x
- x- axis coordinatey
- y- axis coordinateclassValue
- class value to be assignedpublic DenseInstance createInstance(int x, int y)
x
- x- axis coordinatey
- y- axis coordinatepublic void createInstanceInPlace(int x, int y, int classValue, DenseInstance ins)
x
- x- axis coordinatey
- y- axis coordinateclassValue
- class value to be assignedins
- instance to be filledpublic void setInstance(int x, int y, ReusableDenseInstance ins, double[] auxArray)
x
- y
- ins
- auxArray
- public void setInstance(int x, int y, int classValue, ReusableDenseInstance ins, double[] auxArray)
x
- x- axis coordinatey
- y- axis coordinateclassValue
- class value to be assignedins
- instance to be filledauxArray
- auxiliary array to store feature valuespublic void setStack(ij.ImageStack stack)
stack
- new stack of image featurespublic ij.ImageStack getStack()
public void setOldColorFormat(boolean b)
b
- flag to set the use of old color formatpublic boolean isOldColorFormat()
public void setOldHessianFormat(boolean b)
b
- flag to set the use of old color formatpublic boolean isOldHessianFormat()
public boolean reorderFeatures(Instances data)
data
- set of instances to get the right order of attributes fromCopyright © 2015–2021 Fiji. All rights reserved.