public class Weka_Segmentation extends Object implements ij.plugin.PlugIn
Modifier and Type | Field and Description |
---|---|
static String |
ADD_TRACE
name of the macro method to add the current trace to a class
|
static String |
APPLY_CLASSIFIER
name of the macro method to apply the current classifier to an image or stack
|
static String |
CHANGE_CLASS_NAME
name of the macro method to change a class name
|
static String |
CREATE_CLASS
name of the macro method to create a new class
|
static String |
DELETE_TRACE
name of the macro method to delete the current trace
|
static String |
GET_PROBABILITY
name of the macro method to get the probability maps
|
static String |
GET_RESULT
name of the macro method to get the binary result
|
static String |
LAUNCH_WEKA
name of the macro method to launch the Weka Chooser
|
static String |
LOAD_CLASSIFIER
name of the macro method to load a classifier from file
|
static String |
LOAD_DATA
name of the macro method to load data from an ARFF file
|
static String |
PLOT_RESULT
name of the macro method to plot the threshold curves
|
static String |
PLUGIN_NAME
plugin's name
|
static String |
PLUGIN_VERSION
plugin's current version
|
static String |
SAVE_CLASSIFIER
name of the macro method to save the current classifier into a file
|
static String |
SAVE_DATA
name of the macro method to save the current data into an ARFF file
|
static String |
SAVE_FEATURE_STACK
name of the macro method to save the feature stack into a file or files
|
static String |
SET_BALANCE
name of the macro method to enable/disable the class balance
|
static String |
SET_CLASSIFIER
name of the macro method to set a new classifier
|
static String |
SET_FEATURE
name of the macro method to enable/disable a feature
|
static String |
SET_HOMOGENIZATION
Deprecated.
use SET_BALANCE instead
|
static String |
SET_MAXIMUM_SIGMA
name of the macro method to set the maximum kernel radius
|
static String |
SET_MEMBRANE_PATCH
name of the macro method to set the membrane patch size
|
static String |
SET_MEMBRANE_THICKNESS
name of the macro method to set the membrane thickness
|
static String |
SET_MINIMUM_SIGMA
name of the macro method to set the minimum kernel radius
|
static String |
SET_OPACITY
name of the macro method to set the overlay opacity
|
static String |
TOGGLE_OVERLAY
name of the macro method to toggle the overlay image
|
static String |
TRAIN_CLASSIFIER
name of the macro method to train the current classifier
|
Constructor and Description |
---|
Weka_Segmentation()
Basic constructor for graphical user interface use
|
Modifier and Type | Method and Description |
---|---|
static void |
addTrace(String classNum,
String nSlice)
Add the current ROI to a specific class and slice.
|
static void |
applyClassifier(String dir,
String fileName,
String showResultsFlag,
String storeResultsFlag,
String probabilityMapsFlag,
String storeDir)
Apply current classifier to specific image (2D or stack)
|
void |
applyClassifierToTestData()
Apply classifier to test data.
|
static void |
changeClassName(String classIndex,
String className)
Change a class name
|
static void |
createNewClass(String inputName)
Create a new class
|
static void |
deleteTrace(String classNum,
String nSlice,
String index)
Delete a specific ROI from the list of a specific class and slice
|
static void |
disableMissingFeatures(GenericDialog gd)
Disables features which rely on missing third party libraries.
|
static void |
displayGraphs(Instances data,
AbstractClassifier classifier)
Display the threshold curve window (for precision/recall, ROC, etc.).
|
static ij.ImagePlus |
getLabelImage()
Create label image out of the current user traces.
|
static void |
getProbability()
Display the current probability maps
|
static void |
getResult()
Get the current result (labeled image)
|
static void |
launchWeka()
Call the Weka chooser
|
void |
loadClassifier()
Load a Weka classifier from a file
|
static void |
loadClassifier(String newClassifierPathName)
Load a new classifier
|
static void |
loadData(String arffFilePathName)
Load training data from file
|
void |
loadTrainingData()
Load previously saved data
|
static void |
plotResultGraphs()
Plot the current result (threshold curves)
|
static AbstractClassifier |
readClassifier(String filename)
Load a Weka model (classifier) from a file
|
static void |
record(String command,
String... args)
Macro-record a specific command.
|
void |
run(String arg)
Plugin run method
|
void |
saveClassifier()
Save current classifier into a file
|
static boolean |
saveClassifier(AbstractClassifier classifier,
Instances trainHeader,
String filename)
Write classifier into a file
|
static void |
saveClassifier(String classifierPathName)
Save current classifier into a file
|
static void |
saveData(String arffFilePathName)
Save training data into an ARFF file
|
static void |
saveFeatureStack(String dir,
String fileWithExt)
Save current feature stack(s)
|
void |
saveTrainingData()
Save training model into a file
|
static void |
setClassBalance(String flagStr)
Set the class balance flag for training
|
static void |
setClassHomogenization(String flagStr)
Set the class homogenization flag for training
|
static void |
setClassifier(String classifierName,
String options)
Set classifier for current segmentation
|
static void |
setFeature(String feature)
Enable/disable a single feature of the feature stack(s)
|
static void |
setMaximumSigma(String newMaxSigmaStr)
Set a new maximum radius for the feature filters
|
static void |
setMembranePatchSize(String newPatchSizeStr)
Set a new membrane patch size for current feature stack
|
static void |
setMembraneThickness(String newThicknessStr)
Set membrane thickness for current feature stack
|
static void |
setMinimumSigma(String newMinSigmaStr)
Set a new minimum radius for the feature filters
|
static void |
setOpacity(String newOpacity)
Set overlay opacity
|
boolean |
showSettingsDialog()
Show advanced settings dialog
|
static void |
toggleOverlay()
Toggle current result overlay image
|
static void |
trainClassifier()
Train the current classifier
|
void |
updateClassifiedImage(ij.ImagePlus classifiedImage)
Update the result image
|
void |
updateResultOverlay()
Update the result image overlay with the corresponding slice
|
static boolean |
writeClassifier(AbstractClassifier cls,
String filename)
Write classifier into a file
|
public static final String PLUGIN_NAME
public static final String PLUGIN_VERSION
public static final String ADD_TRACE
public static final String DELETE_TRACE
public static final String TRAIN_CLASSIFIER
public static final String TOGGLE_OVERLAY
public static final String GET_RESULT
public static final String GET_PROBABILITY
public static final String PLOT_RESULT
public static final String APPLY_CLASSIFIER
public static final String LOAD_CLASSIFIER
public static final String SAVE_CLASSIFIER
public static final String LOAD_DATA
public static final String SAVE_DATA
public static final String CREATE_CLASS
public static final String LAUNCH_WEKA
public static final String SET_FEATURE
public static final String SET_MEMBRANE_THICKNESS
public static final String SET_MEMBRANE_PATCH
public static final String SET_MINIMUM_SIGMA
public static final String SET_MAXIMUM_SIGMA
public static final String SET_HOMOGENIZATION
public static final String SET_BALANCE
public static final String SET_CLASSIFIER
public static final String SAVE_FEATURE_STACK
public static final String CHANGE_CLASS_NAME
public static final String SET_OPACITY
public Weka_Segmentation()
public void run(String arg)
run
in interface ij.plugin.PlugIn
public void updateClassifiedImage(ij.ImagePlus classifiedImage)
classifiedImage
- new result imagepublic void updateResultOverlay()
public static void displayGraphs(Instances data, AbstractClassifier classifier)
data
- input instancesclassifier
- classifier to evaluatepublic void applyClassifierToTestData()
public void loadClassifier()
public static AbstractClassifier readClassifier(String filename)
filename
- complete path and file namepublic void saveClassifier()
public static boolean saveClassifier(AbstractClassifier classifier, Instances trainHeader, String filename)
classifier
- classifiertrainHeader
- train header containing attribute and class informationfilename
- name (with complete path) of the destination filepublic static boolean writeClassifier(AbstractClassifier cls, String filename)
cls
- classifierfilename
- name (with complete path) of the destination filepublic void loadTrainingData()
public void saveTrainingData()
public static void launchWeka()
public boolean showSettingsDialog()
public static void record(String command, String... args)
command
- name of the command including package infoargs
- set of arguments for the commandpublic static void addTrace(String classNum, String nSlice)
classNum
- string representing the class indexnSlice
- string representing the slice numberpublic static void deleteTrace(String classNum, String nSlice, String index)
classNum
- string representing the class indexnSlice
- string representing the slice numberindex
- string representing the index of the trace to removepublic static void trainClassifier()
public static void getResult()
public static void getProbability()
public static void plotResultGraphs()
public static void applyClassifier(String dir, String fileName, String showResultsFlag, String storeResultsFlag, String probabilityMapsFlag, String storeDir)
dir
- input image directory pathfileName
- input image nameshowResultsFlag
- string containing the boolean flag to display resultsstoreResultsFlag
- string containing the boolean flag to store result in a directoryprobabilityMapsFlag
- string containing the boolean flag to calculate probabilities instead of a binary resultstoreDir
- directory to store the resultspublic static void toggleOverlay()
public static void loadClassifier(String newClassifierPathName)
newClassifierPathName
- classifier file name with complete pathpublic static void saveClassifier(String classifierPathName)
classifierPathName
- complete path name for the classifier filepublic static void loadData(String arffFilePathName)
arffFilePathName
- complete path name of the ARFF filepublic static void saveData(String arffFilePathName)
arffFilePathName
- complete path name of the ARFF filepublic static void createNewClass(String inputName)
inputName
- new class namepublic static void setMembraneThickness(String newThicknessStr)
newThicknessStr
- new membrane thickness (in pixel units)public static void setMembranePatchSize(String newPatchSizeStr)
newPatchSizeStr
- new patch size (in pixel units)public static void setMinimumSigma(String newMinSigmaStr)
newMinSigmaStr
- new minimum radius (in float pixel units)public static void setMaximumSigma(String newMaxSigmaStr)
newMaxSigmaStr
- new maximum radius (in float pixel units)public static void setClassHomogenization(String flagStr)
flagStr
- true/false if you want to balance the number of samples per class before trainingpublic static void setClassBalance(String flagStr)
flagStr
- true/false if you want to balance the number of samples per class before trainingpublic static void setClassifier(String classifierName, String options)
classifierName
- classifier name with complete package informationoptions
- classifier optionspublic static void saveFeatureStack(String dir, String fileWithExt)
dir
- directory to save the stack(s)fileWithExt
- file name with extension for the file(s)public static void changeClassName(String classIndex, String className)
classIndex
- index of the class to changeclassName
- new class namepublic static void setFeature(String feature)
feature
- name of the feature + "=" true/false to enable/disablepublic static void setOpacity(String newOpacity)
newOpacity
- string containing the new opacity value (integer 0-100)public static void disableMissingFeatures(GenericDialog gd)
gd
- settings dialogpublic static ij.ImagePlus getLabelImage()
Copyright © 2015–2021 Fiji. All rights reserved.