Tuesday 25 December 2012

Finding solutions

10:30 am

So, the first problem that I am having is that the radius of the artery that I am going to be receiving will be changing for every instance of simulation. I need to pass it on to a file which is called in the embedded matlab block which inputs this changing radius.

To make it sound simple, I will create a simpler scenario, make it work on my scenario, and then test it on the actual case. Now, what we have currently is a file that takes in a pulse generated value, and a sin wave, sums it and gives the output to a scope.

I'll do this, let the pulse output be the Arterial Cross Sectiional area variations. Let the sin wave be the pressure from the heart. The embedded MATLAB block will take the CS, calculate radius, save it to the workspace as the variable r, and call another function baby. Baby will take the updated radius increment it by 10. This incremented value will be multiplied to the sin wave and output will be shown.

So, what we have to do in simulink is

1. Sin block
2. Pulse generator block
3. Embedded matlab block with the above as inputs.
4. Calculate radius and save into a workspace variable and call baby
5. Baby takes radius, multiplies by 10 and returns value.
6. This value is then multiplied to sin wave and shown as output.

In all of the above steps, steps 4 and 5 are difficult. How do we do that?

Saturday 22 December 2012

Need the complete program today

10:25 am

Referring to this for understand how to solve pde programmatically.
Really scared now.. :(
Okay, So have been going in steps.

Right now, the following program works.


[p,e,t]=initmesh('Mycircleg');
[p,e,t]=refinemesh('Mycircleg',p,e,t);
u0=zeros(size(p,2),1);
tlist=linspace(1,0.1,20);
u1=parabolic(u0,tlist,'circleb1',p,e,t,0.0035,1,f,1060);
pdesurf(p,t,u1)

What I have to do in this, are the following modifications:

1. The radius of the circle in Mycircleg.m need to be passed somehow from the main Embedded MATLAB file.
One way to do this is save the input radius variable in as a matlab variable in workspace and access it in the next file.

2. In the parabolic function, a number of replacements have to be done. We'll begin from the end. Last 4 parameters of the function are c, a, f, d.
c = viscosity of blood, 0.0035 kg/m.s. a is gravity = 1, pressure f  needs to be provided dynamically from the pressure source, d = 1060kg/m3
One way to do this is to just have another input to the block, and use that variable in place of f.

3. tlist variable!! We know that the function parabolic will evaluate the solution to the geometry for every value of the array tlist. but I need the function to be evaluated for every value of the simulation time!
I will have to try different combinations of possibilities for this.

Friday 21 December 2012

Trying to write the s function, and serendipity: Embedded MATLAB function

10:10 am

So, I know the template to be used. I know what I want to do. Just need the courage to start doing it. Here we go.



Phusssssssssss.................... Phusss, Phusssss, ...

So fooooolish of me!! Easier way is to use Embedded MATLAB function. Already tried it out with the example that I considered in the last post. Now, to my pde function. :)

Thursday 20 December 2012

Analysis to plot the pde parabolic solution

10:15 am

Now that I have understood what the code snippette does, we've gotto think about what the output should be.. It should be the velocity profile during the simulation time.

This makes me realize that, the time tlist that we supply to the parabolic function for solution of the pde should be changed to the simulation time. => How?

 Each column in u1 is the solution at the time given by the corresponding item in tlist. For my function, parabolic, each item in tlist needs to be block.CurrentTime. What should be the size of this array? Depends on the number of itertions of the solution we want to see. I need to try this out, on a smaller scale before implementing it on my model. Need an example.

let x be a sin wave, let y be a square wave. Let us try to build a block that will create an output that is a sum of these two inputs and the simulation time taken as an input through the functions arguments. ok. Let's try that out right away, .. but for that, I need to know how,.. how EXACTLY to write a level 2 matlab s function. Here we go.

Alright, so, read through and have realized that, it's a whole new set of keywords and almost an entire language to learn, .. when writiing an s function.. Remember having a s-function writing wizard of some sort in simulink.. It will be better if I use that,.. instead of wasting my time writing the entire code, .. let's check that out. No, .. no, .. that looks even more scary, coz it uses C mex and c code. Let that be. I'll continue with writing the s function matlab code only. Studying how to write an s-function from this pdf document. Very helpful.

Wednesday 19 December 2012

Writing the s-function as m-file

11:43 am

Hey!! Good morning! Back after indeed a very very long time! Had my 3rd semester exams; and then a long vacation of an entire week. Pampered myself for a while. Now back to the project. Pressure needs to build up for me to get back on track. Spoke to my cousin sister yesterday, and finally decided that I should start.

So, I have sort of implemented all that I have written in the previous post, only the most important one, the last block of pde solution isn't done. I tried to do it.

Firstly, followed the same steps they have given in the pdetool, parabolic part in the manual. It's missing the plotting code. So realised I need to understand the bloody code. If I don't understand it, it's senseless. To understand the code, .. I HAVE to blog! Else my mind wanders around. So, here we go..

First line in the code is:

[p,e,t]=initmesh('circleg'); % Create initial triangular mesh

As we all know, to apply the pde on every point of the geometry, we first divide the geometry into small triangles. This we call meshing. We apply the pde on every triangle and then integrate the result. This is the method of finite element I guess. Need to search a bit on what it exactly is, but I think that's it. And this function 'initmesh' initializes the creation of this mesh.
The function obviously needs the geometry as the input parameter, which we can define in different ways according to the format and flexibility of the function. The output of the function is the meshed data; p => point matrix with x and y coordinates of mesh points as the rows of the matrix, e => edge matric with starting and ending point indices, starting and ending point parameter values, edge number and left and right side subdomain number, t => triangle matrix with three corner points in anticlockwise direction and subdomain number.

Next,

[p,e,t]=refinemesh('circleg',p,e,t);  % Refine triangular mesh

Refinement usually bisects every edge of the specified triangles, thus creating 4 new smaller triangles out of every specified triangle. Hence the input to the function is the geometry under consideration, and the specified initial mesh and the output of the function is the p, e, t matrices of the refined mesh for that geometry.

Next,

u0=zeros(size(p,2),1);

size(p,2) returns the size of the 2-D p matrix and zeros(size(p,2),1) returns a 2-D zero matrix of the same size. We name it u0.

Next,

ix=find(sqrt(p(1,:).^2+p(2,:).^2)<0.4);  % Find indices and values of nonzero elements

This finds all the non-zero points inside the circle with radius 0.4 units, and returns its indices as a column vector.

Next,

u0(ix)=ones(size(ix));

We replace the found non-zero entries of interest by 1 in the zero matrix u0

Next,

tlist=linspace(0,0.1,20);

create an array that will have values of 0 to 0.1 in 20 steps.

Last,

u1=parabolic(u0,tlist,'circleb1',p,e,t,1,0,1,1); % Solve parabolic PDE problem

parabolic is a function that produces the solution to the FEM formulation of the scalar PDE problem. Its input parameters are,

u0 => initial value of the mesh
tlist => time for which solution to be obtained
circleb1 => Initial Boundary condition data
p, e, t => mesh point, edge, triangle data
1, 0, 1, 1 => c, a, f, d
c => viscosity
a => gravity
f => pressure
d => density
u1 => final solution at the end of simulation time.

Now I need to plot this u1.

Saturday 17 November 2012

Joining the Pieces of the Puzzle

12:50 am

So, have been delaying the real implementation so much. Why? I know what all has to be done, how it has to be done, but not sure if it will all work together. So, confirm it all, I have to implement it. But I have been delaying it for so long. Why? I know why.. It’s only because, the work that I have planned is scattered among all the blogs that I have written. Need to put it all together and sit and implement it. Was hoping I could finish all by today, but looks like that’s not happening!! So, today I enlist the things I have to do regarding the model. Here we go.

Step 1 : c1(p) block
Create a polynomial block with given values of constants, to be multiplied by pressure p which is the input from fetal heart.

Step 2 : c2(z) block
Create a waveform that approximates the waveform given in the paper. The values could be:
z = [0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80]
c2(z) = [1 3.5 7.5 10 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 11 11.1 11.2 11.3 11.4]
Once that is ready, approximate the input z to the closest value and give out the corresponding c2(z)

Step 3 : c2(p,z) block
multiply the outputs of step 1 and step 2. This gives a continuous output which is a variable dependent on p.

Step 4 : Location Block
Take the z input and find which arterial segment or bifurcation it belongs to (switch case), and give the distance in that segment as the output.

Step 5 : Initial Cross Section block
Find its initial cross section according to formula for that segment or bifurcation with the output from step 4.

Step 6 : Final Cross Section Block
Multiply the output from step 3 to the blood density constant continuously, find its reciprocal, add it to 1, and then multiply the whole to the output of Step 5. This gives a continuously varying cross section variable.

Step 7 : Stokes – Navier block
Write the S-function which calculates the solution to the stokes navier equation using the Thermal regulator: PDE Toolbox - Simulink application and the following:
image
image

Step 8 : Export to the workspace and store, and plot against time

ONLY THE PROBLEM IS PLOTTING AGAINST TIME!!! DISCUSS WITH SIR!!

Friday 16 November 2012

Confirming the 4th Change in Direction and Some Relief!!

11:05 pm
So, after trying very hard with the method of characteristics used in the original paper, I realized that, the mathematical part is too difficult for a child like me. So, will not be solving the stokes Navier equation using method of characteristics but will be doing it using pdetool in Simulink. This was the same idea that I had posted before. I realize that this means it is a waste of at least a week, but, I’ll call it use,.. since I know, exactly WHY I’m not using the method of characteristics. Have to enlist the reasons.

So, today, before going to sleep, the agenda is, use Simulink to create a module for the Generates the solution to the Stokes-Navier equations. I think the designing part will be easy, but what we need to verify is whether the output we are getting is right or wrong. To do that, we need to connect the entire system together, or give a temporary input that represents the practical input to the module.

1. Think how to calculate mean pressure at any point in the system which I suppose becomes the input to the Stokes-Navier module.
2. Think up if and how this module and the rest of the modules can work together.
3. Form the Stokes-Navier module, using the document mentioned before.
This document will be edited after about half an hour.
So, here I am, trying to design the Stokes – Navier module. Firstly consider this equation given in the document:image

Now consider the Stokes-Navier Equation given in one of the ppts that I’m referring to which helps me understand the meaning of the equation:

image

Consider this Stokes-Navier equation which is given as the prototype in the mathwork manual with good explaination:
image

Now consider this Stokes-Navier Equation which is given as the prototype in the pdetool with notations which are somewhat different:

image

Now I have to create an equivalency to match the coefficients. I’m guessing that it’s as follows:
rho = d = density of blood
mu = c = viscosity of blood
The controversy is about a and f. Going by the signs of the terms, the pde toolbox help document and the ppt that I’m referring to, I guess,
p = a = pressure and
f = f = other forces

Now, hoping that these assumptions are correct, I’ve got to substitute the values of these constants. These values are, unfortunately not given in the paper, so I will have to borrow from google, possibly, wikipedia.
Taking, d = 1060 kg/m3, c = \mu = (3 \sim 4) \cdot 10^{-3} \, Pa \cdot s(from wikipedia), a will be the time varying mean arterial input pressure, f I think we’ll consider as 1(not sure).

Just figured out how to apply the elasticity to the generated Cross Section of the vessel.

With the Cross section and  space coordinate equations, we can find out a value S of the cross section. Now, as per the formula given in the base paper, we have,

image

This equation defines elasticity as the steady cross section value, divided by the product of blood density and change in the cross section due to pressure. Now consider the following:

2012-11-17 01.54.35

Here, as we know, S becomes the input, we have to have a module for calculation of c2.
From here I realise that I have solved the problem of Elasticity application to vessels.
Then, there was this problem about finding the mean pressure.. well just realized how much a of a fool I am to think that pressure in an artery can come from two directions!! Haha.. So, this problem will come only at the placenta. But there too, we have a division as maternal side of the placenta, and the fetal side of the placenta, so, nowhere we will have to encounter a scenario where we will have to calculate the ‘mean’ pressure! HA! Such a fool! Shi.

So now that I have figured out almost the entire deal I am at peace. Aaah! This feels great! There’s a time for everything. Jab jab jo jo hona hai, tab tab so, so, hota hai. Smile Happy!! So, Again! I’ll do all of this tomorrow!!

Now what remains is the thinking up that I have to do regarding the bifurcations.. There is nothing about the bifurcations that is mentioned in the paper! Only the geometrical dimentions are given! What the hell is that all about? I guess, it should be treated in the same way as the arterial segments, but the only difference is that, there are two different values of cross sections at the second end. yoyo! Very happy and relieved! Everything has its own time!

ATB!

Wednesday 14 November 2012

Serious Glitches..! Worried Now..

11:36 pm

Have been trying to avoid it, but that's going to be dangerous, gotto face it, and find a way out! Not run away! So here we go!

After reading the "Model of the Main Arterial Tree" part from the paper very carefully I have realised the following things:

The model is based on, firstly, the Mass Conservation Equation given by,

image

where,

 v is the mean blood flow velocity

S is the arterial cross-section

z is the distance from the aortic valve along the arterial tree

psi is a function describin outflow from the small arteries which are not geometrically depicted

They have mentioned in the paper that they’ve solved this equation using the method of characteristics. Studied it with the help of this video and tried to solve my equation in the following way: (hope it is all understandable)

2012-11-14 23.50.14

As you can see, I encounter many problems while trying to solve the mass conservation equation.

Firstly, I do not know if v is a variable which is dependent on the value of z or not. Thinking about it, we realize that the velocity does actually change depending on its distance away from the heart. But that happens only due to the change in pressure with distance which we rae going to accommodate for. If we include this dependence, the equation becomes difficult to be solved using the method of characteristics. Saying this, coz I tried doing that as shown below:

2012-11-15 00.11.15

Thus, I decided to assume it independent of z, and continued as shown in the first image.

Secondly, knowing that v is the mean velocity, we try to understand the meaning of the word mean velocity. Considering the fact that in the paper, they have mentioned that the objective of using this method is to be able to compute blood velocity and pressure at any point in the arterial tree as the contribution of the incident and reflected velocity and pressure. Which implies that, by mean velocity, they mean, the resultant of velocity and pressure from maternal side and the fetal side. This makes us think that the v mentioned, needs to be the input to the simulink block that will solve the mass conservation equation, and before entering this block, there needs to exist a simulink block that will calculate this mean velocity. At whichever point in the arterial tree we  need to check the velocity or pressure, we need to do the calculation for that part.

This conclusion gives rise to a controversy. Is this input velocity the same that will be shown as the output velocity? Cannot accurately answer this question right now, coz we haven’t come to that point in the process still, but all that I can guess right now, is that, this input velocity will be acted upon by the mass conservation equation, then the stokes navier equation etc. and get modified. Coming to think of it now, I feel that the input to the system is this mean velocity, but the output might be the pressure wave. This might be needed to be converted into velocity somehow, since none of the equations in this part give velocity as the output.<== Problem

Going into the depth of the above mentioned problem, now we need to

  1. Figure out how to calculate the mean velocity
  2. Find the expression that describes the relation between velocity and pressure of an incompressible fluid.

Once the mean velocity calculation problem is solved, we need to know how to incorporate this into the mass conservation equation, and design a simulink block that implements the mass conservation equation.

So now, let us talk about this solution of the mass conservation equation, In the equation, they have mentioned psi, whose value hasn’t been mentioned anywhere in the paper. Need to ask what value to input as PSI. Assuming currently that it is zero, I move ahead. As shown in the first image, this gives the solution as

S= f(zo)=f(z-vt)

This equation says that the cross sectional area for the curve represented by z-vt = zo is given by the function which is the initial condition at t=0 for that curve.

For all arterial segment we have been given the length of the segment and the cross sectional area at its 2 ends. The table is as follows:

image

Now as the solution the cross section needs to be a function of z-vt. What function? As the tutorial video suggests, this function is the initial condition given. What is the initial condition given to us? These are just numbers. Thus we need to form relationships, preferably, linear from the given values of cross sections and length. To do this, I used curve fitting tool from MATLAB. Here’s the video of how I did it. Sorry for the delay between video and audio, and the overall bad quality.

Okay, the video refuses to get uploaded, sorry! Here are the equations that I got:

For Arterial segment 2,    image

For Arterial segment 3,    image

For Arterial segment 4,   image

For all the above expressions, y is the respective Cross section and x is the respective position coordinate.

For arterial segment 1 and arterial segment 5, the cross section remains constant. That is it does not change for any value of length. Thus the initial value remains the same for all space coordinates.

Now that we have a relationship that describes the initial condition and relates cross section with the z coordinates, we need to figure out how to incorporate the value of z into the initial condition and how to incorporate the initial condition into the solution.

For each of the above x, we substitute z- vt where z is the distance from the aortic valve along the arterial tree to the beginning / end (?) of the arterial segment, v is the computed mean velocity and t is the simulation time. So now, we have got the logic for doing a part of the Arterial segments modeling.

After this, is the block that computes the arterial vascular elasticity and incorporates that into the model. This part is given as follows:

image

So, c1(p) is a polynomial block, and c2(z) is a waveform to be approximated. these can be implemented on SIMULINK.

All this to be implemented on MATLAB and have to think about the mean velocity block, tomorrow!

ATB!

Saturday 10 November 2012

Hello World!

04:43 pm

Trying to work on the project, but my cousin sister keeps disturbing me.. Making aweful noises in my ear.. Cheh.. But hey!! It’s fun!!

Trying out Windows Writer for the first time.. Let’s see how this goes!

Yo!! ATB!

Edit1: My sis angry! So, … Credit of the Writer Discovery to her!!! Maskaa!!

Monday 5 November 2012

Modeling the Feto-Maternal Circulation Arterial Tree

07:52 pm

Last 2 Sundays have been spent in preparing the rough sketch of discrete parts of the model. To begin with, I divided the model into:
1. Fetal Heart (Pressure Source 1)
2. Maternal Uterine Arteries (Pressure Source 2)

3. Peripheral areas:
(PA.1) Brain
(PA.2) Kidneys
(PA.3) Peripherals at Primitive Iliac Artery Bifurcation
(PA.4) Peripherals at External Iliac Artery Bifurcation
(PA.5) Peripherals at Internal Iliac Artery Bifurcation

4. Arterial Segments:
(Seg.1) Ascending Aorta (Ductus Arteriosus)
(Seg.2) Thoracic Aorta
(Seg.3) Abdominal Aorta
(Seg.4) Primitive Iliac Artery
(Seg.5) Internal Iliac Artery
(Seg.6) Umbilical Arteries
(Seg.7) Uterine Arteries

5. Bifurcations:
(Bif.1) Cerebral Arteries
(Bif.2). Renal Arteries
(Bif.3) Primitive Iliac Arteries
(Bif.4) External Iliac Arteries
(Bif.5) Internal Iliac Arteries

6. Placenta on the fetal side of the feto-maternal circulation

7. Placenta on the maternal side of the feto-maternal circulation

1. Modeling of the fetal heart:

Fetal Heart parameters, ventricular pressure and ventricular volume follow the relation,

p(t) = E(t)[V(t) - V0]
where,
p(t) => ventricular pressure in mmHg
V(t) => ventricular volume in ml
V0 => Reference Volume
E(t) => Ventricle Elastance

In this relation, p(t) and V(t) are unknowns. Thus, I had to create a pressure wave that approximates the one given in the paper. I used the following values:
time axis => [0, 0.049, 0.054, 0.059, 0.07, 0.08, 0.1, 0.149, 0.173, 0.198, 0.208, 0.217, 0.225, 0.251, 0.4]
pressure axis => [0, 0, 1.09, 1.49, 1.79, 1.93, 1.99, 1.99164, 2, 1.96, 1.9, 1.82, 1.65, 0, 0]

To find E(t), there exists an equation

E(t) = Emax En(t)

where En(t) = 5.412t^6 - 20.066t^5 + 25.542t^4 - 13.71t^3 + 2.714t^2 + 1.08t + 0.029
Here t is taken as the simulation time. Thus, to create the block, now we need to have the values of Emax and V0.

After the analysis of fetal lamb and dog heart and approximately equating it to human fetus, we obtain, Emax = 6 mmHg per ml and V0 = -8ml.

Error: The output produced shows pulsetile increase in pressure, but it does not reduce to the baseline!

2. Modeling of the maternal uterine arteries:



I approximated the above shown waveform which was the only information provided about the uterine pressure. The values that I used are:

Pressure values => [78, 77, 78, 80, 90, 100, 110, 118, 122, 130, 131, 130, 122, 118, 112, 108, 103, 100, 90, 87, 84, 82, 84, 84, 80, 79, 78]
Time Values => [0, 0.05, 0.1, 0.12, 0.14, 0.16, 0.18, 0.2, 0.22, 0.24, 0.25, 0.26, 0.28, 0.3, 0.32, 0.34, 0.36, ,0.38, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8]

3. Peripheral Areas
Q(t) = {[p(t) - pc] / R} + {C dp(t)/dt}

where
Q(t) => Blood flow
R => Resistance of PA
C => Compliance of PA
pc => Critical Pressure of PA


With the above mentioned values from the paper and the equation mentioned, I created the PA basic subsystem in Simulink as shown:


and varied the pc, R, and C values for every PA.

Arterial Segments and Bifurcations : Main arterial tree
1. In the paper that we are referring to, they have specified the geometrical parameters on the fetal side of feto-maternal arterial tree for each of the segment and bifurcation for fetus at term. BUT, In reference to the blood flow in these segments they have NOT given any values for the parameters like
  • the density of blood 
  • viscosity 
which are necessary in the formation of the Navier-Stokes equation. This equation, together with mass and momentum conservation equationsform the constitutive equations of the model.
Suggested Solution: We could use values from any other reference.

2. This highly mathematical part of the model in the paper, which requires the solution to the Navier - Stokes Equation as solved using Method of Characteristics, has not been provided.
Suggested Solution: We could use the pdetool in MATLAB to solve the Navier- Stokes Equation for incompressible fluid. For this, I found this attached document on the internet. Asked my External Guide to go through it and see if we could use it, He happily showed the green signal. Now gotta move onto the next question.
Since we see that in the above mentioned paper, twhy use the PDETool, to solve the fluid flow equations, and I am using Simulink, I need to somehow interface these two. For this I just found this paper very useful.It gives an example in which they have attempted an interface between, Simulink and PDETool. Will be studying and implementing the model from these sources!

ATB!

Monday 29 October 2012

Mathematical modeling, glitches expected

05:35pm

Yes, I am back after a long,.. long tiime! Yes, been bus, No, not studies.., watching movies.. :) Not really though. Internal tests were there. Had to take a break from project work. So here we begin again. Discussed various models with the External Guide, and finally came up with this paper as the most ideal one.

Here's the jist of what was discussed on the last callcon with my External Guide:


The selected model is an ideal model because:
  1. It simple.
  2. Model parameter values have been provided.
  3. It not only talks about feto-placental circulation, but gives circulation in other important arteries like cerebral artery.


Short Timeline:
  • By 2 weeks, that is, till Diwali, the simulation of this model on Simulink should be ready for review by the External Guide.
  • If the model gives results that match the ones given in the paper, for a normal lady, then pathological cases could be taken up.
  • This could be then presented to the ethical committee, and approved for collection of data for abnormal patients.
  • Parallely, could think about writing a paper. 
    • How we are going to present this topic?
    • Which conference to select? (Preference: International, IEEE conference)

PS: The experimental setup that the HOD was talking about should not be necessary anymore.

Monday 15 October 2012

Electrical model for Doppler Waveforms of Utero-Placental Blood Flow

08:40pm

The plan today is to study this particular model that my external guide sent me, and check if it is a good model to be implemented. The paper that I'm studying is, Effect of non-linearity in predicting doppler waveforms through a novel model

Ah.. I don't know how to say things about this model. lost. Have to concentrate and read it part by part at least thrice, to be thorough with it. Also, since the paper uses previously developed and an inaccessible transition line model, I need to study both these models in order to really understand the paper. Will edit the post from time to time as I progress over the paper. Right now although I'm having a feeling that this si the paper that I'm going to follow, I cant be sure, until I've gone through the rest of them. Neither should I waste my time in thoroughly studying a paper that I'm not 100% sure of using. So, now that I've got a hint of the paper, I think I should move onto the next.

ATB!

Saturday 13 October 2012

The Review Effect: Papers & Models!!

09:50 am

Yes, back after a big gap! Not healthy. Was busy with reviews, which I consider are a waste of time. Lost out on 4 days worth of project work or Image processing studies. Upset, but can't help, gotta move on.

Alright, so the last time, my external guide, and me, had a discussion, we decided on having a computer simulated model for utero-placental, or umbilical artery, or middle cerebral artery. He suggested something new, quite exciting. Instead of modeling the blood flow physically, we could model it electrically. He even sent me a model that he found on www.biomedical-engineering-online.comNice website,.. so much of information available. Wish I had more time to go through this.

A thing that excited me the most of the use of an electrical model. This excited me not at the time that he explained the model to me, but after the reviews took place. Because in the reviews I realised what the ethical committee considers important and authentic for the publication of a paper. Advantage of using an electrical model is that on one hand we could implement its hardware and obtain the output, on the other hand we could simulate the model on simulink and obtain the output. Match both the outputs and check if they are anywhere close to the actual physiological output. If all these match we will end up with a good authentic model.

Now, we have realized that we need to create a utero-placental circulation model whose output needs to be a velocity profile of blood flow vr, as given out by the doppler signal of the ultrasound machine's doppler mode, so that I can then use it according to the following relation,

fD = (2 f vr cosq )/c
to generate fD which can be used in matlab to generate an audio output. This will then, be varied under various circumstances, to obtain a database to train my Artificial Intelligence module.

Need to search for papers that describe various utero-placental models predicting the doppler waveforms.

Other than that, a paper referred as, A transmission line modelling approach to the interpretation of uterine Doppler waveforms. also seems nice, which is the base paper for the previous one. So, basically the same concept. 


Then there's Markov Based Mathematical Model of Blood FlowPattern in Fetal Circulatory System. I'll have to search for at least 2-3 more before going to studying the models that are available to view.

ATB!

Sunday 7 October 2012

Promising Optimistic Discussion, Heavy Dreams!

12:15pm

Had a very calm cool, and constructive discussion with my exter nal guide yesterday. Felt good that he did appreciate the model that I had suggested. Guessing he just read it. Hmm.. But we talked and found out a good way to solve this problem. Have formed the minutes of the meeting as always, to really understand in short, what he wants me to do. Here they are: 


Discussion About Various Ways To Simulate The Blood Flow

The ‘Timing the delivery of preterm fetus_A case study based on computer simulations’ paper gave a good model. It's sort of a neural network where you build the model using patient data. Then you know what is the input and you know what is the output. Then you build a neural network and give a test sample, as an input and then your output would be something that the model would throw up as the solution. But the problem is the validation of the interpretation of the acquired patient data, since it is always subjective.

Using Simulink model is a good idea. Simulink is basically blocks available on various functions on the on the in the MATLAB program. But,we need to enter a model into Simulink. Also we need to be sure that the model is a good model, in order to build it. One solution can be that, we could contact, the people who wrote ‘Timing the delivery of preterm fetus : A case study based on computer simulations ’ and see if they are ready to give that patient data or that model itself.

There are, also, electrical models of blood flow. You can build an electrical model for blood flow, and model the flow as electric current. Depending on the diameter of the vessel you can arrive at the resistance of the vessel, the capacitance is basically the elasticity of the vessel, that tells how much the vessel is going to be pulsatile.

Rough Project Plan

If we do a some kind of a literature survey, we should arrive at at least 3 or 4 models, and we can chose one of them with a good reason, like e.g., the way the validation is done. In our first chapter then, we may have to list down various models that we have analyzed and why we chose the model. It would be nice to use a model already validated by someone and simulate it using Simulink.

Then you try out changes in some of the parameters, and see how the flow behaves. On this, we can apply some kind of an algorithm and demonstrate that the signal processing technique can identify such flows. e.g., we could simulate a flow whose resistance changes with time, the changing the flow behavior. We can pick it up, using the signal processing algorithm. This could then show that it can be a very useful technique which can be used in actual ultrasound machines. And using those simulations and results we can approach any hospital.

Thus, we can have a firm grounding to show the ethical committee the experiments that we have done on our computer simulations. They and the patients too can check it up, and decide if they could share their data. This makes a logical sense.

Short Timeline

14th October 2012: Identify all the models we can and talk about the different models we have.

21st October 2012: Fix on a particular model based on how they have validated it etc. with a logical reason.

At the same time, we can study and start building the various scenarios that we want to simulate using Simulink, because then we can start planning on which algorithm you will chose in a particular scenario.


So now, my trouble is that, I have so many things at hand.
1) Search for at least a model per day
2) Prepare for Project Review
3) Image Processing Study, coz he is really demanding.

Today's plan is, Image processing till evening, and Project Review at night.

ATB!

Saturday 6 October 2012

Least Excited and Bothered : State of Mind

10:32am

11 is the call time, and here I am, still not prepared with the points of convo. Hmm.

Today's agenda, 
i)  Advantages and disadvantages Experimentation Investigation vs Computer Simulation
ii) Whether Simulink will be an okay software to work with.

Second point depends on his yes or no. I might have a few things to say about the 1st point.

Experimental Investigation:

No substitute for experimentation, because seeing is believing. Having said that, there are limitations to experimental Investigation.
Full scale: 
1) Expensive and often difficult
2) Measurement errors
Scaled Model:
1) Keeping the flow physics the same is difficult. Thus need for compromise.
2) Difficult to extrapolate results
Overall: 
1) Numerous variables involved. Keeping track of all, difficult.
2) Maintaining various boundary conditions is difficult, this gives rise to uncertainties.
3) More of hit-n-miss, So time consuming.

Computer Simulation/Modelling:

1) Cheaper
2) Once a flow is simulated varying variables, recording the result is easy, 
3) Output can be converted into sound in MATLAB.
4) Can handle any degree of difficulty
5) Can repeat any number of times.
6) Will ever be away from the model.

Just received a message from him. "Am driving. We shall talk at 12 noon". Hmmph.. 

ATB!

Wednesday 3 October 2012

Finally Understood What He Wants

05:47pm

Alright. I now realise, that his aim of asking me all of these questions is that, he doesn't want to use patient data. And the reason for not using the patient data is that, the interpretation of data is subjective. Cannot validate it, since the interpretation differs from doctor to doctor, and hence, it is difficult to defend thee thesis in front of the ethical committee.

Phew.

So, alright, we can still create a normal fluid flow model using computer simulation! No validation needed for that. Everything becomes even easier. Alright. Mailing doc this.

ATB!

Editing the post.

So, I've realized that he doesn't want to use patient data, means he first wants to try it out on simple pulsatile flow of fluid. Now, I want to avoid going to IIT-B. So I prefer computer simulation of this fluid flow. Found out that the PDE toolbox in MATLAB helps using partial differentiation equation and the pdetool to simulate the fluid flow. But, I need a pulsatile fluid flow! <= Prob No. 1 !

Even if I'm able to find a pulsatile fluid flow code, and create it, I'm going to have to represent the flow in terms of velocity, and then convert the velocity profile of the fluid flow into audio. for further signal processing.<= Prob No. 2 !

All this feels very overwhelming. Because, for computer simulation, I need to know the equations governing the fluid flow, sheer stress, strain.. and lot of physics. It does make me feel that doing it in practice would be better than simulating it. But go to think about it, I will have to know the physics even if I want to do it in practice! Additionally, many factors would be clearly in much better control without any mess if I use computer simulation, rather than practical.

So, things to do:

1) Study pde tool.
2) Find a way to model pulsatile fluid flow.
3) Study the necessary fluidics.

ATB!

Tuesday 2 October 2012

And Worst, a Mocked Reply.

10:17am 


Hello Purti,

By validation I mean, if the’ one Dr. says the patient is suffering from X ‘
-          How do we validate this ?
-          J



I'm quite sure, he is frustrated on the other side, because you can clearly see in this mail, that he's mocking me. With the "Hello Purti" , which he'd never written before, and the unnecessary bullets, with the same question, and a smily on the second bullet. It's as if he's telling me "Okay, here, I'll speak in your language, I'll come down to YOUR level, for you to REALLY understand what I'm saying." 

Also, I don't understand if this is a genuine question that he's asking me? Or trying to take me to an answer he already knows? I mean, if this question was asked on the phone, I would've sensed the tone and answered it. I feel it's the latter alternative. If that was asked on the phone, I'm quite sure, I would have kept quiet.

And again, just for the sake of testing if he really goes through my mail, I had asked him when we should have out next telephonic conversation, at the very end of the mail. He hasn't answered the question. That again proves that he doesn't read the mail.

This is the result of the airport telephone conversation. That's all.

If this is true, and I think it is, okay, I need to think this through. 

My priority: No spoiling relations, since project is of prime importance

Realisation: He doesn't WANT to understand me. And believes I don't understand him.

Cure: He needs to understand my side of the project. And realise that it's easier than his. I can't make it clearer in writing. I've tried my best with that in the mail. Now, the only thing is, I get away from this. Give him time. Just let him try doing it his way, and go a little further than what he's thinking right now.

Solution: "Take out the negativity from your life, lead your life the positive way." My External guide is the negativity I want to stay away from. I'll go ahead with what I'm doing. And just for the sake of formality I'll talk to I thik Shrinivas about how I can contact the authorities from IIT-B so I can access their LAB.

Some kind of burning I can feel in my stomach and chest. Physically! Heart's racing. Ughgh.

Finally a Reply, with a Monotonous Negativity

08:30 pm

My External Guide replied to the Inverse Modelling Computer Simulation suggestion mail that I'd sent him. To this, he replied saying:


"I have been thinking. Let us discuss soon Purti.
My apprehensions:
·         Getting patient data without initially doing lab tests. How do we convince the ethical committee?
·         Interpretation of the data. Can this have any biases ? Who will validate this?"


Well, it seems to me that he still thinks neither have I understood the project, nor him. Can totally notice how vaguely he's mentioned his apprehensions! He's been telling the same thing to me again and again and again. So fed up! How do I explain it to him? Alright, I've gotta be polite, give him the benefit of doubt. May be he's right and I'm not understanding what he's saying. Thus I decide to approach his questions objectively. The only thing I can do now, for him to really understand me, is to compare my way and his way, outright, and then answer his questions. Also, begin the mail with, 'These are my views, correct me if I'm wrong.' Another thing that I have noticed is that, he doesn't read!! So, need to express everything in diagrams, in the form of points, easy and precise language, in short. Well, here we go!

Hello sir, 

Would be happy to discuss the concerns raised. Here are my views:

Getting patient data without initially doing lab tests. How do we convince the ethical committee?
=> As the model suggested is derived from the paper, I suggest using the paper as the "Base Paper" and using the same data that is given in the paper. This way, the ethical committee will approve the results for a correctly duplicated model.

Interpretation of the data. Can this have any biases ? Who will validate this?
=> The original interpretation of the Patient Data has also been mentioned in the paper. Thus validating it.

Also the below is my understanding and concerns. Kindly correct me if I'm wrong.

Block Diagram of the System:



Area of concern: Simulation of Flow
Prime aim of simulation: Validating the signal processing involved. 
Validation: The simulated condition on flow must match output of signal processing system

Primary suggestion: 
i) Emulate the flow in a lab using a setup that it resembles the actual physiological pulsatile flow in an artery. 
ii) Apply various physiological scenarios on the model.

Steps:

1) Formulate a initial rough setup
Discussed: 
a) Pump and fluid with necessary to create a flow, 
b) A pipe to emulate either MCA or UA, 
c) Ultrasound doppler flowmeter

2) Check availability of equipment
Discussed: 
i)  Prof. V. K. Joseph informed that neither GEC-ETC, nor GEC-Mechanical Dept. owns an ultrasound flowmeter; 
ii) Checked IIT-B Mechanical Dept. Laboratory facilities online, http://www.me.iitb.ac.in/me/labs.php , it mentions "Fluid Mechanics and Fluid Power" Lab, which is supervised by, 
       a) Mr. Prakash, Sr.Tech.Superintendent)

       b) Mr.C.V Jakka(Sr.Mechanic)
       c) Mr. Gajendra Kumar(Jr. Tech. Superintendent)

iii) Must discuss the matter with HOD sir to contact the above mentioned to check for availability and ask for permission to access the equipment if available. 

3) Study of requirements and working of equipment for initial set up

Concerns: 
Doppler Ultrasound Flowmeter:
a) Does it give an audio output
b) Does it have an audio output Recording Capability?

Pipe: 
a) Size requirement: According to size of artery (UA or MCA)? or according to availability? 
b) Does the opted alternative correctly represent the artery? i.e. Flowmeters require straight pipes; arteries are almost never straight. Thus, validity of the model? 
Can be ignored for a basic setup.

Fluid Flow:
a) Need Pulsatile flow for Doppler output. No doppler audio output if no pulses.

Variable Scenarios that can be created:
a) Pressure change
b) Velocity change
c) change in the number of particals that reflect sound.

(The above will affect the audio. 
What then, is the objective of signal processing system? 
To detect the changes in velocity, pressure, no. of particals? Or just that it is not the standard audio?)

4) Design setup and experiment according to the availability.
a) Create a simple pulsatile flow, measure with flowmeter, record audio output<== Standard for comparison.
b) Apply various scenarios, record.

The Effing mail is sent! Don't ever want to look at it again!

Breakthrough, My Way!

01:15 pm

A productive, constructive morning today, must say! After the taking decision the hard way yesterday, I decided to plunge into the concept of Genetic Algorithm. My brain works this way: I first need to know the framework, i.e. the structure of the project, then I can dive into its details. So decided on trying to understand what is Genetic Algorithm, what are its inputs and outputs, how it can be applied in my case, how can I perform it using MATLAB. Get the material, study, try out, if successful, implement.

After surfing through a lot of online material, understood the necessary concepts of Genetic Algorithm. Then, applied it to my case. Until my external guide tells me anything, I'm thinking of taking the same database that is used in this paper. At this stage I'd like to specify the picture that my brain has created of my case scenario, before I forget it, else it'll have to waste time doing it again another day. 

The aim is to replicate the fetal-placental blood flow using three variables:
1)The Placental Resistance
2)The Brain Resistance
3)The Fetal Heart Rate

The database consists of 8 readings ranging from the normal stage to the stage when subject goes into compensatory, i.e. abnormal, detectable, phase. Each of this reading is a result of linear combinations of the three variables, multiplied to different coefficients. Bu using Genetic Algorithm, we have to find the value of these variables that represents the basic value of these three variables, which gets multiplied by coefficients, to create different readings.

The fact that should be considered is that, it is normal for these conditions to vary over time. Thus, the variables also change over time, and it is normal! The Genetic Algorithm doesn't know that! It'll think the value of variables has to remain constant the entire time, which is not true! So, we make a change in the perception of the variables. We make them constant so that the Genetic Algorithm can function properly. How do we do it? We find the normal values of the reading at those particular gestational ages, and divide our readings with the normal values. As a result, our readings now change to some absolute values, whose variables should remain constant over the time! 

After this I moved onto understanding if I have the necessary toolbox to execute the algorithm. Was pleasantly surprised to see, that there exists a software tool.. readily available in MATLAB R2010a in which I only need to select the operation that I need to perform from drop-down box, enter the the data that should be modeled .. And that's it!! I DO need to look through it still, but I'm so happy right now! Had a fruitful morning!! Yeay! Now for lunch!

ATB!

Monday 1 October 2012

Finding a Way, and Taking a Stand

08:00 pm

A delay.. In fact it's been a very very long delay since I last blogged. I Apologize(to myself). 

What kept me away is a certain kind of repulsion,.. a kind of detachment that I developed from my project. The reason was my external guide. The 2nd Sunday conversation with him was horrible. As I had written down on the blog, I had decided I was going to ask him certain questions so that I was sure of the basics, .. the framework fundamentals of the project. But as I realized that he was busy that day, and would call for 'project discussion' from the airport, I realized I didn't have enough time. Didn't want to take the risk of not having the answers to the questions, so decided to ask the questions right away, as soon as the conversation started.

Did that. To my surprise, he took it as me not knowing anything about the project!!! He asked me if I knew what 'Ultrasound' was; for crying out loud! He said 'I can't go to such a low level'. That hurt me big time.

Not going to talk much about that incident, because it only brings back bad memories. But as the conversation went on, I hope he realized that I knew something as we discussed about the simulation part. What I got as answers from that phone conversation was only that, I had to send him the papers, he'll look through it, and call me in 1 or 2 days to tell me if it was okay to continue with computer simulations. 

Needless to say, firstly from his thinking that 'I do not know anything', and secondly from his not calling on Monday or Tuesday after the 2nd Sunday call, means that he hasn't gone through the progress mails or the attachment mails that I've sent him so far. Disappointed in him. really! 

Anyway,.. since I got no response from him and had to find out about the mechanical simulation facility availability, went and met up with my internal guide. After a good 15 minutes discussion, we came to a conclusion that, computer simulation was much more controllable, and trustworthy, and moreover, easier, and time-saving compared to the method as suggested by my external guide. Same is the feeling here. As the 3rd Sunday approached, I decided to enroll myself into the Image and video processing workshop in GEC, to get a hang of MATLAB, which I did. For this, I had to miss the 3rd Sunday discussion. I intimated my external guide about it. He didn't reply with the rescheduling date. Thought it might be too nagging of me to reply again asking for a phone discussion appointment. So didn't, hoping he would call me sometime next day or so. Well, no surprises here, he didn't. So, messaged him today this :" Sir, hope you had a look at the paper I mailed you. Should I proceed with the computer simulation work?" To which he replied, "Let us discuss first :)"

I disagree on waiting for his decision to come, I decide on continuing. 

ATB!

Friday 21 September 2012

Communicating the Doubts to my External Guide

11:07 pm

1) What is the expected input to the project?
2) What is the expected output from the project?
3) The problems with the solution to the data acquisition problem. solution?
4) My suggestion : ASP inverse problem
5) advantages, and paper to be referred.

Don't have an idea about how the conversation regarding first 2 questions will go, but here's my argument to defend my proposal.

3) Are we looking at real life scale replication model of the umbilical or middle cerebral artery flow? 
If so, according to this paper the mean umbilical artery diameter is always less than or equal to 4 mm, and according to this paper mean middle cerebral artery diameter is 0.83 mm around the 32nd gestational week when we usually do the Umbilical Artery or the Middle Cerebral Artery Ultrasound. The most feasible diameter is then Umbilical artery, 4 mm diameter pipe.

According to this, a pulsatile flow pump and a ultrasonic doppler flow meter should be available. According to this catalog the, the flowmeter can support a syringe of a minimum of 177.8 mm. Is it the right paper I should be looking at? I've got no idea. My external guide didn't mention anything about the pump. All he talked about was the the ultrasound doppler flowmeter.
Thus, according to these specifications the ultrasound doppler flowmeter supports pipe with the diameter of minimum 20 mm.

----> So we see that, real life scale replication of even the Umbilical Artery isn't possible!

Thus if we have to do this, we have change the scale of everything. Doesn't that invalidate the entire motive? Solution?

4) Even if the above argument is not convincing enough, I feel the need to propose another model which can simulate the fetal-Placental artery system.

This is a computer simulation based on Inverse Modelling. In inverse modeling, the model is a black box with unknown characteristic values. Given a set of outputs, the task is to identify these unknown characteristic values that produce outputs that match the given output to complete the model.
In our case the simulation output is the velocity profile of the blood or the blood flow. The inversion task is to identify the corresponding parameter values in the fetal-placental artery system to produce that blood flow.

Also, in our case, what affects the fetal-placental blood flow is :
i)   the values of the fetal heart rate,
ii)  the placental resistance
iii) the brain resistances

Based on the information, we can analyze the correlation between fetal heart rate and blood flow in the compensatory fetus.

Now, how do we find these characteristic values? We use the Genetic Algorithm. Genetic algorithm mimics the process of evolution. This is as follows :
i)   Start with a population of randomly generated individuals,
ii)  Find the fitness of all the individuals in this generation,
iii) Select multiple, say 2 individuals from this population with highest level of fitness
iv) Mutate them to form the next generation
v)  Repeat the process till satisfactory level of fitness has been reached.

Applying this to our case, the each characteristic represents the individual in the generation, then we define the fitness level, in terms of how close the values of the simulated output should be to the expected output. And thus we implement the algorithm using various techniques of mutation, or crossover, and repeat the process till the fitness level is reached.

The black box then represents our system.

This has been implemented before, and I have this paper (please refresh to download or view) for help. Additionally, the entire theory is easily available for study. And trustworthy.

Once we have established the characteristics of the system to get certain output, we can give it various input to generate fetal-placental flow with various conditions. This can become the input to another signal processing system which will classify it, and determine which condition exists. This will validate our signal processing system.

Ya? ATB!

Thursday 20 September 2012

Admitting the Doubt in Feasibility

10:20 am

So, The following are the points at which I'm feeling I have doubts.

1) Simulating the flow: We could used Adaptive signal processing techniques to create the same output that the placenta creates, from Gaussian noise. This paper helps us do that. Gotto study this paper as an alternative to the unnecessary extensive mechanical work on fluidics. But I'm guessing my external guide doesn't trust the signal processing techniques very much, so, I will have to be thorough with the paper before I even suggest him with this alternative. ATB!

2) Diameter of the pipe: The pipe that emulates the umbilical artery must be around 1.5 to 2 mm in diameter, whereas the one that emulates the middle cerebral can be around 3.5 mm in diameter, according to information I found on Google. Thus, based on the size constraints, emulating the middle cerebral artery is the better solution of the two. But that still is very small a size to simulate a pulsatile flow in.

3) Pulsatile flow pump: The only one pump that I found on the net was this. I'm not sure if this is the right one. Because this one is not for research purposes, it looks like it is for industrial, I mean practical use by the doctors during surgeries or so. Other articles I found were all papers which showed how to create a computer controlled flow pumps for pulsatile flow simulations. Asking my internal guide, then the HOD, and then the action plan decision is the agenda for next week.

4) Doppler / Ultrasound Flowmeter: In addition to giving me a tension that it is not audio that we are taking in as the imput, this also gives me a tension about are these available in the labs and are they available in the size of 3.5 mm? This Ultrasonic flowmeter manual suggests otherwise!

Overall, I'm still amazed at the minute feasibility percentage that I'm relying upon, and continuing with this project!

ATB!