Home > vbmeg > functions > common > morphology > vb_intersect_face_csf.m

vb_intersect_face_csf

PURPOSE ^

Make mask image for intersection of face and dilated CSF surfaces

SYNOPSIS ^

function [B ,B1, B2] = vb_intersect_face_csf(Vhead,Fhead,V,F,R,step,Vdim,Vsize,DW)

DESCRIPTION ^

 Make mask image for intersection of face and dilated CSF surfaces
  [B ,B1, B2] = vb_intersect_face_csf(Vhead,Fhead,V,F,R,step,Vdim,Vsize,DW)
 Vhead : CSF surface vertex (SPM-right-m)
 Fhead : patch index
 V     : face vertex (SPM-right-m)
 F     : patch index
 R     : dilation radius [mm]
 step  : voxel size of mask image [mm]
 Vdim  : image dimension
 Vsize : image voxel size [mm]
 DW    : margin of mask image
 B(NX,NY,NZ)  : mask image for Scalp : intersection of B1 & B2
 B1(NX,NY,NZ) : mask image for CSF surface made by Vhead
 B2(NX,NY,NZ) : mask image for face surface made by V

 2008-10-7 Masa-aki 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    [B ,B1, B2] = vb_intersect_face_csf(Vhead,Fhead,V,F,R,step,Vdim,Vsize,DW)
0002 % Make mask image for intersection of face and dilated CSF surfaces
0003 %  [B ,B1, B2] = vb_intersect_face_csf(Vhead,Fhead,V,F,R,step,Vdim,Vsize,DW)
0004 % Vhead : CSF surface vertex (SPM-right-m)
0005 % Fhead : patch index
0006 % V     : face vertex (SPM-right-m)
0007 % F     : patch index
0008 % R     : dilation radius [mm]
0009 % step  : voxel size of mask image [mm]
0010 % Vdim  : image dimension
0011 % Vsize : image voxel size [mm]
0012 % DW    : margin of mask image
0013 % B(NX,NY,NZ)  : mask image for Scalp : intersection of B1 & B2
0014 % B1(NX,NY,NZ) : mask image for CSF surface made by Vhead
0015 % B2(NX,NY,NZ) : mask image for face surface made by V
0016 %
0017 % 2008-10-7 Masa-aki Sato
0018 %
0019 % Copyright (C) 2011, ATR All Rights Reserved.
0020 % License : New BSD License(see VBMEG_LICENSE.txt)
0021 
0022 if nargin < 9, DW = 0; end;
0023 
0024 Vhead = vb_spm_right_to_analyze_right_mm(Vhead, Vdim, Vsize);
0025 V     = vb_spm_right_to_analyze_right_mm(V, Vdim, Vsize);
0026 
0027 Vhead = Vhead + step*DW;
0028 V     = V + step*DW;
0029 
0030 Dim   = vb_mask_image_size(Vdim,Vsize,step) + 2*DW;
0031 
0032 % Make mask image from CSF head surface
0033 B1 = vb_surf_to_filled_mask(Vhead, Fhead, Dim, step);
0034 
0035 if vb_matlab_version > 6,
0036     B1 = int8(B1);
0037 end
0038 
0039 % Make mask image from face surface
0040 B2 = vb_face_to_mask(V, F, Dim, step);
0041 
0042 if vb_matlab_version > 6,
0043     B2 = int8(B2);
0044 end
0045 %
0046 % --- Dilate CSF surface
0047 %
0048 B = vb_morphology_operation(B1, R, step);
0049 
0050 % Make intersection image
0051 if vb_matlab_version > 6,
0052     B  = B + B2;
0053     ix = find( B(:) > 1 );
0054     B  = zeros(Dim,'int8');
0055     B(ix) = 1;
0056 else
0057     B  = double(B) + double(B2);
0058     ix = find( B(:) > 1 );
0059     B  = zeros(Dim);
0060     B(ix) = 1;
0061 end
0062

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