⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smp_splitccretinomap.m

📁 toolbox of BVQX, This is the access between BV and matlab. It will help you to analysis data from BV
💻 M
字号:
function hfile = smp_SplitCCRetinoMap(hfile, mapno, factor)
% SMP::SplitCCRetinoMap  - add a CC retinotopic map with split info
%
% FORMAT:       smp.SplitCCRetinoMap(mapno [,factor]);
%
% Input fields:
%
%       mapno       number of map(s) to split
%       factor      either 2 or 4 (number of visual fields, default: 4)
%
% Output fields:
%
%       hfile       object with added map(s)

% Version:  v0.7b
% Build:    7090213
% Date:     Sep-02 2007, 1:48 PM CEST
% Author:   Jochen Weber, Brain Innovation, B.V., Maastricht, NL
% URL/Info: http://wiki.brainvoyager.com/BVQXtools

% argument check
if nargin < 2 || ...
    numel(hfile) ~= 1 || ...
   ~isBVQXfile(hfile, 'smp') || ...
   ~isa(mapno, 'double') || ...
    isempty(mapno) || ...
    numel(mapno) ~= length(mapno) || ...
    any(isinf(mapno) | isnan(mapno) | mapno < 1 | mapno ~= fix(mapno))
    error( ...
        'BVQXfile:BadArgument', ...
        'Invalid call to %s.', ...
        mfilename ...
    );
end
bc = bvqxfile_getcont(hfile.L);
if any(mapno > numel(bc.Map))
    error( ...
        'BVQXfile:BadArgument', ...
        'Selected map number(s) out of bounds.' ...
    );
end
mapno = unique(mapno(:)');
if nargin < 3 || ...
   ~isa(factor, 'double') || ...
    numel(factor) ~= 1 || ...
   ~any(factor == [2, 4])
    factor = 4;
end

% iterate over maps to add
added = false;
for mc = mapno
    
    % get and check map type
    map = bc.Map(mc);
    if map.Type ~= 3
        warning( ...
            'BVQXfile:InvalidOption', ...
            'CC-splitting only valid for CC maps.' ...
        );
        continue;
    end
    
    % get data and split lag/r values
    mdat = map.SMPData;
    mlag = fix(mdat) / 1000;
    if any(mlag ~= fix(mlag))
        error( ...
            'BVQXfile:InvalidFile', ...
            'Bad lag values in map.' ...
        );
    end
    mr = mdat - 1000 * mlag;
    if any(mr < 0 | mr > 1)
        error( ...
            'BVQXfile:InvalidFile', ...
            'Bad correlation value in map.' ...
        );
    end
    
    % threshold r
    delr = (mr < map.LowerThreshold);
    mr = mr / factor;
    
    % get max number of lags
    maxl = map.NrOfLags - 1;
    
    % split into two halves anyway
    spi = find(mlag >= (maxl / 2));
    mr(spi) = mr(spi) + 0.5;
    mlag(spi) = maxl - mlag(spi);
    maxl = max(mlag);
    
    % only split again for factor 4
    if factor == 4
        spi = find(mlag >= (maxl / 2));
        mr(spi) = mr(spi) + 0.25;
        mlag(spi) = maxl - mlag(spi);
    end
    mr(delr) = 0;
    
    % build new map
    map.SMPData = mr + 1000 * mlag;
    map.MaxLag = max(mlag);
    map.NrOfLags = map.MaxLag + 1;
    map.CCOverlay = 0;
    map.LowerThreshold = map.LowerThreshold / factor;
    map.UpperThreshold = (factor + map.UpperThreshold - 1) / factor;
    map.Name = sprintf('Split (%d): %s', factor, map.Name);
    bc.Map(end + 1) = map;
    added = true;
end

% added maps?
if added
    bc.NrOfMaps = numel(bc.Map);
end

% set back
bvqxfile_setcont(hfile.L, bc);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -