OrsTrainer

Plugin of segmentation using machine learning algorithms

author:ORS Team
contact:http://theobjects.com
email:info@theobjects.com
organization:Object Research Systems (ORS), Inc.
address:760 St-Paul West, suite 101, Montréal, Québec, Canada, H3C 1M4
copyright:Object Research Systems (ORS), Inc. All rights reserved.
date:Jul 31 2017 12:45
dragonflyVersion:
 3.1.0.286 (D)
UUID:68f8d3f6761d11e7b495448a5b5d70c0

Class Code

class OrsPythonPlugins.OrsTrainer.OrsTrainer.OrsTrainer(varname=None, managed=True)
OrsStateTrainerPreview = 'OrsStateTrainerPreview'
OrsStateTrainerPreviewSelect = 'OrsStateTrainerPreviewSelect'
OrsStateTrainerPreviewSelectActivation()
UIDescriptors = [<ORSServiceClass.OrsPlugin.uidescriptor.UIDescriptor object>]
addClassifier(classifier)
addDatasetFeaturesPreset(datasetFeaturesPreset)
addRegionFeaturesPreset(regionFeaturesPreset)
interfacemethod classification(classifier, classifierManager, channels, masks, classificationResults, computeConfidenceMap=False, confidenceRange=(0, 100), regionGenerator=None)

Classify a dataset with a machine learning classifier that has previously been trained (see Train interface method). It can classify a dataset on an area defined by a mask. The classification can be done per pixel or per regions, defined by the region generator. The features can be extracted from filter presets (known by the classifier) or automatically from a keras autoencoder. The classification can be done on a preview or on the complete dataset.

Parameters:
  • classifier (segmentation classifier) – segmentation classifier
  • classifierManager (undefined) – the classifier manager. Knows all the classifiers available and their location.
  • channels (ORSModel.ors.Channel) [count=[1, None]] – channel inputs of the classifier to generate features
  • masks (ORSModel.ors.ROI) [count=[0, None]] – mask regions where the classifier works
  • classificationResults (undefined) – classificationPreviewResults result struct
  • computeConfidenceMap (bool) – indicate if we wan’t the confidence map to be computed
  • confidenceRange (tuple) – confidence min and max range. If this parameter is given the output confidence map is not computed
  • regionGenerator (undefined) – if the working area is Pixel, there is no regionGenerator. if the working area is Region, the regionGenerator is an instance of a class specifying the algorithm to use to generate regions and its inputs and parameters
interfacemethod classificationOnPreview(classifier, classifierManager, channels, masks, classificationPreviewResults, regionGenerator=None)

Classify a dataset with a machine learning classifier that has previously been trained (see Train interface method). It can classify a dataset on an area defined by a mask. The classification can be done per pixel or per regions, defined by the region generator. The features can be extracted from filter presets (known by the classifier) or automatically from a keras autoencoder. The classification is done on preview (A slice channel on each view is classified).

Parameters:
  • classifier (segmentation classifier) – segmentation classifier
  • classifierManager (undefined) – the classifier manager. Knows all the classifiers available and their location.
  • channels (ORSModel.ors.Channel) [count=[1, None]] – channel inputs of the classifier to generate features
  • masks (ORSModel.ors.ROI) [count=[0, None]] – mask regions where the classifier works
  • classificationPreviewResults (undefined) – classificationPreviewResults result struct
  • regionGenerator (undefined) – if the working area is Pixel, there is no regionGenerator. if the working area is Region, the regionGenerator is an instance of a class specifying the algorithm to use to generate regions and its inputs and parameters
classifierRemoved()
closable = True
creationOfRegions(landscapeDataset, regionGenerator, onPreview=True)

Compute the Regions Preview, storing the result in the classificationResult instance :param landscapeDataset: (Channel) :param regionGenerator: RegionAlgorithmsAbstract :param onPreview: (bool) True if we extract a previewLandscapePreview from the view, False if we produce regions for the whole landscapeDataset

deletePreviewObjects()
exportPreview(bClassification=False, bRegions=False, bConfidenceMap=False)

Publish the currently displayed in views classification and regions, with the associated confidenceMap :param bClassification: (bool) :param bRegions: (bool) :param bConfidenceMap: (bool)

classmethod getAbout()
getClassificationResults()
getClassifierFeaturesPresetManager()
getClassifierManager()
getCurrentEngineClass()
getDatasetFeaturesPresetManager()
getObjectsForLUTEditor()
getRegionAlgorithmsNames()
getRegionFeaturesPresetManager()
getRegionGenerator(regionGeneratorName)
getRegionGeneratorsDict()
getSavedStatetEngineClass()
getState()
handleChanged(oldState, newState)
handleTriggered()
initializeClassifiersList()
initializeDatasetFeaturesPresetList()
initializeRegionFeaturesPresetList()
keepAlive = False
loadEngineForClassifier(classifier)
multiple = False
classmethod openGUI()
openWidget(name, dock=None, tab=None, x=-1, y=-1, w=-1, l=-1, order=-1)
orsSelectedObjectsChange()
regionSelectionChanged(view, region)
savable = False
setCurrentGlobalState(newState)
setPreviewState(bEnable)
stateDescriptors = [<ORSServiceClass.OrsPlugin.statedescriptor.StateDescriptor object>, <ORSServiceClass.OrsPlugin.statedescriptor.StateDescriptor object>]
classmethod toolsMenu()
interfacemethod training(classifier, classifierManager, channels, rois, masks, regionGenerator=None)

Train a machine learning classifier based on features extracted from channels and from classes defined by rois. After it is trained, the classifier could be used to classify any similar dataset. The training area can be defined by a mask and it can be done per pixel or per regions, defined by the region generator. The features can be extracted from filter presets (known by the classifier) or automatically from a keras autoencoder.

Parameters:
  • classifier (segmentation classifier) – segmentation classifier
  • classifierManager (undefined) – the classifier manager. Knows all the classifiers available and their location.
  • channels (ORSModel.ors.Channel) [count=[1, None]] – classifier input channel from which the features will be extracted
  • rois (ORSModel.ors.ROI) [count=[1, None]] –

    ...

  • masks (ORSModel.ors.ROI) [count=[0, None]] – mask regions where the classifier works
  • regionGenerator (undefined) – if the working area is Pixel, there is no regionGenerator. if the working area is Region, the regionGenerator is an instance of a class specifying the algorithm to use to generate regions and its inputs and parameters
Returns:

success (bool) – True if successful, False otherwise

classmethod updateStore(classifier=None)