You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: AverageValueByRegion.m
    path of file: ./repos/ImageM/ImageM/+imagem/+actions/+analyze
    
    the code of the file until where you have to start completion: classdef AverageValueByRegion < imagem.actions.CurrentImageAction
% One-line description here, please.
%
%   Class AverageValueByRegion
%
%   Example
%   AverageValueByRegion
%
%   See also
%

% ------
% Author: David Legland
% e-mail: david.legland@inrae.f
    
function run(obj, frame) %#ok<INUSL>
        
        app = frame.Gui.App;
        imageNames = getImageNames(app);
        
        % creates a new dialog, and populates it with some fields
        gd = imagem.gui.GenericDialog('Average Value by Region');
        addChoice(gd, 'Label image of regions:', imageNames, imageNames{1});
        addChoice(gd, 'Image of intensities:', imageNames, imageNames{1});
        
        % displays the dialog, and waits for user
        showDialog(gd);
        % check if ok or cancel was clicked
        if wasCanceled(gd)
            return;
        end