毕业论文-基于基于遗传算法的医学图像研究程序清单(终稿).doc
《毕业论文-基于基于遗传算法的医学图像研究程序清单(终稿).doc》由会员分享,可在线阅读,更多相关《毕业论文-基于基于遗传算法的医学图像研究程序清单(终稿).doc(15页珍藏版)》请在咨信网上搜索。
淮阴工学院大学生科技实践计划项目 第 15 页 共15 页 附 录 附录 一 灰度直方图双峰法分割源代码 clear, close all B=imread('2.jpg'); %读入原始jpg格式图像 figure(1); imshow(B),title('原始jpg格式图像'); I1=rgb2gray(B); %将原图像转化为灰度图象 figure(2); imshow(I1),title('灰度格式图像'); [I1,map1]=gray2ind(I1,255); %将灰度图像转化为索引图像 figure(3), imhist(I1) %画出灰度直方图,以判断域值 I1=double(I1); %将unit8数组转化为double型数组 Z=I1 %将double型数组I1转存到Z中 [m, n]=size(Z); for i=1:m for j=1:n if Z(i,j)>240 %灰度值大于域值时是白色 Z(i,j)=256; end end end figure(4) %画出分割后目标图像 image(Z),title('分割后图像');colormap(map1); 图像I图像格式转化及灰度直方图双峰法分割源代码 clear, close all B=imread('she.jpg'); %读入原始jpg格式图像she figure(1); imshow(B),title('原始jpg格式图像'); I1=rgb2gray(B); %将原图像转化为灰度图象 figure(2); imshow(I1),title('灰度格式图像'); [I1,map1]=gray2ind(I1,255); %将灰度图像转化为索引图像 figure(3), imhist(I1) %画出灰度直方图,以判断域值 I1=double(I1); %将unit8数组转化为double型数组 Z=I1 %将double型数组I1转存到Z中 [m, n]=size(Z); for i=1:m for j=1:n if Z(i,j)>240 %灰度值大于域值时是白色 Z(i,j)=256; end end end figure(4) %画出分割后目标图像 image(Z),title('分割后图像');colormap(map1); 图像II图像格式转化及灰度直方图双峰法分割源代码 clear, close all B=imread('she.jpg'); %读入原始jpg格式图像月亮 figure(1); imshow(B),title('原始jpg格式图像'); I1=rgb2gray(B); %将原图像转化为灰度图象 figure(2); imshow(I1),title('灰度格式图像'); [I1,map1]=gray2ind(I1,255); %将灰度图像转化为索引图像 figure(3), imhist(I1) %画出灰度直方图,以判断域值 I1=double(I1); %将unit8数组转化为double型数组 Z=I1 %将double型数组I1转存到Z中 [m, n]=size(Z); for i=1:m for j=1:n if Z(i,j)>240 %灰度值大于域值时是白色 Z(i,j)=256; end end end figure(4) %画出分割后目标图像 image(Z),title('分割后图像');colormap(map1); 附录 二 Crtbp 函数源代码:(由谢菲尔德大学Andrew Chipperfield编写) % CRTBP.m - Create an initial population% % This function creates a binary population of given size and structure. % % Syntax: [Chrom Lind BaseV] = crtbp(Nind, Lind, Base) % % Input Parameters: % % Nind - Either a scalar containing the number of individuals % in the new population or a row vector of length two % containing the number of individuals and their length. % % Lind - A scalar containing the length of the individual % chromosomes. % % Base - A scalar containing the base of the chromosome % elements or a row vector containing the base(s) % of the loci of the chromosomes. % % Output Parameter[来源:论文 s: % % Chrom - A matrix containing the random valued chromosomes % row wise. % % Lind - A scalar containing the length of the chromosome. % % BaseV - A row vector containing the base of the % chromosome loci. % Author: Andrew Chipperfield % Date: 19-Jan-94 function [Chrom, Lind, BaseV] = crtbp(Nind, Lind, Base) nargs = nargin ; % Check parameter consistency if nargs >= 1, [mN, nN] = size(Nind) ; end if nargs >= 2, [mL, nL] = size(Lind) ; end if nargs == 3, [mB, nB] = size(Base) ; end if nN == 2 if (nargs == 1) Lind = Nind(2) ; Nind = Nind(1) ; BaseV = crtbase(Lind) ; elseif (nargs == 2 & nL == 1) BaseV = crtbase(Nind(2),Lind) ; Lind = Nind(2) ; Nind = Nind(1) ; elseif (nargs == 2 & nL > 1) if Lind ~= length(Lind), error('Lind and Base disagree'); end BaseV = Lind ; Lind = Nind(2) ; Nind = Nind(1) ; end elseif nN == 1 if nargs == 2 if nL == 1, BaseV = crtbase(Lind) ; else, BaseV = Lind ; Lind = nL ; end elseif nargs == 3 if nB == 1, BaseV = crtbase(Lind,Base) ; elseif nB ~= Lind, error('Lind and Base disagree') ; else BaseV = Base ; end end else error('Input parameters inconsistent') ; end % Create a structure of random chromosomes in row wise order, dimensions % Nind by Lind. The base of each chromosomes loci is given by the value % of the corresponding element of the row vector base. Chrom = floor(rand(Nind,Lind).*BaseV(ones(Nind,1),:)) ; % End of file 附录 三 Bs2rv函数源代码: (由谢菲尔德大学Andrew Chipperfield编写) % BS2RV.m - Binary string to real vector % % This function decodes binary chromosomes into vectors of reals. The % chromosomes are seen as the concatenation of binary strings of given % length, and decoded into real numbers in a specified interval using % either standard binary or Gray decoding. % % Syntax: Phen = bs2rv(Chrom,FieldD) % % Input parameters: % % Chrom - Matrix containing the chromosomes of the current % population. Each line corresponds to one % individual's concatenated binary string % representation. Leftmost bits are MSb and % rightmost are LSb. % % FieldD - Matrix describing the length and how to decode % each substring in the chromosome. It has the % following structure: % % [len; (num) % lb; (num) % ub; (num) % code; (0=binary | 1=gray) % scale; (0=arithmetic | 1=logarithmic) % lbin; (0=excluded | 1=included) % ubin]; (0=excluded | 1=included) % % where % len - row vector containing the length of % each substring in Chrom. sum(len) % should equal the individual length. % lb, % ub - Lower and upper bounds for each % variable. % code - binary row vector indicating how each % substring is to be decoded. % scale - binary row vector indicating where to % use arithmetic and/or logarithmic % scaling. % lbin, % ubin - binary row vectors indicating whether % or not to include each bound in the % representation range % % Output parameter: % % Phen - Real matrix containing the population phenotypes. % % Author: Carlos Fonseca, Updated: Andrew Chipperfield % Date: 08/06/93, Date: 26-Jan-94 function Phen = bs2rv(Chrom,FieldD) % Identify the population size (Nind) % and the chromosome length (Lind) [Nind,Lind] = size(Chrom); % Identify the number of decision variables (Nvar) [seven,Nvar] = size(FieldD); if seven ~= 7 error('FieldD must have 7 rows.'); end % Get substring properties len = FieldD(1,:); lb = FieldD(2,:); ub = FieldD(3,:); code = ~(~FieldD(4,:)); scale = ~(~FieldD(5,:)); lin = ~(~FieldD(6,:)); uin = ~(~FieldD(7,:)); % Check substring properties for consistency if sum(len) ~= Lind, error('Data in FieldD must agree with chromosome length'); end if ~all(lb(scale).*ub(scale)>0) error('Log-scaled variables must not include 0 in their range'); end % Decode chromosomes Phen = zeros(Nind,Nvar); lf = cumsum(len); li = cumsum([1 len]); Prec = .5 .^ len; logsgn = sign(lb[来源:论文 (scale)); lb(scale) = log( abs(lb(scale)) ); ub(scale) = log( abs(ub(scale)) ); delta = ub - lb; Prec = .5 .^ len; num = (~lin) .* Prec; den = (lin + uin - 1) .* Prec; for i = 1:Nvar, idx = li(i):lf(i); if code(i) % Gray decoding Chrom(:,idx)=rem(cumsum(Chrom(:,idx)')',2); end Phen(:,i) = Chrom(:,idx) * [ (.5).^(1:len(i))' ]; Phen(:,i) = lb(i) + delta(i) * (Phen(:,i) + num(i)) ./ (1 - den(i)); end expand = ones(Nind,1); if any(scale) Phen(:,scale) = logsgn(expand,:) .* exp(Phen(:,scale)); end 附录 四 适应度函数target源代码: function f=target(T,M) %适应度函数,T为待处理图像,M为域值序列 [U, V]=size(T); W=, , length(M); f=zeros(W,1); for k=1:W I=0;s1=0;J=0;s2=0; %统计目标图像和背景图像的像素数及像素之和 for i=1:U for j=1:V if T(i,j)<=M(k) s1=s1+T(i,j);I=I+1; end if T(i,j)>M(k) s2=s2+T(i,j);J=J+1; end end end if I==0, p1=0; else p1=s1/I; end if J==0, p2=0; else p2=s2/J; end f(k)=I*J*(p1-p2)*(p1-p2)/(256*256); end 附录 五 选择函数Select源代码:(由谢菲尔德大学Hartmut Pohlheim编写) % SELECT.M (universal SELECTion) % % This function performs universal selection. The function handles % multiple populations and calls the low level selection function % for the actual selection process. % % Syntax: SelCh = select(SEL_F, Chrom, FitnV, GGAP, SUBPOP) % % Input parameters: % SEL_F - Name of the selection function % Chrom - Matrix containing the individuals (parents) of the current % population. Each row corresponds to one individual. % FitnV - Column vector containing the fitness values of the % individuals in the population. % GGAP - (optional) Rate of individuals to be selected % if omitted 1.0 is assumed % SUBPOP - (optional) Number of subpopulations % if omitted 1 subpopulation is assumed % % Output parameters: % SelCh - Matrix containing the selected individuals. % Author: Hartmut Pohlheim % History: 10.03.94 file created function SelCh = select(SEL_F, Chrom, FitnV, GGAP, SUBPOP); % Check parameter consistency if nargin < 3, error('Not enough input parameter'); end % Identify the population size (Nind) [NindCh,Nvar] = size(Chrom); [NindF,VarF] = size(FitnV); if NindCh ~= NindF, error('Chrom and FitnV disagree'); end if VarF ~= 1, error('FitnV must be a column vector'); end if nargin < 5, SUBPOP = 1; end if nargin > 4, if isempty(SUBPOP), SUBPOP = 1; elseif isnan(SUBPOP), SUBPOP = 1; elseif length(SUBPOP) ~= 1, error('SUBPOP must be a scalar'); end end if (NindCh/SUBPOP) ~= fix(NindCh/SUBPOP), error('Chrom and SUBPOP disagree'); end Nind = NindCh/SUBPOP; % Compute number of individuals per subpopulation if nargin < 4, GGAP = 1; end if nargin > 3, if isempty(GGAP), GGAP = 1; elseif isnan(GGAP), GGAP = 1; elseif length(GGAP) ~= 1, error('GGAP must be a scalar'); elseif (GGAP < 0), error('GGAP must be a scalar bigger than 0'); end end % Compute number of new individuals (to select) NSel=max(floor(Nind*GGAP+.5),2); % Select individuals from population SelCh = []; for irun = 1:SUBPOP, FitnVSub = FitnV((irun-1)*Nind+1:irun*Nind); ChrIx=feval(SEL_F, FitnVSub, NSel)+(irun-1)*Nind; SelCh=[SelCh; Chrom(ChrIx,:)]; end % End of function 附录 六 交叉函数recombin的源代码:(由谢菲尔德大学Hartmut Pohlheim编写) % RECOMBIN.M (RECOMBINation high-level function) % % This function performs recombination between pairs of individuals % and returns the new individuals after mating. The function handles % multiple populations and calls the low-level recombination function % for the actual recombination process. % % Syntax: NewChrom = recombin(REC_F, OldChrom, RecOpt, SUBPOP) % % Input parameters: % REC_F - String containing the name of the recombination or % crossover function % Chrom - Matrix containing the chromosomes of the old % population. Each line corresponds to one individual % RecOpt - (optional) Scalar containing the probability of % recombination/crossover occurring between pairs % of individuals. % if omitted or NaN, 1 is assumed % SUBPOP - (optional) Number of subpopulations % if omitted or NaN, 1 subpopulation is assumed % % Output parameter: % NewChrom - Matrix containing the chromosomes of the population % after recombination in the same format as OldChrom. % Author: Hartmut Pohlheim % History: 18.03.94 file created function NewChrom = recombin(REC_F, Chrom, RecOpt, SUBPOP); % Check parameter consistency if nargin < 2, error('Not enough input parameter'); end % Identify the population size (Nind) [Nind,Nvar] = size(Chrom); if nargin < 4, SUBPOP = 1; end if nargin > 3, if isempty(SUBPOP), SUBPOP = 1; elseif isnan(SUBPOP), SUBPOP = 1; elseif length(SUBPOP) ~= 1, error('SUBPOP must be a scalar'); end end if (Nind/SUBPOP) ~= fix(Nind/SUBPOP), error('Chrom and SUBPOP disagree'); end Nind = Nind/SUBPOP; % Compute number of individuals per subpopulation if nargin < 3, RecOpt = 0.7; end if nargin > 2, if isempty(RecOpt), RecOpt = 0.7; elseif isnan(RecOpt), RecOpt = 0.7; elseif length(RecOpt) ~= 1, error('RecOpt must be a scalar'); elseif (RecOpt < 0 | RecOpt > 1), error('RecOpt must be a scalar in [0, 1]'); end end % Select individuals of one subpopulation and call low level function NewChrom = []; for irun = 1:SUBPOP, ChromSub = Chrom((irun-1)*Nind+1:irun*Nind,:); NewChromSub = feval(REC_F, ChromSub, RecOpt); NewChrom=[NewChrom; NewChromSub]; end % End of function 附录 七 变异函数mut源代码 :(由谢菲尔德大学Andrew Chipperfield编写) % MUT.m % % This function takes the representation of the current population, % mutates each element with given probability and returns the resulting % population. % % Syntax: NewChrom = mut(OldChrom,Pm,BaseV) % % Input parameters: % % OldChrom - A matrix containing the chromosomes of the % current population. Each row corresponds to % an individuals string representation. % % Pm - Mutation probability (scalar). Default value % of Pm- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 毕业论文 基于 遗传 算法 医学 图像 研究 程序 清单 终稿
咨信网温馨提示:
1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前自行私信或留言给上传者【可****】。
5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
6、文档遇到问题,请及时私信或留言给本站上传会员【可****】,需本站解决可联系【 微信客服】、【 QQ客服】,若有其他问题请点击或扫码反馈【 服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【 版权申诉】”(推荐),意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:4008-655-100;投诉/维权电话:4009-655-100。
1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前自行私信或留言给上传者【可****】。
5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
6、文档遇到问题,请及时私信或留言给本站上传会员【可****】,需本站解决可联系【 微信客服】、【 QQ客服】,若有其他问题请点击或扫码反馈【 服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【 版权申诉】”(推荐),意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:4008-655-100;投诉/维权电话:4009-655-100。
关于本文