Ultra sound problem. Tackle today – ideas for Assignment 2 Describe the ultrasound problem XPI lifecycle Stage 1 – Discuss with research team (customer)

Slides:



Advertisements
Similar presentations
Chapter 19 Fast Fourier Transform
Advertisements

| Page Angelo Farina UNIPR | All Rights Reserved | Confidential Digital sound processing Convolution Digital Filters FFT.
SirenDetect Alerting Drivers about Emergency Vehicles Jennifer Michelstein Department of Electrical Engineering Adviser: Professor Peter Kindlmann May.
Frequency modulation and circuits
Processor Architecture Needed to handle FFT algoarithm M. Smith.
1 Chapter 16 Fourier Analysis with MATLAB Fourier analysis is the process of representing a function in terms of sinusoidal components. It is widely employed.
LECTURE 9 Ch 16.7 BEATS Ch Doppler Effect
Improved Headphone Sound Stage Background to ENCM515 Labs on DSO Audio Channel Modeling Based on concepts in Bessinger Thesis Various copyrights M. Smith,
6/3/20151 This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these action items.
JF 12/04111 BSC Data Acquisition and Control Data Representation Computers use base 2, instead of base 10: Internally, information is represented by binary.
Doppler Effect(1) Stationary source Stationary observer Moving source
3/5/2004DSP Applied to GPS Algorithms1 of 14 DSP Applied to GPS Algorithms.
William Stallings Data and Computer Communications 7th Edition (Selected slides used for lectures at Bina Nusantara University) Data, Signal.
Fourier Theory and its Application to Vision
Unit 7 Fourier, DFT, and FFT 1. Time and Frequency Representation The most common representation of signals and waveforms is in the time domain Most signal.
Sound Sound is a longitudinal wave Sound, like all waves is generated by something vibrating What is its medium?
WAVES: A way to transmit energy . Waves are defined as a periodic disturbance that carries energy from one place to another. A periodic disturbance is.
Inputs to Signal Generation.vi: -Initial Distance (m) -Velocity (m/s) -Chirp Duration (s) -Sampling Info (Sampling Frequency, Window Size) -Original Signal.
The Doppler Effect.
Digital to Analogue Conversion Natural signals tend to be analogue Need to convert to digital.
Graphic Equalizer Table By Jose Lerma. Main Idea The main idea of this table is to display the frequencies of any sound or audio input, either by microphone.
Section  The Doppler Effect: A change in frequency (pitch) due to relative motion between a source of sound and its observer.
Digital audio. In digital audio, the purpose of binary numbers is to express the values of samples that represent analog sound. (contrasted to MIDI binary.
Sound Sound is a wave that carries vibrations. It is mechanical, longitudinal, and a pressure wave.
Noadswood Science,  To understand how amplitude, wavelength and frequency affect sound waves Monday, September 07, 2015.
Doppler Effect The Doppler effect is the apparent change in the frequency of a wave motion when there is relative motion between the source of the waves.
Ultra sound solution Impact of C++ DSP optimization techniques.
Wireless PHY: Modulation and Demodulation Y. Richard Yang 09/6/2012.
Resident Categorical Course
Processor Architecture Needed to handle FFT algoarithm M. Smith.
The Discrete Fourier Transform. The Fourier Transform “The Fourier transform is a mathematical operation with many applications in physics and engineering.
Pegasus Lectures, Inc. COPYRIGHT 2006 Volume II Companion Presentation Frank R. Miele Pegasus Lectures, Inc. Ultrasound Physics & Instrumentation 4 th.
15.1 Properties of Sound  If you could see atoms, the difference between high and low pressure is not as great.  The image below is exaggerated to show.
Preprocessing Ch2, v.5a1 Chapter 2 : Preprocessing of audio signals in time and frequency domain  Time framing  Frequency model  Fourier transform 
Wireless and Mobile Computing Transmission Fundamentals Lecture 2.
1 By: Mike Maloney 2 Waves are everywhere in nature Sound waves, visible light waves, radio waves, microwaves, water waves, sine waves, telephone chord.
10/12/20151 This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these action items.
THE DOPPLER EFFECT. When the source of a sound is moving towards you, the pitch sounds higher than that of the source. When the source moves away from.
Decibels and Doppler Effect
Display of Motion & Doppler Ultrasound
Sound Vibration and Motion.
Advanced Digital Signal Processing
Chapter 17 Sound Waves: part two HW 2 (problems): 17.22, 17.35, 17.48, 17.58, 17.64, 34.4, 34.7, Due Friday, Sept. 11.
Sarah Gillies Ultrasound Sarah Gillies
Seismic Reflection Data Processing and Interpretation A Workshop in Cairo 28 Oct. – 9 Nov Cairo University, Egypt Dr. Sherif Mohamed Hanafy Lecturer.
Doppler Effect Doppler effect- an observable change in frequency. As a moving object approaches an observer the frequency goes up, as is moves away the.
Goal: To understand sound Objectives: 1)To learn about Sound waves 2)To understand the Speed of sound 3)To learn about Doppler Shifts 4)To learn about.
Sound Bites. Basics Sound is a mechanical, longitudinal wave. The medium usually associated with sound is air, but sound can travel through both liquids.
Ultra sound solution Profiles and other optimizations.
EE 113D Fall 2008 Patrick Lundquist Ryan Wong
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
Sonia Hingorany & Liza Cyriac EE113D – Professor Rajeev Jain & TA Rick Huang– Winter 2008.
 For source moving away from observer, wavelength increases  Following the same procedures gives   For source moving away, f o
Waves & Wave Properties Sound Waves
RTLS. LOCATING / POSITIONING SYSTEMS A positioning system is a mechanism for determining the location of an object in space Interplanetary systems Global.
Professor A G Constantinides 1 Discrete Fourier Transforms Consider finite duration signal Its z-tranform is Evaluate at points on z-plane as We can evaluate.
Fundamental Ultrasound Principles Karen Potts Clinical Scientist Review date Jan 2010 Department of Medical Physics Kent & Canterbury.
Range & Doppler Accuracy by Ramya R.
PHYSICS and math OF SOUND
Ch. 2 : Preprocessing of audio signals in time and frequency domain
Duy dang, Robert kern, esteban kleckner
V f λ.
Electronic Instrumentation
Fourier Transform.
Unit 7: Vibrations, Waves & Sound Chapter 20: Sound
Developing a multi-thread product -- Introduction
Convolution, GPS and the TigerSHARC XCORRS instr.
Chapter 19 Fast Fourier Transform
Govt. Polytechnic Dhangar(Fatehabad)
Working with the Compute Block
Presentation transcript:

Ultra sound problem

Tackle today – ideas for Assignment 2 Describe the ultrasound problem XPI lifecycle Stage 1 – Discuss with research team (customer) Proposed solution XPI lifecycle Stage 2 – Work out algorithm in Matlab XPI lifecycle Stage 3 – Move to C++ code XPI lifecycle Stage 4 – Move to optimized C++ code (and learn how to use all C++ pragmas properly) NEW XPI lifecycle Stage 5 – Move code to custom DSP accelerator 11/1/2015 ENCM515 – Ultrasound Problem Copyright 2 / 33

Research Team discussion Ultra-sound probe (20 MHz) that sends out signals into body that reflect off moving blood cells in (Artery? Vein?) Ultra-sound frequency received is Doppler shifted compared to transmitted frequency Same as sound when ambulance goes by. Higher if approaching, lower if receding They get the positive frequencies (towards) on the left audio channel and negative frequencies (away) on the right audio channel. 11/1/2015.ENCM515 – Ultrasound Problem Copyright 3 / 33

Picture looks like this Note that the display loses all direction information Can I help them to output the maximum frequency? 11/1/2015 ENCM515 – Ultrasound Problem Copyright 4 / 33

My response No -- it can’t be done But I am willing to negotiate that answer – we might get a rough answer 11/1/2015 ENCM515 – Ultrasound Problem Copyright 5 / 33

Doppler Effect – Understand the Math Sound frequency we hear is governed by frequency * wavelength = velocity of sound Not velocity in air, but in human body – which means it might be changing as it passes through different body parts. Also get noise from sound reflections from body part boundaries W. A. I. L. – assume constant velocity 11/1/2015 ENCM515 – Ultrasound Problem Copyright 6 / 33

Understand the Math Object moving away from us Object stationary Sound pressure waves are bouncing off object Maximum in sound pressure waves are a distance of wavelength apart Object moving away from us at speed Vobj First sound pressure maximum bounces off object Second sound pressure maximum has to catch up with moving object which has moved a distance Xobj in the time between maximums Apparent wavelength = wavelength + Xobj 11/1/2015 ENCM515 – Ultrasound Problem Copyright 7 / 33

Doppler numbers frequency * wavelength = velocitySound Becomes apparentFrequency * apparentWavelenth = velocitySound apparentFrequency = velocitySound / apparentWavelength = velocitySound / (wavelength + Xobj) wavelength = velocitySound / frequency Xobj = velocityObject * (time for sound wave to catch up) Time to catch up = Xobj / velocitySound Xobj = velocityObject * Xobj / velocitySound 1 = velocityObject / velocitySound -- OOPS Something wrong 11/1/2015 ENCM515 – Ultrasound Problem Copyright 8 / 33

Try again If object was not moving – next sound pressure maximum arrives in time deltaT = 1 / freq (s) Object has moved a distance Vobj * deltaT in that time Therefore when the pressure maximum bounces off the object, the distance between pressure maximum has increased to wavelength + Vobj * deltaT WAIT-A-MO – By the time the pressure maximum has gone that distance object has moved again! True – this means that the changed wavelength is longer than wavelength + Vobj * deltaT. In fact if the object is moving fast enough – no sound waves will bounce off the object Assume that Vobj is much slower than Vsound. Expect this to be valid in body – but might not be – not domain expert 11/1/2015 ENCM515 – Ultrasound Problem Copyright 9 / 22

Doppler numbers frequency * wavelength = velocitySound Becomes apparentFrequency * apparentWavelenth = velocitySound apparentFrequency = velocitySound / apparentWavelength = velocitySound / (wavelength + Xobj) wavelength = velocitySound / frequency Xobj = Vobj * deltaT = Vobj / frequency apparentFrequency = velocitySound / apparentWavelength = velocitySound / (velocitySound / frequency + Vobj / frequency) = frequency * velocitySound / (velocitySound + Vobj) 11/1/2015 ENCM515 – Ultrasound Problem Copyright 10 / 33

Physiological B of E calculation apparentFrequency = frequency * velocitySound / (velocitySound + Vobj) FrequencyChange = apparentFrequency – frequency = frequency * (velocitySound / (velocitySound + Vobj) – 1) = frequency * (-Vobj / (velocitySound + Vobj) = frequency * (-Vobj / velocitySound); velocitySound >> Vobj Vobj = - FrequencyChange * velocitySound / frequency Are the body measurements consistent with the theory? Assume – ultrasound is 20 Mz and change in frequency maximum = 6 kHz Vobj = - 6 * 10^3 * velocitySound / 20 * 10^ 6 = 0.3 * 10 ^-3 * velocitySound Assume –velocitySound = 5 * velocitySoundAir = 1500 m / s Vobj = 0.3 * 1.5 m / s = 0.5 m/s Car = 50 km / hour = 50,000 / 3600 m / s = 15 m / s Blood cells moving around 2 km / hour – is that correct? 11/1/2015 ENCM515 – Ultrasound Problem Copyright 11 / 33

Look at customer picture We said (B of E calculation) Max velocity = 0.5 m / s = 50 cm / s Actual maximum around 150 cm / s velocitySound = 15 * velocitySoundAir = 4500 m / s 11/1/2015 ENCM515 – Ultrasound Problem Copyright 12 / 33

XPI-Inspired Life cycle Stage 1 Further talks with customer Positive frequencies (towards) on the left audio channel and negative frequencies (away) on the right audio channel GUESS WHATS HAPPENING – Model correct, details ??? Signal is 20 MHz + 4 kHz and 20 MHz – 5 kHz from two blood cells Filter signal 20 MHz  20 MHz + 4 * MaxFrequency. Down shift to 0 Hz, and output on Left Channel Filter signal 20 MHz  20 MHz - 4 * MaxFrequency. Down shift to 0 Hz, and output on Right Channel Guess why – audio interpretation of blood flow 11/1/2015 ENCM515 – Ultrasound Problem Copyright 13 / 33

XPI-Inspired Life cycle Stage 2 Move to Matlab Many built-in “trusted” algorithms (have found some wrong) Easy to visualize via plots Have not found a good automated testing framework Algorithm pseudo code Gather blocks of audio data – size N – left and right NO hassle – 6 kHz will be easily handled by SHARC A/D Perform DFT on both channels (discrete Fourier transform) Engineering problem 1 – Complex math (a + jb) on SHARC! Find maximum frequency left and right from DFT Engineering Problem 2 – Define maximum frequency zillions of blood cells – therefore distribution of frequencies If (max Forward > max Reverse) return Forward else return –Reverse Send DC representation of frequency to 1 of 16 channels of (OLD?) analogue digital chart recorder to record along side other physiological signals Engineering Problem 3 – SHARC D/A can’t handle DC signal Engineering Problem 4 – Can SHARC handle all this in real-time? 11/1/2015 ENCM515 – Ultrasound Problem Copyright 14 / 33

Captured audio signal 11/1/2015 ENCM515 – Ultrasound Problem Copyright 15 / 33 More Engineering Problems Problem 5 – Is different amplitudes common? Problem 6 – Why are funny dead spots not lining up in left and right channels? Real or artifact? Guess – channels not recorded at same time for this prototype Problem 7 – How to remove dead-spots?

Max frequency – definition 1 Frequency below which X% of the frequencies fall Noisy signal for large thresholds > 80% 11/1/2015 ENCM515 – Ultrasound Problem Copyright 16 / 33

Max frequency – definition 2 Frequency containing most cells – with a certain band of frequencies There was multiple bands of near similar frequency max Useful info? 11/1/2015 ENCM515 – Ultrasound Problem Copyright 17 / 33

Special tricks employed Fourier interpolation to improve frequency resolution Modulate DC signal on top of 2 kHz audio signal Output from SHARC Amplify using home audio system Now rectify and smooth and send to channel recorder 11/1/2015 ENCM515 – Ultrasound Problem Copyright 18 / 33

After XPI Stage 2 Have a working algorithm concept Engineering problem 1 – Complex math (a + jb) on SHARC! Engineering Problem 2 – Define maximum frequency zillions of blood cells – therefore distribution of frequencies Workable prototype – discuss more with customer Engineering Problem 3 – SHARC D/A can’t handle DC signal Workable prototype – discuss more with customer Engineering Problem 4 – Can SHARC handle all this in real-time? Problem 5 – Is different amplitudes common? Discuss more with customer Problem 6 – Why are funny dead spots not lining up in left and right channels? Real or artifact? Guess – channels not recorded at same time for this prototype Discuss more with customer – Get second set of samples Problem 7 – How to remove dead-spots? – Discuss more with customer 11/1/2015 ENCM515 – Ultrasound Problem Copyright 19 / 33

XPI Stage 3 – Move to C++ Good starting point – working MatLab code Start with known signals -- TestVectorIn Pass through Matlab to get known results TestVectorOut Generate tests that the C++ code must satisfy OFF-LINE Can TEST with TestVectorIn and TestVectorOut hard-coded in C++ memory ON-LINE – Biggest worry, need block of data and process it 11/1/2015 ENCM515 – Ultrasound Problem Copyright 20 / 33

Assignment 1, Labs 1, 2 and 3 11/1/2015 ENCM515 – Ultrasound Problem Copyright 21 / 33

Slightly faster version 11/1/2015 ENCM515 – Ultrasound Problem Copyright 22 / 33

New C++ optimization approach #pragma always_inline inline void ProcessOnePoint(void) { 11/1/2015 ENCM515 – Ultrasound Problem Copyright 23 / 33

This works PROVIDES deltaT = 1 / s Time to do one point Operating system Time to do a task Time to input Time to process Time to output 11/1/2015 ENCM515 – Ultrasound Problem Copyright 24 / 33

Need to process “One Block” This form of the program does not generate blocks – samples the same point 11/1/2015 ENCM515 – Ultrasound Problem Copyright 25 / 33

Version 2 Captures a block But outputs all points very quickly into Left_Out Hear one point then silence 11/1/2015 ENCM515 – Ultrasound Problem Copyright 26 / 33

Version 3 Capture Process Output Capture Process Output 11/1/2015 ENCM515 – Ultrasound Problem Copyright 27 / 33

Version 3 – Curate’s Egg Famous 1820 joke Works well occasionally 11/1/2015 ENCM515 – Ultrasound Problem Copyright 28 / 33 CAPTUREN * deltaT PROCESSHow long does it take? OUTPUTN * deltaT CAPTUREN * deltaT PROCESSHow long does it take? OUTPUTN * deltaT

Version 3 – Look at efficiency 11/1/2015 ENCM515 – Ultrasound Problem Copyright 29 / 33 CAPTUREWASTED CPU TIME SILENCE LOST DATAPROCESSSILENCE LOST DATAWASTED CPU TIME OUTPUT CAPTUREWASTED CPU TIME SILENCE LOST DATAPROCESSSILENCE LOST DATAWASTED CPU TIME OUTPUT CAPTURE1 CAPTURE2PROCESS1 CAPTURE3PROCESS2OUTPUT1 CAPTURE4PROCESS3OUTPUT2 CAPTURE5PROCESS4OUTPUT3 CAPTURE6PROCESS5OUTPUT4

This code only works if Time for ProcessOneBlock < deltaT (1 / s) Unnecessary Race problem 11/1/2015 ENCM515 – Ultrasound Problem Copyright 30 / 33

ProcessBlock DONE OUTSIDE INTERRUPT AVOIDS RACE 11/1/2015 ENCM515 – Ultrasound Problem Copyright 31 / 33

Problems to watch for #pragma always_inline inline void ProcessOneBlock(float *inBuffer, float *outBuffer) { for (int count = 0; count < PROCESS_BUFFER_LENGTH; count++) { outBuffer[count] = inBuffer[count]; } inline void ProcessFIROneBlock(float *inBuffer, float *outBuffer) { When doing N point FIR on data block Processing first point in buffer then need N – 1 points from previous blocks } 11/1/2015 ENCM515 – Ultrasound Problem Copyright 32 / 33

Speed issues when processing block Suppose N points and M tap FIR then time taken Order (N * M) where N = 256 and FIR order = 256 -> k * 256 * 256 Can do filtering in frequency domain Do FFT – takes time Order(N log N) Do Multiplication in frequency domain Order (N) Do Inverse FFT – takes time Order(N log N) Time roughly Order(2N log N + N) K’ * (2 * 256 * log(256) + 256) = K’ * 256 * (16 + 1)) Time domain calculation is slower 11/1/2015 ENCM515 – Ultrasound Problem Copyright 33 / 33

Ready to solve the ultrasound problem 11/1/2015 ENCM515 – Ultrasound Problem Copyright 34 / 33