def __init__(self, filename, dataType, centerFreqSimulation = 5.0, sigmaSimulation = 1.0, fsSimulation = 40.0):
        '''Input:
           filename:  The name of the file or directory the data is from
           dataType:  A lowercase string indicating the type of the data, choices are:
                        ei, elasticity imaging on the Seimens S2000
                        rfd, research mode on the Seimens S2000
                        rf, research mode with clinical software on Ultrasonix SonixTouch
                        sim, file format for simulated data with linear array transducers, one frame only
                        multiSim, file format for simulated data with linear array transducers, multiple frames
                         '''
        

        if not( dataType == 'ei' or dataType == 'rfd' or dataType == 'rf' or dataType =='sim' or dataType == 'multiSim'
        or dataType == 'multiFocus', 'wobbler2D'):
            print 'Error.  Datatype must be ei,rfd,rf, sim, multiSim, or multiFocus '
            return

        self.fname = filename
        self.dataType = dataType

        self.soundSpeed = 1540. #m/s
        self.data = None

        if dataType == 'ei':
            import os
            startdir = os.getcwd()
            os.chdir(self.fname)
            
            self.imageType == 'la'
            metaData = open('metaData.txt', 'r')
            metaList = [0,0,0,0]
            for i in range(4):
                metaList[i] = int(metaData.readline() )

            metaData.close()
            nFrames = len( [name for name in os.listdir('.') if os.path.isfile(name)])
            nFrames -= 1 #because of metaData.txt
            points = len( range( metaList[3]/2, metaList[2] + metaList[3]/2 ) )
            aLines = metaList[1]

            self.nFrames = nFrames
            self.soundSpeed = 1540.  #m/s
            self.fs = 40.*10**6  #Hz
            self.deltaX = 40./aLines  #assume a 40 mm FOV
            self.deltaY = self.soundSpeed/(2*self.fs)*10**3
            self.fovX = self.deltaX*(aLines-1)
            self.fovY = self.deltaY*(points -1 )
            os.chdir(startdir)

            self.points = points
            self.lines = aLines

        if dataType == 'rfd':
            import readrfd
            hInfo = readrfd.headerInfo(filename)
            self.fs = hInfo[1]
            if hInfo[4] == 'phased sector':
                self.imageType = 'ps'
                self.deltaX = hInfo[5]
                self.aLineSpacing = hInfo[6]
            else:
                self.imageType = 'la'
                self.deltaX = (1./hInfo[2])*10.
            #read a frame to find out number of points and A lines
            tempFrame = readrfd.readrfd(filename, 1)
            self.nFrames = readrfd.rfdframes(filename)
            self.deltaY = self.soundSpeed/(2*self.fs)*10**3
            self.fovX = self.deltaX*(tempFrame.shape[1] - 1)
            self.fovY = self.deltaY*(tempFrame.shape[0] -1 )
            self.points = tempFrame.shape[0]
            self.lines = tempFrame.shape[1]


        if dataType == 'rf':
            #The header is 19 32-bit integers
            self.imageType = 'la'
            dataFile = open(self.fname, 'r')
            header = np.fromfile(dataFile, np.int32, 19)
            self.header = header
            self.fs = header[15]
            self.deltaY = self.soundSpeed/(2*self.fs)*10**3
            self.points = header[3]
            self.lines = header[2]
            self.deltaX = 40./self.lines #parameter in header is broken, so assume a 40 mm FOV
            self.fovX = self.lines*self.deltaX
            self.fovY = self.points*self.deltaY
            self.nFrames = header[1]
        
        if dataType == 'wobbler2D':
            #The header is 19 32-bit integers

            self.imageType = 'wobbler'
            dataFile = open(self.fname, 'r')
            header = np.fromfile(dataFile, np.int32, 19)
            self.header = header
            self.fs = header[15]
            self.deltaY = self.soundSpeed/(2*self.fs)*10**3
            self.points = header[3]
            self.lines = header[2]
            self.deltaX = 40./self.lines #parameter in header is broken, so assume a 40 mm FOV
            self.fovX = self.lines*self.deltaX
            self.fovY = self.points*self.deltaY
            self.nFrames = header[1]

            self.deltaTheta = np.pi/180*.410
            self.R1 = 39.5

        if dataType == 'sim':

            f = open(filename, 'rb')

            self.imageType == 'la'
            
            #in Hz
            self.freqstep =float( np.fromfile(f, np.double,1) )
            self.points = int( np.fromfile(f, np.int32,1) )
            self.lines = int( np.fromfile(f, np.int32,1) )
            tempReal = np.fromfile(f,np.double, self.points*self.lines )
            tempImag = np.fromfile(f, np.double, self.points*self.lines )
            f.close()

            self.simFs = fsSimulation
            self.sigma = sigmaSimulation
            self.centerFreq = centerFreqSimulation
            self.deltaX = .2  #beamspacing in mm
            self.fovX = self.lines*self.deltaX

        if dataType == 'multiSim':

            f = open(filename, 'rb')

            self.imageType == 'la'
            #in Hz
            self.freqstep =float( np.fromfile(f, np.double,1) )
            self.points = int( np.fromfile(f, np.int32,1) )
            self.lines = int( np.fromfile(f, np.int32,1) )
            self.nFrames = int(np.fromfile(f, np.int32,1) )
            tempReal = np.fromfile(f,np.double, self.points*self.lines )
            tempImag = np.fromfile(f, np.double, self.points*self.lines )
            f.close()

            self.simFs = fsSimulation
            self.sigma = sigmaSimulation
            self.centerFreq = centerFreqSimulation
            self.deltaX = .2  #beamspacing in mm
            self.fovX = self.lines*self.deltaX

        if dataType == 'multiFocus':

            self.imageType == 'la'
            self.fs =  40.0E6
            #self.deltaX = 0.09
            self.deltaX = 0.15
            #read a frame to find out number of points and A lines
            import os
            self.nFrames = len( os.listdir(filename) )
            tempFrame = np.load(filename + '/001.npy')
            self.deltaY = self.soundSpeed/(2*self.fs)*10**3
            self.fovX = self.deltaX*(tempFrame.shape[1] - 1)
            self.fovY = self.deltaY*(tempFrame.shape[0] -1 )
            self.points = tempFrame.shape[0]
            self.lines = tempFrame.shape[1]
       
        if self.imageType == 'ps':
            rPos = self.deltaY*np.arange(self.points)
            thetaPos = self.deltaX*np.arange(-self.lines//2,-self.lines//2 + self.lines)

            THETA, R = np.meshgrid(thetaPos, rPos)

            ##for plotting
            self.X = R*np.sin(THETA) + self.aLineSpacing*np.arange(-self.lines//2,-self.lines//2 + self.lines)
            self.Y = R*np.cos(THETA)
       
        if self.imageType == 'wobbler':
            thetaPos = -self.lines/2*self.deltaTheta + np.arange(self.lines)*self.deltaTheta
            rPos = self.R1 + np.arange(self.points)*self.deltaY
            THETA, R = np.meshgrid(thetaPos, rPos)
            
            self.X = R*np.sin(THETA)
            self.Y = R*np.cos(THETA)
        
        
        self.roiX = [0, self.lines-1]
        self.roiY = [0, self.points - 1]
Ejemplo n.º 2
0
    def __init__(self,
                 filename,
                 dataType,
                 centerFreqSimulation=5.0,
                 sigmaSimulation=1.0,
                 fsSimulation=40.0):
        '''Input:
           filename:  The name of the file or directory the data is from
           dataType:  A lowercase string indicating the type of the data, choices are:
                        ei, elasticity imaging on the Seimens S2000
                        rfd, research mode on the Seimens S2000
                        rf, research mode with clinical software on Ultrasonix SonixTouch
                        sim, file format for simulated data with linear array transducers, one frame only
                        multiSim, file format for simulated data with linear array transducers, multiple frames
                         '''

        if not (dataType == 'ei' or dataType == 'rfd' or dataType == 'rf'
                or dataType == 'sim' or dataType == 'multiSim'
                or dataType == 'multiFocus', 'wobbler2D'):
            print 'Error.  Datatype must be ei,rfd,rf, sim, multiSim, or multiFocus '
            return

        self.fname = filename
        self.dataType = dataType

        self.soundSpeed = 1540.  #m/s
        self.data = None

        if dataType == 'ei':
            import os
            startdir = os.getcwd()
            os.chdir(self.fname)

            self.imageType == 'la'
            metaData = open('metaData.txt', 'r')
            metaList = [0, 0, 0, 0]
            for i in range(4):
                metaList[i] = int(metaData.readline())

            metaData.close()
            nFrames = len(
                [name for name in os.listdir('.') if os.path.isfile(name)])
            nFrames -= 1  #because of metaData.txt
            points = len(range(metaList[3] / 2, metaList[2] + metaList[3] / 2))
            aLines = metaList[1]

            self.nFrames = nFrames
            self.soundSpeed = 1540.  #m/s
            self.fs = 40. * 10**6  #Hz
            self.deltaX = 40. / aLines  #assume a 40 mm FOV
            self.deltaY = self.soundSpeed / (2 * self.fs) * 10**3
            self.fovX = self.deltaX * (aLines - 1)
            self.fovY = self.deltaY * (points - 1)
            os.chdir(startdir)

            self.points = points
            self.lines = aLines

        if dataType == 'rfd':
            import readrfd
            hInfo = readrfd.headerInfo(filename)
            self.fs = hInfo[1]
            if hInfo[4] == 'phased sector':
                self.imageType = 'ps'
                self.deltaX = hInfo[5]
                self.aLineSpacing = hInfo[6]
            else:
                self.imageType = 'la'
                self.deltaX = (1. / hInfo[2]) * 10.
            #read a frame to find out number of points and A lines
            tempFrame = readrfd.readrfd(filename, 1)
            self.nFrames = readrfd.rfdframes(filename)
            self.deltaY = self.soundSpeed / (2 * self.fs) * 10**3
            self.fovX = self.deltaX * (tempFrame.shape[1] - 1)
            self.fovY = self.deltaY * (tempFrame.shape[0] - 1)
            self.points = tempFrame.shape[0]
            self.lines = tempFrame.shape[1]

        if dataType == 'rf':
            #The header is 19 32-bit integers
            self.imageType = 'la'
            dataFile = open(self.fname, 'r')
            header = np.fromfile(dataFile, np.int32, 19)
            self.header = header
            self.fs = header[15]
            self.deltaY = self.soundSpeed / (2 * self.fs) * 10**3
            self.points = header[3]
            self.lines = header[2]
            self.deltaX = 40. / self.lines  #parameter in header is broken, so assume a 40 mm FOV
            self.fovX = self.lines * self.deltaX
            self.fovY = self.points * self.deltaY
            self.nFrames = header[1]

        if dataType == 'wobbler2D':
            #The header is 19 32-bit integers

            self.imageType = 'wobbler'
            dataFile = open(self.fname, 'r')
            header = np.fromfile(dataFile, np.int32, 19)
            self.header = header
            self.fs = header[15]
            self.deltaY = self.soundSpeed / (2 * self.fs) * 10**3
            self.points = header[3]
            self.lines = header[2]
            self.deltaX = 40. / self.lines  #parameter in header is broken, so assume a 40 mm FOV
            self.fovX = self.lines * self.deltaX
            self.fovY = self.points * self.deltaY
            self.nFrames = header[1]

            self.deltaTheta = np.pi / 180 * .410
            self.R1 = 39.5

        if dataType == 'sim':

            f = open(filename, 'rb')

            self.imageType == 'la'

            #in Hz
            self.freqstep = float(np.fromfile(f, np.double, 1))
            self.points = int(np.fromfile(f, np.int32, 1))
            self.lines = int(np.fromfile(f, np.int32, 1))
            tempReal = np.fromfile(f, np.double, self.points * self.lines)
            tempImag = np.fromfile(f, np.double, self.points * self.lines)
            f.close()

            self.simFs = fsSimulation
            self.sigma = sigmaSimulation
            self.centerFreq = centerFreqSimulation
            self.deltaX = .2  #beamspacing in mm
            self.fovX = self.lines * self.deltaX

        if dataType == 'multiSim':

            f = open(filename, 'rb')

            self.imageType == 'la'
            #in Hz
            self.freqstep = float(np.fromfile(f, np.double, 1))
            self.points = int(np.fromfile(f, np.int32, 1))
            self.lines = int(np.fromfile(f, np.int32, 1))
            self.nFrames = int(np.fromfile(f, np.int32, 1))
            tempReal = np.fromfile(f, np.double, self.points * self.lines)
            tempImag = np.fromfile(f, np.double, self.points * self.lines)
            f.close()

            self.simFs = fsSimulation
            self.sigma = sigmaSimulation
            self.centerFreq = centerFreqSimulation
            self.deltaX = .2  #beamspacing in mm
            self.fovX = self.lines * self.deltaX

        if dataType == 'multiFocus':

            self.imageType == 'la'
            self.fs = 40.0E6
            #self.deltaX = 0.09
            self.deltaX = 0.15
            #read a frame to find out number of points and A lines
            import os
            self.nFrames = len(os.listdir(filename))
            tempFrame = np.load(filename + '/001.npy')
            self.deltaY = self.soundSpeed / (2 * self.fs) * 10**3
            self.fovX = self.deltaX * (tempFrame.shape[1] - 1)
            self.fovY = self.deltaY * (tempFrame.shape[0] - 1)
            self.points = tempFrame.shape[0]
            self.lines = tempFrame.shape[1]

        if self.imageType == 'ps':
            rPos = self.deltaY * np.arange(self.points)
            thetaPos = self.deltaX * np.arange(-self.lines // 2,
                                               -self.lines // 2 + self.lines)

            THETA, R = np.meshgrid(thetaPos, rPos)

            ##for plotting
            self.X = R * np.sin(THETA) + self.aLineSpacing * np.arange(
                -self.lines // 2, -self.lines // 2 + self.lines)
            self.Y = R * np.cos(THETA)

        if self.imageType == 'wobbler':
            thetaPos = -self.lines / 2 * self.deltaTheta + np.arange(
                self.lines) * self.deltaTheta
            rPos = self.R1 + np.arange(self.points) * self.deltaY
            THETA, R = np.meshgrid(thetaPos, rPos)

            self.X = R * np.sin(THETA)
            self.Y = R * np.cos(THETA)

        self.roiX = [0, self.lines - 1]
        self.roiY = [0, self.points - 1]
    def ReadFrame(self, frameNo = 0):
        '''Read a single frame from the input file, the method varies depending on the file type that
        was read in.  This can handle linear array data from the Seimens S2000 recorded in either mode
        or the Ultrasonix scanner recorded using the clinical software.
        For a simulated data file, the 2nd and 3rd parameters matter, not for real data.

        Input::
        frameNo.  The RF data frame from a file obtained off a real ultrasound scanner.
        CenterFreq: (Hz)  The center frequency of the transmitted pulse for simulated ultrasound data.
        Sigma. (Hz)  The standard deviation of the Gaussian shaped transmit pulse for simulated data.
        samplingFrequency. (Hz)  The simulated sampling frequency for a simulated data set.  Higher
        sampling frequencies are achieved through zero-padding.'''

        import os,numpy as np

        if self.dataType == 'ei':
            startdir = os.getcwd()
            os.chdir(self.fname)

            metaData = open('metaData.txt', 'r')
            metaList = [0,0,0,0]
            for i in range(4):
                metaList[i] = int(metaData.readline() )

            metaData.close()
            points = len( range( metaList[3]/2, metaList[2] + metaList[3]/2 ) )
            aLines = metaList[1]
            self.data = np.zeros( (points, aLines) )
            readThisMany = (metaList[2]+ metaList[3]/2)*metaList[1]

            tempIn = open(str(frameNo), 'r')
            frame = fromfile(tempIn,  np.int16, readThisMany)
            frame = frame.reshape( ( metaList[2]+ metaList[3]/2, metaList[1] )  , order = 'F' )
            self.data[:,:] = frame[metaList[3]/2:metaList[3]/2 + metaList[2], :].copy('C')

            os.chdir(startdir)


        if self.dataType == 'rfd':
            import readrfd
            self.data = readrfd.readrfd(self.fname, frameNo + 1)

        if self.dataType == 'rf' or self.dataType == 'wobbler2D':
            #Read in the header, then read in up to one less frame than necessary
            dataFile = open(self.fname, 'r')
            header = np.fromfile(dataFile, np.int32, 19)
            if frameNo == 0:
                temp = np.fromfile( dataFile, np.int16, self.points*self.lines)
                self.data = temp.reshape( (self.points, self.lines),order='F')
            else:
                dataFile.seek( 2*self.points*self.lines*(frameNo-1), 1)
                temp = np.fromfile( dataFile, np.int16, self.points*self.lines)
                self.data = temp.reshape( (self.points, self.lines), order='F')


        if self.dataType == 'sim':
            ####To get the actual sampling frequency we will zero-pad up to the
            ###desired sampling frequency

            f = open(self.fname, 'rb')

            #in Hz
            self.freqstep =float( np.fromfile(f, np.double,1) )
            tmpPoints = int( np.fromfile(f, np.int32,1) )
            self.lines = int( np.fromfile(f, np.int32,1) )
            tempReal = np.fromfile(f,np.double, tmpPoints*self.lines )
            tempImag = np.fromfile(f, np.double, tmpPoints*self.lines )
            f.close()

            pointsToDesiredFs = int(self.simFs*10**6/self.freqstep)
            self.fs = pointsToDesiredFs*self.freqstep
            self.freqData = (tempReal - 1j*tempImag).reshape( (tmpPoints, self.lines), order = 'F' )

            import math
            f = np.arange(0,tmpPoints*self.freqstep, self.freqstep)
            self.pulseSpectrum = np.exp(-(f - self.centerFreq*10**6)*(f - self.centerFreq*10**6)/(2*(self.sigma*10**6)**2) )
            temp = self.freqData*self.pulseSpectrum.reshape( (tmpPoints, 1) )

            zeroPadded = np.zeros( (pointsToDesiredFs, self.lines) ) + 1j*np.zeros( (pointsToDesiredFs, self.lines) )
            zeroPadded[0:tmpPoints, :] = temp
            self.data = np.fft.ifft(zeroPadded,axis=0 ).real
            self.points = pointsToDesiredFs

            self.fs = self.freqstep*self.points
            self.deltaY = 1540. / (2*self.fs)*10**3
            self.fovY = self.deltaY*self.points


        if self.dataType == 'multiSim':
            ####To get the actual sampling frequency we will zero-pad up to the
            ###desired sampling frequency

            f = open(self.fname, 'rb')

            #in Hz
            self.freqstep =float( np.fromfile(f, np.double,1) )
            tmpPoints = int( np.fromfile(f, np.int32,1) )
            self.lines = int( np.fromfile(f, np.int32,1) )
            self.nFrames = int(np.fromfile(f, np.int32, 1) )

            #now jump ahead by as many frames as necessary
            #assume 64 bit, 8 byte doubles
            f.seek(8*2*tmpPoints*self.lines*frameNo, 1)
            #read in desired frame
            tempReal = np.fromfile(f,np.double, tmpPoints*self.lines )
            tempImag = np.fromfile(f, np.double, tmpPoints*self.lines )
            f.close()

            pointsToDesiredFs = int(self.simFs*10**6/self.freqstep)
            self.fs = pointsToDesiredFs*self.freqstep
            self.freqData = (tempReal - 1j*tempImag).reshape( (tmpPoints, self.lines), order = 'F' )

            import math
            f = np.arange(0,tmpPoints*self.freqstep, self.freqstep)
            self.pulseSpectrum = np.exp(-(f - self.centerFreq*10**6)*(f - self.centerFreq*10**6)/(2*(self.sigma*10**6)**2) )
            temp = self.freqData*self.pulseSpectrum.reshape( (tmpPoints, 1) )
            zeroPadded = np.zeros( (pointsToDesiredFs, self.lines) ) + 1j*np.zeros( (pointsToDesiredFs, self.lines) )
            zeroPadded[0:tmpPoints, :] = temp
            self.data = np.fft.ifft(zeroPadded,axis=0 ).real
            self.points = pointsToDesiredFs

            self.fs = self.freqstep*self.points
            self.deltaY = 1540. / (2*self.fs)*10**3
            self.fovY = self.deltaY*self.points

        if self.dataType == 'multiFocus':
            self.data = np.load(self.fname + '/' + str(frameNo + 1).zfill(3) + '.npy')
Ejemplo n.º 4
0
    def ReadFrame(self, frameNo=0):
        '''Read a single frame from the input file, the method varies depending on the file type that
        was read in.  This can handle linear array data from the Seimens S2000 recorded in either mode
        or the Ultrasonix scanner recorded using the clinical software.
        For a simulated data file, the 2nd and 3rd parameters matter, not for real data.

        Input::
        frameNo.  The RF data frame from a file obtained off a real ultrasound scanner.
        CenterFreq: (Hz)  The center frequency of the transmitted pulse for simulated ultrasound data.
        Sigma. (Hz)  The standard deviation of the Gaussian shaped transmit pulse for simulated data.
        samplingFrequency. (Hz)  The simulated sampling frequency for a simulated data set.  Higher
        sampling frequencies are achieved through zero-padding.'''

        import os, numpy as np

        if self.dataType == 'ei':
            startdir = os.getcwd()
            os.chdir(self.fname)

            metaData = open('metaData.txt', 'r')
            metaList = [0, 0, 0, 0]
            for i in range(4):
                metaList[i] = int(metaData.readline())

            metaData.close()
            points = len(range(metaList[3] / 2, metaList[2] + metaList[3] / 2))
            aLines = metaList[1]
            self.data = np.zeros((points, aLines))
            readThisMany = (metaList[2] + metaList[3] / 2) * metaList[1]

            tempIn = open(str(frameNo), 'r')
            frame = fromfile(tempIn, np.int16, readThisMany)
            frame = frame.reshape((metaList[2] + metaList[3] / 2, metaList[1]),
                                  order='F')
            self.data[:, :] = frame[metaList[3] / 2:metaList[3] / 2 +
                                    metaList[2], :].copy('C')

            os.chdir(startdir)

        if self.dataType == 'rfd':
            import readrfd
            self.data = readrfd.readrfd(self.fname, frameNo + 1)

        if self.dataType == 'rf' or self.dataType == 'wobbler2D':
            #Read in the header, then read in up to one less frame than necessary
            dataFile = open(self.fname, 'r')
            header = np.fromfile(dataFile, np.int32, 19)
            if frameNo == 0:
                temp = np.fromfile(dataFile, np.int16,
                                   self.points * self.lines)
                self.data = temp.reshape((self.points, self.lines), order='F')
            else:
                dataFile.seek(2 * self.points * self.lines * (frameNo - 1), 1)
                temp = np.fromfile(dataFile, np.int16,
                                   self.points * self.lines)
                self.data = temp.reshape((self.points, self.lines), order='F')

        if self.dataType == 'sim':
            ####To get the actual sampling frequency we will zero-pad up to the
            ###desired sampling frequency

            f = open(self.fname, 'rb')

            #in Hz
            self.freqstep = float(np.fromfile(f, np.double, 1))
            tmpPoints = int(np.fromfile(f, np.int32, 1))
            self.lines = int(np.fromfile(f, np.int32, 1))
            tempReal = np.fromfile(f, np.double, tmpPoints * self.lines)
            tempImag = np.fromfile(f, np.double, tmpPoints * self.lines)
            f.close()

            pointsToDesiredFs = int(self.simFs * 10**6 / self.freqstep)
            self.fs = pointsToDesiredFs * self.freqstep
            self.freqData = (tempReal - 1j * tempImag).reshape(
                (tmpPoints, self.lines), order='F')

            import math
            f = np.arange(0, tmpPoints * self.freqstep, self.freqstep)
            self.pulseSpectrum = np.exp(-(f - self.centerFreq * 10**6) *
                                        (f - self.centerFreq * 10**6) /
                                        (2 * (self.sigma * 10**6)**2))
            temp = self.freqData * self.pulseSpectrum.reshape((tmpPoints, 1))

            zeroPadded = np.zeros(
                (pointsToDesiredFs, self.lines)) + 1j * np.zeros(
                    (pointsToDesiredFs, self.lines))
            zeroPadded[0:tmpPoints, :] = temp
            self.data = np.fft.ifft(zeroPadded, axis=0).real
            self.points = pointsToDesiredFs

            self.fs = self.freqstep * self.points
            self.deltaY = 1540. / (2 * self.fs) * 10**3
            self.fovY = self.deltaY * self.points

        if self.dataType == 'multiSim':
            ####To get the actual sampling frequency we will zero-pad up to the
            ###desired sampling frequency

            f = open(self.fname, 'rb')

            #in Hz
            self.freqstep = float(np.fromfile(f, np.double, 1))
            tmpPoints = int(np.fromfile(f, np.int32, 1))
            self.lines = int(np.fromfile(f, np.int32, 1))
            self.nFrames = int(np.fromfile(f, np.int32, 1))

            #now jump ahead by as many frames as necessary
            #assume 64 bit, 8 byte doubles
            f.seek(8 * 2 * tmpPoints * self.lines * frameNo, 1)
            #read in desired frame
            tempReal = np.fromfile(f, np.double, tmpPoints * self.lines)
            tempImag = np.fromfile(f, np.double, tmpPoints * self.lines)
            f.close()

            pointsToDesiredFs = int(self.simFs * 10**6 / self.freqstep)
            self.fs = pointsToDesiredFs * self.freqstep
            self.freqData = (tempReal - 1j * tempImag).reshape(
                (tmpPoints, self.lines), order='F')

            import math
            f = np.arange(0, tmpPoints * self.freqstep, self.freqstep)
            self.pulseSpectrum = np.exp(-(f - self.centerFreq * 10**6) *
                                        (f - self.centerFreq * 10**6) /
                                        (2 * (self.sigma * 10**6)**2))
            temp = self.freqData * self.pulseSpectrum.reshape((tmpPoints, 1))
            zeroPadded = np.zeros(
                (pointsToDesiredFs, self.lines)) + 1j * np.zeros(
                    (pointsToDesiredFs, self.lines))
            zeroPadded[0:tmpPoints, :] = temp
            self.data = np.fft.ifft(zeroPadded, axis=0).real
            self.points = pointsToDesiredFs

            self.fs = self.freqstep * self.points
            self.deltaY = 1540. / (2 * self.fs) * 10**3
            self.fovY = self.deltaY * self.points

        if self.dataType == 'multiFocus':
            self.data = np.load(self.fname + '/' + str(frameNo + 1).zfill(3) +
                                '.npy')