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: segmentview.m
    path of file: ./repos/segment-open/source
    
    the code of the file until where you have to start completion: function [varargout] = segmentview(varargin)
%GUI to select and store views

%TODO
%- rename
%- doub
    
function view_Callback %#ok<DEFNU>
%---------------------
global DATA

gui = DATA.GUI.SegmentView;

%Extract selected
v = get(gui.handles.viewlistbox,'value');

%Call load
loadviewfrompreset(gui.viewsarray(v));

%-----------------------------
function viewcontrast_Callback
%-----------------------------
global DATA

gui = DATA.GUI.SegmentView;

%Extract selected
v = get(gui.handles.windowlistbox,'value');

%Call load
loadcontrastfrompreset(gui.windowsarray(v));

%----------------------------------
function loadcontrastfrompreset(cv)
%----------------------------------
global SET NO DATA
if isfield(cv.conbri,'Contrast')
  SET(NO).IntensityMapping.Contrast = cv.conbri.Contrast;
  SET(NO).IntensityMapping.Brightness = cv.conbri.Brightness;
else
  [contrast, brightness] = calcfunctions('win2con',...
    cv.conbri.window,cv.conbri.level);
  SET(NO).IntensityMapping.Contrast = contrast;
  SET(NO).IntensityMapping.Brightness = brightness;
end