function channels = select_channels()
    function resume(int)
        status = int;
        uiresume();
    end

    function value = num(par, field)
        value = str2num(get(self.edit.(par).(field), 'string'));
    end

    % global vars
    status = 0;
    self = struct();

    self.dialog = dialog('name', 'Channels', ...
                         'color', [0.95 0.95 0.95], ...
                         'units', 'pixels', ...
                         'CloseRequestFcn', @(varargin) resume(0));
    set(self.dialog, ...
        'DefaultUIPanelBackGroundColor', [0.95 0.95 0.95], ...
        'DefaultUIControlUnits', 'normalized');

    try
        % element sizes (pixels)
        row_height = 18;
        edit_width = 72;
        label_width = 72;

        % vertical and horizontal padding (pixels)
        pad_width = 6;
        pad_height = 6;

        % dialog height and width
        num_rows = 5;
        dialog_height = (num_rows+1) * row_height + (num_rows+2) * pad_height;
        dialog_width = 3 * pad_width + label_width + edit_width;

        % get normalized units
        rh = row_height / dialog_height;
        ew = edit_width / dialog_width;
        lw = label_width / dialog_width;

        ph = pad_height / dialog_height;
        pw = pad_width / dialog_width;

        % adjust dialog size
        rect = get(self.dialog, 'position');
        set(self.dialog, 'position', [rect(1) rect(2) dialog_width dialog_height]);

        self.check.donor ...
            = uicontrol(self.dialog, ...
                        'style', 'checkbox', ...
                        'string', 'Donor', ...
                        'horizontalalignment', 'left', ...
                        'value', 1, ...
                        'position', [pw 1-1*(rh+ph) 1-2*pw rh]);

        self.check.acceptor ...
            = uicontrol(self.dialog, ...
                        'style', 'checkbox', ...
                        'string', 'Acceptor', ...
                        'horizontalalignment', 'left', ...
                        'value', 1, ...
                        'position', [pw 1-2*(rh+ph) 1-2*pw rh]);

        self.check.fret ...
            = uicontrol(self.dialog, ...
                        'style', 'checkbox', ...
                        'string', 'FRET', ...
                        'horizontalalignment', 'left', ...
                        'value', 1, ...
                        'position', [pw 1-3*(rh+ph) 1-2*pw rh]);

        self.check.viterbi_state ...
            = uicontrol(self.dialog, ...
                        'style', 'checkbox', ...
                        'string', 'Viterbi State', ...
                        'horizontalalignment', 'left', ...
                        'value', 1, ...
                        'position', [pw 1-4*(rh+ph) 1-2*pw rh]);

        self.check.viterbi_mean ...
            = uicontrol(self.dialog, ...
                        'style', 'checkbox', ...
                        'string', 'Viterbi Mean', ...
                        'horizontalalignment', 'left', ...
                        'value', 1, ...
                        'position', [pw 1-5*(rh+ph) 1-2*pw rh]);

        self.okButton ...
            = uicontrol(self.dialog, ...
                'style', 'pushbutton', ...
                'string', 'Ok', ...
                'position', [pw ph 0.5-1.5*pw rh], ...
                'callback', @(varargin) resume(1));
                % 'callback', ...
                %     @(source, event) return_values(1), ...

        self.cancelButton ...
            = uicontrol(self.dialog, ...
                'style', 'pushbutton', ...
                'string', 'Cancel', ...
                'position', [0.5+0.5*pw ph 0.5-1.5*pw rh], ...
                'callback', @(varargin) resume(0));

        %methodPopupCallback(0);
        refresh();
        uiwait(self.dialog);
        if status
            channels.donor = get(self.check.donor, 'value');
            channels.acceptor = get(self.check.acceptor, 'value');
            channels.fret = get(self.check.fret, 'value');
            channels.viterbi_state = get(self.check.viterbi_state, 'value');
            channels.viterbi_mean = get(self.check.viterbi_mean, 'value');
        else 
            channels.donor = false;
            channels.acceptor = false;
            channels.fret = false;
            channels.viterbi_state = false;
            channels.viterbi_mean = false;
        end
        delete(self.dialog);
    catch err
        delete(self.dialog);
        rethrow(err)
    end
end