function ListStruct=dir_IMG(Inpath,Postfix)
%-----------------------------------------------------------
%   Copyright(c) 2015
%	Center for Cognition and Brain Disorders, Hangzhou Normal University, Hangzhou 310015, China
%	Written by JIA Xi-Ze 201410
%	http://www.restfmri.net/
% 	Mail to Authors: jxz.rest@gmail.com, jiaxize@foxmail.com



if nargin<=1
    ListStruct.nii=dir_4RegExp(Inpath,'*.nii');
    ListStruct.niigz=dir_4RegExp(Inpath,'*.nii.gz');
    ListStruct.img=dir_4RegExp(Inpath,'*.img');
    ListStruct.hdr=dir_4RegExp(Inpath,'*.hdr');
else
    ListStruct.nii=dir_4RegExp(Inpath,['*' Postfix '*.nii']);
    ListStruct.niigz=dir_4RegExp(Inpath,['*' Postfix '*.nii.gz']);
    ListStruct.img=dir_4RegExp(Inpath,['*' Postfix '*.img']);
    ListStruct.hdr=dir_4RegExp(Inpath,['*' Postfix '*.hdr']);
end

if isempty(ListStruct.nii)&&isempty(ListStruct.niigz)&& ...
   isempty(ListStruct.img)&&isempty(ListStruct.hdr)

   ListStruct='';
end