资源简介
B样条弹性配准matlab实现,还是不错的。
代码片段和文件信息
function [O_error O_grad]=bspline_registration_gradient(O_gridsizesSpacingI1I2options)
% Function registration_gradient. This function will calculate a registration
% error value and gradient after b-spline non-rigid registration
% of two images / volumes.
%
% [error errorgrad]=bspline_registration_gradient(gridsizesSpacingI1I2options)
%
% inputs
% grid: b-spline control grid created by make_init_grid.m (and reshaped
% to one long vector.)
% sizes: sizes need tot reshape the grid to matrix format.
% Spacing: The spacing in xy (and z) direction of the b-spline grid
% knots
% I1 and I2: The input images of which I1 is transformed.
% options: Struct with options
% ->type: Type of image similarity(error) measure used
% (see image_difference.m) (default ‘sd‘)
% ->penaltypercentage Percentage of penalty smoothness (bending energy
% of thin sheet of metal) (default 0.01)
% ->step: Delta step used for error gradient (default 0.01)
% ->centralgrad: Calculate derivatives with central instead of forward
% gradient (default true)
% outputs
% error: The registration error value
% errorgrad: The registration error gradient
%
% example
% I1=im2double(imread(‘lenag1.png‘));
% I2=im2double(imread(‘lenag2.png‘));
% O_trans=make_init_grid([32 32]size(I1)); sizes=size(O_trans);
% O_trans = fminsd(@(x)bspline_registration_gradient(xsizes[32 32]I1I2‘sd‘) O_trans(:) ...
% optimset(‘Display‘‘iter‘‘GradObj‘‘on‘‘MaxIter‘20‘DiffMinChange‘0.1));
% Icor=bspline_transform(reshape(O_transsizes)I1Spacing);
% figure imshow(I1) figure imshow(I2) figure imshow(Icor)
%
%
% This function is written by D.Kroon University of Twente (October 2008)
% Check/set input options
defaultoptions=struct(‘type‘‘sd‘ ‘penaltypercentage‘0.01‘step‘0.01‘centralgrad‘true);
if(~exist(‘options‘‘var‘))
options=defaultoptions;
else
tags = fieldnames(defaultoptions);
for i=1:length(tags)
if(~isfield(optionstags{i})) options.(tags{i})=defaultoptions.(tags{i}); end
end
if(length(tags)~=length(fieldnames(options)))
warning(‘BsplineRegistrationGradient:unknownoption‘‘unknown options found‘);
end
end
% Type of image similarity(error) measure used
type=options.type;
% Percentage of penalty smoothness (bending energy of thin sheet of metal)
penaltypercentage=options.penaltypercentage;
% Delta step used for error gradient
step=options.step;
% Central gradient or (faster) forward gradient
centralgrad=options.centralgrad;
% Convert Grid vector to grid matrix
O_grid=reshape(O_gridsizes);
% Transform the image with the B-spline grid
I_init=bspline_transform(O_gridI1Spacing);
% Calculate the current registration error
t=image_difference(I_initI2type);
O_error=t;
if(penaltypercentage>0)
% Calculat
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2009-08-12 16:04 B样条弹性配准matlab\
文件 1116 2008-10-31 10:13 B样条弹性配准matlab\blok2.png
文件 1112 2008-10-31 10:13 B样条弹性配准matlab\blok3.png
文件 68075 2008-07-21 14:55 B样条弹性配准matlab\brain1.png
文件 67894 2008-07-21 14:55 B样条弹性配准matlab\brain2.png
文件 65878 2008-10-10 15:46 B样条弹性配准matlab\brain3.png
文件 14042 2008-10-10 16:44 B样条弹性配准matlab\bspline_registration_gradient.m
文件 1901 2008-10-13 15:38 B样条弹性配准matlab\bspline_registration_image.m
文件 1684 2008-10-01 15:03 B样条弹性配准matlab\bspline_transform.m
文件 10691 2008-10-06 15:27 B样条弹性配准matlab\bspline_transform_2d_double.c
文件 11776 2008-10-31 10:16 B样条弹性配准matlab\bspline_transform_2d_double.mexw64
文件 13153 2008-10-13 11:17 B样条弹性配准matlab\bspline_transform_3d_double.c
文件 13824 2008-10-31 10:16 B样条弹性配准matlab\bspline_transform_3d_double.mexw64
文件 13419 2008-10-13 11:25 B样条弹性配准matlab\bspline_transform_3d_single.c
文件 13312 2008-10-31 10:16 B样条弹性配准matlab\bspline_transform_3d_single.mexw64
文件 151 2008-08-01 10:45 B样条弹性配准matlab\compile_c_files.m
文件 149221 2008-10-08 20:06 B样条弹性配准matlab\correct_penalties_smoothing.mw
文件 258016 2008-10-10 10:42 B样条弹性配准matlab\correct_penalties_smoothing3.mw
文件 1788 2008-10-13 15:15 B样条弹性配准matlab\example_2d_nonrigid_1.m
文件 2154 2008-10-13 15:19 B样条弹性配准matlab\example_2d_nonrigid_2.m
文件 1616 2008-10-13 15:15 B样条弹性配准matlab\example_2d_nonrigid_3.m
文件 1026 2008-10-13 15:14 B样条弹性配准matlab\example_2d_rigid.m
文件 2055 2008-10-13 15:07 B样条弹性配准matlab\example_3d_nonrigid.m
文件 1332 2008-10-13 15:04 B样条弹性配准matlab\example_3d_rigid.m
文件 9797 2008-10-02 14:24 B样条弹性配准matlab\fminsd.m
文件 3414 2008-07-29 12:30 B样条弹性配准matlab\fspecial3.m
文件 1381 2008-10-02 14:24 B样条弹性配准matlab\get_example_data.m
文件 6246 2008-10-10 15:41 B样条弹性配准matlab\image_difference.m
文件 1239 2008-08-01 11:23 B样条弹性配准matlab\imresize3d.m
文件 34678 2008-05-26 12:21 B样条弹性配准matlab\lenag1.png
文件 36184 2008-05-22 09:51 B样条弹性配准matlab\lenag2.png
............此处省略25个文件信息
- 上一篇:bp算法 matlab实现 图像分类
- 下一篇:Lookup Table导入表格
评论
共有 条评论