RenameShuffle

class controllers.RenameShuffle

Bases: handle

RENAMESHUFFLE - Controller for randomizing and shuffling image datasets across directories.

Copies images from one or more input directories into randomized output subdirectories, assigning shuffled filenames. Optionally copies associated label, mask, annotation, and measurement files. Saves a *.mibShuffle project file that records the full mapping, enabling the reverse operation via controllers.RenameRestore.

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

RENAMESHUFFLE - Construct the rename-and-shuffle controller.

Syntax:
obj = controllers.RenameShuffle(mibModel)
Input Arguments:
Property Summary
inputDirs

cell array of input directory paths

listener

cell array of listener handles

mibModel

handle to MibModel

outputDir

output directory path

view

handle to RenameShuffleGUI (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()
addDirBtn_Callback()

ADDDIRBT_CALLBACK - Add one or more input directories to the list.

Syntax:
obj.addDirBtn_Callback()
closeWindow()

CLOSEWINDOW - Close the dialog and release listeners.

Syntax:
obj.closeWindow()
dirEdit_Callback()

DIREDIT_CALLBACK - Validate the typed output directory path.

Syntax:
obj.dirEdit_Callback()

Prompts the user to create the directory when it does not exist.

gui_Callbacks(source, event)

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

Syntax:
obj.gui_Callbacks(source, event)

Routes by source.Tag to the appropriate action method. Checkbox cases show a warning dialog when the box is checked.

Input Arguments:
randomBtn_Callback()

RANDOMBN_CALLBACK - Execute the rename-and-shuffle operation.

Syntax:
obj.randomBtn_Callback()

Collects images from all input directories, copies them with shuffled names into randomized output subdirectories, optionally copies labels/masks/annotations/measurements, optionally writes an Excel mapping file, and saves a *.mibShuffle project file.

removeDirBtn_Callback()

REMOVEDIRBN_CALLBACK - Remove the selected input directory from the list.

Syntax:
obj.removeDirBtn_Callback()
selectDirBtn_Callback()

SELECTDIRBN_CALLBACK - Browse for the output directory.

Syntax:
obj.selectDirBtn_Callback()
updateWidgets()

UPDATEWIDGETS - Refresh the input directories listbox.

Syntax:
obj.updateWidgets()