MembranePixClassifier

class controllers.MembranePixClassifier

Bases: handle

MEMBRANEPIXCLASSIFIER - Random forest membrane/pixel classifier controller.

Uses Random Forest for Membrane Detection by Verena Kaynig. See http://www.kaynig.de/demos.html

Available from: Ribbon -> Tools -> Membrane detector

Syntax:
obj = controllers.MembranePixClassifier(mibModel)
obj = controllers.MembranePixClassifier(mibModel, extraController)
obj = controllers.MembranePixClassifier(mibModel, [], BatchOpt)
Input Arguments:
  • mibModel - handle to the MibModel instance

  • extraController - (optional) handle to a parent controller

  • BatchOpt - (optional) struct with batch options, or NaN to return defaults

Constructor Summary
MembranePixClassifier(mibModel, varargin)
Property Summary
BatchOpt

cell array of listener handles

classFilename

batch processing options structure

dirOut

full path to the .forest classifier file

forest

maximum number of training samples per class

listener

handle to the view (core.ChildView); empty in headless batch mode

maxNumberOfSamplesPerClass

directory for temporary .fm feature files

mibModel
view

handle to MibModel

Method Summary
static ViewListner_Callback2(~, evnt)
addCallbacks()

ADDCALLBACKS - Wire all widget callbacks for MembranePixClassifier.

classifierFilenameBtn_Callback()

CLASSIFIERFILENAMEBTN_CALLBACK - Open file browser to select a .forest classifier file.

classifierFilenameEdit_Callback()

CLASSIFIERFILENAMEEDIT_CALLBACK - Store the classifier filename from the edit field.

closeWindow()

CLOSEWINDOW - Close the dialog and clean up listeners.

helpBtn_Callback()

HELPBTN_CALLBACK - show documentation

keyPressCallback(evnt)

KEYPRESSCALLBACK - Forward key press events to the main MIB key handler.

modeToggle_Callback(hObject)

MODETOGGLE_CALLBACK - Switch between Train and Predict modes.

Enables/disables training-specific controls and updates the main action button label to match the current mode.

predictDataset(sliceNumber)

PREDICTDATASET - Predict membrane probability using the trained classifier.

Loads a .forest classifier from disk, extracts membrane features for each requested slice, and writes the thresholded result to the Selection layer.

Syntax:
obj.predictDataset()           % predict entire stack
obj.predictDataset(sliceNo)    % predict one slice
Input Arguments:
  • sliceNumber - (optional) slice index to predict; omit to predict all slices

predictSlice_Callback()

PREDICTSLICE_CALLBACK - Run prediction on the currently displayed slice.

returnBatchOpt(BatchOptOut)

RETURNBATCHOPT - Fire SyncBatch event with current (or supplied) BatchOpt.

saveClassifierBtn_Callback()

SAVECLASSIFIERBTN_CALLBACK - Save the trained classifier to a .mat file.

tempDirEdit_Callback()

TEMPDIR_EDIT_CALLBACK - Validate and store the temporary directory path.

tempDirSelectBtn_Callback()

TEMPDIRSELECT_BTN_CALLBACK - Open directory browser to choose the temp directory.

trainClassifier()

TRAINCLASSIFIER - Extract membrane features and train the random forest classifier.

Based on skript_trainClassifier_for_membraneDetection.m by Verena Kaynig. Trains on all slices that contain both object and background labels, then predicts those same slices and stores the result in the Selection layer.

trainClassifierBtn_Callback()

TRAINCLASSIFIERBTN_CALLBACK - Dispatch to train or predict based on the current mode.

updateBatchOptFromGUI(hObject)

UPDATEBATCHOPTFROMGUI - Sync BatchOpt from a changed widget value.

updateLoglist(addText)

UPDATELOGLIST - Append a timestamped message to the log list.

In headless batch mode (no view) prints to the MATLAB console instead.

updateWidgets()

UPDATEWIDGETS - Refresh all GUI widgets from model state.

wipeTempDirBtn_Callback()

WIPETEMPDIRBTN_CALLBACK - Delete the temporary feature directory after user confirmation.