function [hima, lima, sima] = read7KSLS(filename,fPing,nPing)
%
%
%
%
fp = fopen(filename,'rb') ;
if fp == -1,
	error('Unable to open file')
end
lih = 0 ;
hih = 0 ;

hiPing = 1 ;
liPing = 1 ;
siPing = 1 ;
fPingf = 0 ;

ph.pingNumber = 0 ;
while ph.pingNumber < fPing+nPing,
	
	data = [] ;
	% Headers
	rh = read7KHead(fp) ;
	if rh.status ==0,
		error('Sorry lost sync')
	end
	ph = read7KPingHead(fp) ;
	if fPingf == 0,
		fPing = ph.pingNumber+fPing ;
		fPingf = 1 ;
	end
	if ph.nChan <= 0,
		error('No channel data in current ping')
	end
	% Channels
	for ic=1:ph.nChan,
		ch(ic) = read7KChanHead(fp) ;
		data(ic,:) = read7KChanData(fp,ch(ic)) ;
	end
	for ic=1:ph.nChan,
		if ch(ic).chanType < 2,
			eh(ic) = read7KEdgeHead(fp) ; % Edgetech sidescan record header
		elseif ch(ic).chanType == 2,
			wf = read7KSEGYWeighting(fp) ; % Edgetech SegY record header
		end
	end
	% Checksum
	fseek(fp,4,'cof') ; % check sum
	% Images update
	if ph.pingNumber >= fPing,
		if ph.nChan == 2, % SLS record
			
			if rh.subSystem == 21, 	% HF
				% If first ping, allocate the complete image to speed up the process
				if (hiPing == 1)
					hima = zeros(nPing,ch(1).numberOfSamples+ch(2).numberOfSamples) ; % Assumes a constant number of samples for the file
				end
				hima(hiPing,:) = [fliplr(data(1,:))*(2^(-eh(1).weightingFactor)), data(2,:)*(2^(-eh(2).weightingFactor))] ;
				hiPing = hiPing+1 ;
			else							% LF
				% If first ping, allocate the complete image to speed up the process
				if (liPing == 1)
					lima = zeros(nPing,ch(1).numberOfSamples+ch(2).numberOfSamples) ;
				end
				lima(liPing,:) = [fliplr(data(1,:))*(2^(-eh(1).weightingFactor)), data(2,:)*(2^(-eh(2).weightingFactor))] ;
				liPing = liPing+1 ;
			end
		elseif ph.nChan == 1, % SBP record
			if (siPing == 1)
				sima = zeros(nPing,ch(1).numberOfSamples) ; % Assumes a constant number of samples for the file
			end
			sima(siPing,:) = data(1,:)*(2^(-wf)) ;
			siPing = siPing+1 ;
		end
	end
end