OrsTrainer¶
Manages the segmentation trainer
| 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 2018. |
| 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()¶
-
classmethod
OrsTrainer_openGUI()¶
-
UIDescriptors= [<ORSServiceClass.OrsPlugin.uidescriptor.UIDescriptor object>]¶
-
addCallback()¶
-
addClassifier(classifier)¶
-
addDatasetFeaturesPreset(datasetFeaturesPreset)¶
-
addRegionFeaturesPreset(regionFeaturesPreset)¶
-
interfacemethod
classification(classifier, classifierManager, channels, masks, classificationResults, computeConfidenceMap=False, confidenceRange=(0, 100), regionGenerator=None, progress=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
- progress (ORSModel.ors.Progress) – a progress bar
Returns: succes (bool) – return succes
-
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
-
deletePlugin(aWidget=None)¶
-
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)
-
getClassificationResults()¶
-
getClassifierFeaturesPresetManager()¶
-
getClassifierManager()¶
-
getCurrentEngineClass()¶
-
getDatasetFeaturesPresetManager()¶
-
getObjectsForLUTEditor()¶
-
getRegionAlgorithmsNames()¶
-
getRegionFeaturesPresetManager()¶
-
getRegionGenerator(regionGeneratorName)¶
-
getRegionGeneratorsDict()¶
-
getSavedStatetEngineClass()¶
-
handleChanged(oldState, newState)¶ This method is called when the state of the application is changed.
Parameters: - oldState (str) – name of the old (previous) state
- newState (str) – name of the new (current) state
-
handleTriggered(eventdata)¶ This method is called on every user input (mouse move, mouse click, key press, …) when the current state of the application is one of those declared by the plugin. This method can be used to perform specific tasks even if no action is currently in progress.
Parameters: eventData (OrsEvent.eventdata.InputEventData) – the event data
-
initializeClassifiersList()¶
-
initializeDatasetFeaturesPresetList()¶
-
initializeRegionFeaturesPresetList()¶
-
keepAlive= False¶
-
loadEngineForClassifier(classifier)¶
-
loadHistogramMatchingForClassifier(classifier)¶
-
multiple= False¶
-
classmethod
openGUI(formName)¶
-
openWidget(name, dock=None, tab=None, x=-1, y=-1, w=-1, l=-1, order=-1)¶
-
orsCurrentViewChange()¶
-
orsSelectedObjectsChange()¶
-
regionSelectionChanged(view, region)¶
-
savable= False¶
-
setCurrentGlobalState(newState)¶
-
setPreviewState(bEnable)¶
-
showInToolbar= True¶
-
stateDescriptors= [<ORSServiceClass.OrsPlugin.statedescriptor.StateDescriptor object>, <ORSServiceClass.OrsPlugin.statedescriptor.StateDescriptor object>]¶
-
classmethod
toolsMenu()¶
-
interfacemethod
training(classifier, classifierManager, channels, rois, masks, regionGenerator=None, save_classifier=True)¶ 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
- save_classifier (bool) – Indicate that the model should be saved on file
Returns: success (bool) – True if successful, False otherwise
-
classmethod
updateStore(classifier=None)¶
-