function [HInfo] = icatb_checkHInfo(HInfo, fileName, extn)

%%%%%%%% Check HInfo %%%%%%%%%%%%%%
V = HInfo.V(1);
if strcmpi(extn, '.nii')
    if strcmpi(class(V(1).private), 'struct')
        clear V;
        % create nifti structure
        V = icatb_get_vol_nifti(deblank(fileName));
        HInfo = rmfield(HInfo, 'V');
        HInfo.V(1) = V(1);
        clear V;
    end
    
else
    
    if strcmpi(class(V(1).private), 'read_nifti')
        clear V;
        % create analyze structure
        V = icatb_getVol(deblank(fileName), 1);
        HInfo = rmfield(HInfo, 'V');
        HInfo.V(1) = V(1);
        clear V;
    end
    
end
%%%%%%%%% End for checking HInfo %%%%%%%%%
