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: nmt_image.m
    path of file: ./repos/fieldtrip/contrib/nutmegtrip
    
    the code of the file until where you have to start completion: function nmt_image(op,varargin)
% analogous to spm's spm_image -- used to update coords when clicking
% around MRI viewer

global st

% reset MRI axis positions to proper location, in case they moved (e.g.,
% due to manipulation by SPM controls)
for ii=1:3
    set(st.vols{1}.ax{ii}.ax,'Position',[st.nmt.gui.mriaxpos(:,ii)]);

    
function nmt_image(op,varargin)
% analogous to spm's spm_image -- used to update coords when clicking
% around MRI viewer

global st

% reset MRI axis positions to proper location, in case they moved (e.g.,
% due to manipulation by SPM controls)
for ii=1:3
    set(st.vols{1}.ax{ii}.ax,'Position',[st.nmt.gui.mriaxpos(:,ii)]);
end


feval(st.nmt.spm_refresh_handle);

if(~exist('op','var') || ~ischar(op))
    op = 'shopos';
end

switch(op)
    case 'shopos'
            fg  = spm_figure('Findwin','Graphics');
            
            %%
            posmrimm = spm_orthviews('pos')';
 %           set(st.nmt.gui.megp,'String',sprintf('%.1f %.1f %.1f',posmrimm));
           
            if(prod(size(st.vols{1}.blobs{1}.vol)) == length(st.nmt.pos))
                % this is the case for official Fieldtrip output based on cube/rectangular VOIs 
                blobidx = nmt_transform_coord(inv(st.vols{1}.blobs{1}.mat),posmrimm);
                blobidx = round(blobidx);
                blobdim = size(st.vols{1}.blobs{1}.vol);
                if(all(blobidx <= blobdim & blobidx > 0))
                    %                blobintensity = st.vols{1}.blobs{1}.vol(blobidx(1),blobidx(2),blobidx(3));
                    st.nmt.cfg.vox_idx  = sub2ind(size(st.vols{1}.blobs{1}.vol),blobidx(1),blobidx(2),blobidx(3));
                    blobintensity = st.nmt.fun{1}(st.nmt.cfg.vox_idx);
                else % if out of blob's bounds
                    blobintensity = NaN;
                    st.nmt.cfg.vox_idx = NaN;
                end