• 大小: 4KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-06-15
  • 语言: Matlab
  • 标签: MAT  registration  

资源简介

MATLAB源代码 实现图像配准校正 registration

资源截图

代码片段和文件信息

function varargout=spm_XYZreg_Ex2(varargin)
% Example of Registry enabled XYZ GUI control / function
% FORMAT...
%_______________________________________________________________________
%
% Help goes here...
%
% object must be indentifiable via a unique HandleGraphics object.
% In this code this handle is called hMe.
%
% This HandleGraphics objects ‘UserData‘ *must* be a structure.
% The structure must have a field called ‘hReg‘ which stores the handle
% of the registry when linked and is empty when not. Some utility features
% of spm_XYZreg will set/delete the handle directly...
%
% There must be a ‘SetCoords‘ function for this object with call:
%   spm_res_ui(‘SetCoords‘xyzhMehC)
% ...this can handle interna co-ordinate setting (as in this example) but
% must also call the registry.
%
% The registry update function is:
%   spm_XYZreg(‘SetCoords‘xyzhReghMe);
% ...which must be called at all points where the local co-ordinates can be
% changed. It is robust to invalid or empty hReg.
%
% It‘s *vital* to specify caller handles (hC) so that the registry doesn‘t
% end up in an infinite loop of updating!
%
% Hey if your function has multiple places where you can change the XYZ
% you could use an ‘‘internal‘‘ registry locally with the external registry
% as one of it‘s entries! (I think?)
%
%_______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging

% Andrew Holmes
% $Id: spm_XYZreg_Ex2.m 1143 2008-02-07 19:33:33Z spm $


%=======================================================================
switch lower(varargin{1}) case ‘create‘
%=======================================================================
% hMe = spm_XYZreg_Ex2(‘Create‘MDxyz)
if nargin<4 xyz=[0;0;0]; else xyz=varargin{4}; end
if nargin<3 error(‘Insufficient arguments‘) end
D = varargin{3};
M = varargin{2};

xyz = spm_XYZreg(‘RoundCoords‘xyzMD);

F = figure;

%-Create control:
% - note the UserData structure: hReg is necessary for cross-registration
%   M D & xyz are used internally...
% - note how the DeleteFcn closes the objects figu

评论

共有 条评论