Hi John I can run the FieldMap now. But there are some problems still. The parameters which I used are as follow: I used MATLAB2006 FieldMap2.0 and SPM5. I used the fieldmap to correct the distortion of EPI scan. The data which I used is the FieldMapExampleData of FieldMap. I did follow manual. I used the nepi_stretch in FieldMaExampleData as the data. I revised the parameters in the file PM_default.m as follow: % SPM5 UPDATE 16/12/06 % UPDATE 27/01/05 % Sets the default values for the FieldMap toolbox % % FORMAT pm_defaults %_______________________________________________________________________ % % This file is intended for site and/or scanner and/or % sequence-specific customisations. %_______________________________________________________________________ % pm_defaults Chloe Hutton, Jesper Andersson 17/12/06 global pm_def % Defaults for creating field map. (See pm_make_fieldmap.m and % FieldMap.man for more info.) %======================================================================= pm_def.INPUT_DATA_FORMAT = 'PM'; % 'RI' = load two real and % imaginary image pairs % 'PM' = load one or two % phase and magnitude image % pairs. pm_def.SHORT_ECHO_TIME = 10.0; % Short echo time in ms for Allegra pm_def.LONG_ECHO_TIME = 14.76;%12.46; % Long echo time in ms for Allegra pm_def.MASKBRAIN = 0; % Do brain masking (1 or 0, % 0 for EPI fieldmaps) % Defaults for unwrapping options. (See pm_make_fieldmap.m and % FieldMap.man for more info.) %======================================================================= pm_def.UNWRAPPING_METHOD = 'Mark3D'; % Unwrapping options are: % 'Huttonish', 'Mark3D' or 'Mark2D' pm_def.FWHM = 10; % FWHM of Gaussian filter used to % implement weighted smoothing of % unwrapped maps. pm_def.PAD = 0; % Size of padding kernel if required. pm_def.WS = 1; % Weighted or normal smoothing. % Flags for brain extraction %======================================================================= % Default T1 template for segmentation pm_def.MFLAGS.TEMPLATE = fullfile(spm('Dir'),'templates','T1.nii'); pm_def.MFLAGS.FWHM = 5; % In mm - used for smoothing to fill holes in brain mask pm_def.MFLAGS.NERODE = 1;% In voxels - used for erosion to remove scalp from brain mask pm_def.MFLAGS.NDILATE = 2; % In voxels - used for dilaton to condition scalp removal pm_def.MFLAGS.THRESH = 0.5; % Intensity thresholding for filling holes pm_def.MFLAGS.REG = 0.02; % A larger value helps segmentation to converge pm_def.MFLAGS.GRAPHICS = 0; % Don't display segmentation results % Defaults for converting field map to voxel displacement map. %======================================================================= pm_def.EPI_BASED_FIELDMAPS = 0; % EPI=1, other=0. pm_def.K_SPACE_TRAVERSAL_BLIP_DIR = 1;%-1; % +ve k-space = 1, -ve = -1. pm_def.TOTAL_EPI_READOUT_TIME = 32;%21.1; % Allegra EPI RO time (330E-6*64) % Defaults for Unwarping. %======================================================================= pm_def.DO_JACOBIAN_MODULATION = 0; % Do jacobian modulation to adjust % for compression or stretching % No = 0, Yes = 1 return; But the results field map sheared after I did "MatchVDM to EPI", or I load structural (if I did not do "MatchVDM to EPI". How can I solve this problem? Thank you. Sincerely Wang Qiang