RenameRestore

class controllers.RenameRestore

Bases: handle

RENAMERESTORE - Controller for restoring shuffled datasets to their original order.

Reads a *.mibShuffle project file produced by controllers.RenameShuffle and reconstructs labels, masks, annotations, and/or measurements in the original input directories.

Usage:
obj.mibController.startController('controllers.RenameRestore');
Constructor Summary
RenameRestore(mibModel)

RENAMERESTORE - Construct the rename-and-restore controller.

Syntax:
obj = controllers.RenameRestore(mibModel)
Input Arguments:
Property Summary
Settings

project settings loaded from the project file

inputFilename

path to a .mibShuffle project file

listener

cell array of listener handles

mibModel

handle to MibModel

view

handle to RenameRestoreGUI (set by core.ChildView)

Method Summary
static ViewListner_Callback2(~, evnt)

VIEWLISTNER_CALLBACK2 - Static guarded listener callback.

Syntax:
obj.ViewListner_Callback2(src, evnt)

Routes UpdateGuiWidgets and NewDataset model events to updateWidgets(). Deletes stale listeners when the controller or its view has been destroyed.

Input Arguments:
addCallbacks()

ADDCALLBACKS - Wire every widget to the central gui_Callbacks dispatcher.

Syntax:
obj.addCallbacks()

Also creates context menus for the two directory listboxes.

closeWindow()

CLOSEWINDOW - Close the dialog and release listeners.

Syntax:
obj.closeWindow()
copyShowDirectory(listId, parameter)

COPYSHOWDIRECTORY - Copy the selected directory path to clipboard or open in explorer.

Syntax:
obj.copyShowDirectory(listId, parameter)
Input Arguments:
  • listId - 'randomDirsList' or 'destinationDirsList'.

  • parameter - 'clipboard' or 'fileexplorer'.

gui_Callbacks(source, event)

#ok<INUSD> GUI_CALLBACKS - Dispatcher for every RenameRestore widget callback.

Syntax:
obj.gui_Callbacks(source, event)

Routes by source.Tag to the appropriate action method. Context-menu items for the two directory listboxes are also routed here.

Input Arguments:
projectFilenameEdit_Callback()

PROJECTFILENAMEEDIT_CALLBACK - Validate the typed project filename and load it.

Syntax:
obj.projectFilenameEdit_Callback()
resaveProject()

RESAVEPROJECT - Save the Settings (with updated paths) to a new project file.

Syntax:
obj.resaveProject()
restoreBtn_Callback()

RESTOREBN_CALLBACK - Execute the restore operation.

Syntax:
obj.restoreBtn_Callback()

Reads shuffled model/mask/annotation/measurement files from the randomized directories and reconstructs them in the original (destination) directories using the mapping stored in Settings.

selectSettingsFileBtn_Callback()

SELECTSETTINGSFILEBN_CALLBACK - Browse for a .mibShuffle project file.

Syntax:
obj.selectSettingsFileBtn_Callback()
updateDir(parameter)

UPDATEDIR - Replace the selected directory path in Settings and the listbox.

Syntax:
obj.updateDir(parameter)
Input Arguments:
  • parameter - 'randomDirsList' or 'destinationDirsList'.

updateParentDir(parameter)

UPDATEPARENTDIR - Replace the parent folder for all directories in a list.

Syntax:
obj.updateParentDir(parameter)

Prompts for a new parent folder and rebuilds every path in the list by replacing the old parent while keeping each subdirectory name.

Input Arguments:
  • parameter - 'randomDirsList' or 'destinationDirsList'.

updateProjectDetails()

UPDATEPROJECTDETAILS - Populate the directory lists from Settings.

Syntax:
obj.updateProjectDetails()
updateWidgets()

UPDATEWIDGETS - Load project details if the project file exists.

Syntax:
obj.updateWidgets()