Home > vbmeg > functions > job > subdirectory > vb_job_face.m

vb_job_face

PURPOSE ^

SYNOPSIS ^

function [surf_face] = vb_job_face(imagefile,face_parm)

DESCRIPTION ^

 Morfology operation for face extraction
 MRI構造画像から顔表面画像の抽出

 ---- Input file name
 imagefile : Analyze 3D image file  (*.img)
 ---- output variable
 surf_face.V = vertex point in face  (SPM-Right-[m] coordinate)
 surf_face.F = patch index for face
 surf_face.face_parm   = parameter structure extracting face

 2006/2/3  M.Sato

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    [surf_face] = vb_job_face(imagefile,face_parm)
0002 %
0003 % Morfology operation for face extraction
0004 % MRI構造画像から顔表面画像の抽出
0005 %
0006 % ---- Input file name
0007 % imagefile : Analyze 3D image file  (*.img)
0008 % ---- output variable
0009 % surf_face.V = vertex point in face  (SPM-Right-[m] coordinate)
0010 % surf_face.F = patch index for face
0011 % surf_face.face_parm   = parameter structure extracting face
0012 %
0013 % 2006/2/3  M.Sato
0014 %
0015 % Copyright (C) 2011, ATR All Rights Reserved.
0016 % License : New BSD License(see VBMEG_LICENSE.txt)
0017 
0018 
0019 if ~exist('imagefile','var')
0020     %%%% DEBUG Setting %%%%
0021     udir = [getenv('MATHOME') '/SBIdata-new/Retino-TY/'];
0022     imagefile = [udir  '3D.img'];
0023     facefile  = [udir  'TY.face.mat'];
0024 end
0025 
0026 %
0027 % ----- Usually, following setting need not be changed.
0028 %       However, if extraction result is not good enough,
0029 %       change the morphology operation by setting 'Radius'
0030 
0031 % Manual threshold value for face extraction
0032 % ヒストグラムからの自動設定ではなく手で閾値を設定する場合、
0033 % 閾値 'Graylevel' 設定 : Graylevel より大きい値を持つボクセルを頭部として抽出
0034 if ~exist('face_parm','var') | ~isfield(face_parm,'Graylevel')
0035     Graylevel = [];
0036     face_parm.Graylevel = Graylevel;
0037 else
0038     Graylevel = face_parm.Graylevel;
0039 end
0040 
0041 % ---- Define order and size of dilation/erosion ----
0042 %      Dilation/erosion are done consecutively according to Radius
0043 %      穴埋め・孤立点削除 (モルフォロジー) 変換の順序と半径を指定
0044 %
0045 % Radius [mm] of Morfology operation
0046 %   R > 0 : dilation
0047 %   R < 0 : erosion
0048 % Example of 'Radius'
0049 %   Radius = [ -2 2 ];        : remove small island in background
0050 %   Radius = [ -2 2 6 -6]; : remove small island & fill holes
0051 %       1. remove small island in background  (R = -2,  2)
0052 %       2. fill holes inside the brain        (R =  6, -6)
0053 
0054 % Default morphology setting parameter
0055 if ~isfield(face_parm,'Radius')
0056     Radius = [ -2 2 2 2 2 -2 -2 -2];
0057     face_parm.Radius = Radius;
0058 else
0059     Radius = face_parm.Radius;
0060 end
0061 
0062 % Subsampling step size [mm]
0063 % 3D 画像処理のための間引きステップサイズ
0064 if ~isfield(face_parm,'step')
0065     step = 1;
0066     face_parm.step = step;
0067 else
0068     step = face_parm.step;
0069 end
0070 
0071 % Prob. to detrmine Threshold value for face extraction
0072 %       using Rayleigh distribution
0073 %    : 背景ノイズが従うRayleigh分布に含まれると判断する閾値確率
0074 %      この値が大きいほど閾値が大きくなる
0075 % Standard value: pmax = 0.998 or 0.999
0076 if ~isfield(face_parm,'pmax')
0077     pmax = 0.998;    
0078     face_parm.pmax = pmax;
0079 else
0080     pmax = face_parm.pmax;
0081 end
0082 
0083 %
0084 % ---- Morfology operation for face extraction
0085 %      MRI構造画像から顔表面画像の抽出
0086 %
0087 [Fface, Vface] = vb_face_extract(imagefile , Radius, step, pmax, Graylevel);
0088 
0089 %
0090 % ---- Output data
0091 %
0092 
0093 surf_face.V = Vface;
0094 surf_face.F = Fface;
0095 surf_face.face_parm = face_parm;
0096 
0097 Nmri = 3000;
0098 [surf_face.F_reduce, surf_face.V_reduce] = ...
0099     vb_reducepatch(Fface, Vface, 2 * Nmri);
0100 
0101 return
0102 %
0103 % ---- END ----
0104 %
0105 vb_save(facefile,'surf_face','face_parm');
0106 
0107 % 顔表示
0108 figure;
0109 vb_plot_surf(surf_face.V ,surf_face.F, [0.8 0.7 0.6],'none',1);
0110 view([135, 15]);
0111

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005