ANA Projects List
ANA Projects List
Assume
a known 3D tubular structure, the prototype structure P(x,y,z)
The ability to get:
1 or 2 projections Pr(J, R, x, y, z) of this shape where J =1 or 2 and R is the plane
of the projection
N knots, i.e. Points in space {K(I, x, y, z)} where I = 1, 2, … N
Generate a model of the structure using the Pr(J, R) and the ensemble {K(I, x, y, z)}
-Cubic Spline interpolation function SF(x,y,z)
-Knots {K} and points on the projection Pr(J, R)
K(1, x, y, z)
Pr(1, R, x, y, z)
X
CSI-2
In this case, assume that you have an ensemble of points (K(J, x, y, z)) and you
know the projection of a segment of the the projection i.e. NOT the projection of the
entire length! Then
Find the minimum number of (K(J, x, y, z)) knots that are needed to generate the
original structure for different known segments
Generate a “moving window” on the structure and use the transient 2D projection of
this window and 3D knots to generate the structure
Length of moving Window (independent of shape)
Number of knots
Length of P(x,y,z)
Moving
window
P(x,y,z)
Interpolation Issues: Runge
This family of project will deal with Runge phenomenon that pertains to the
interpolation of equally spaced points and the errors secondary to this type of
distribution.
This is a very imporant phenomenon with consequences in sampling real data!
• Analyze the reasons for this phenomenon
• Relate to the Gibbs phenomenon (and Gibbs artifacts)
• Then, compare the equally spaced to Chebyshev points
Runge Phenomenon (Oscillations)
1 9th order
5th order polynomial
9th order 1 25x 2
selected observations”
Candès et. al. Reconstruction
Investigate the for an
appropriate data set,
compressed sensing has the
capability to perform a
"random" sub-Nyquist
sampling and still recover the
image to a large extent
without noticeable visual
artifacts.
floating-point arithmetic
Start with the very famous paper by David Goldberg “what every computer scientist
should know about floating-point arithmetic (1991)
Study the discussion of the IEEE standard (IEEE 754), and the analysis on the
floating-point arithmetic.
Fourrier Analysis
Implement Fourier analysis code on
PC
Smart-phone,
Code specifics:
Input:
1. Current Velocity and position
2. Path and Velocity profile
Output:
1. The generated setpoint
2. The calculated 3D Drive Function Grad_X(j), Grad_Y(j), Grad_Z(i)
3. Report and graph the specifics of the 3D Drive function: (1) first derivative, (2) second derivative along
each axis and the total vector
4. Errors
Controller architecture:
Equations:
Notes:
The position setpoint is generated by searching the point of the path that is closest to the actual
position.
The velocity setpoint Vc is the corresponding point on the velocity profile.
Code specifics:
A GUI that shows
Input:
1. A 3D Input function G= [Gx, Gy, Gz](j) NOTE: These are the gradients results
2. The GC
3. Size of effector scalar NOTE: magnetic properties and size of the MRBot
4. Motion Profile (an array V(j)) NOTE: Velocity Profile at each location
5. Environment Profile (an array F(j)) NOTE: The environmental forces profile at each location
6. Color based indicator of the distance from CG (Green everything is fine, red we are too slose
to the GC.
Output:
1. The responses of the 3D Input Function, Actual path of the MRbot and actual velocity profile
PhResp(j) ( = [X, Y, Z](j)) NOTE: This is the modeled path
2. The planned trajectory (path and velocity profile)
5. Errors of PhResp(j) vs PhTarget(j) for different MC/NC: MC = NC, MC = nNC n<1
Equations:
Newton’s second law
with M: magnetization of the sphere at saturation = 1.274e6 A/m for
iron
Cd=0.47 for a sphere
Response Man-in-the-Loop
Theme: Time domain visualization of object
Provided by Instructor: the inputs
Code specifics:
The GUI that shows in time domain in three windows (i) Object inside 3D corridor, (ii) transient
position of object in a cut through and (iii) current position on a 3D path
Input:
1. A target function, a vector PhTarget(j) ( = [X, Y, Z](j)) NOTE: This is our path
2. An executed function, a vector PhActual(j) ( = [X, Y, Z](j))
3. A 3D tubular structure InCG(j)
4. Time relationship of index and Dt
5. Smoothing degree SmD scalar
6. Size of object (OBJ) scalar
Output:
1. Smoothed 3D tubular structure (SmVG(j))
2. Error SmVG(j) vs InCG(j)
3. Out1: 3D scene with SmVG(j), PhTarget(j), PhActual(j), OBJ; based on Dt actuate it
4. Out 2: transient 2D orthogonal cut to the PhTarget(j), that shows the SmVG(j), PhTarget(j),
PhActual(j), OBJ
5. Out 3: 3D scene with PhTarget(j), PhActual(j) and OBJ as a sphere
6. Errors
Optimization of a Drive Function
Theme: Numerically Optimize the parameters of a controller. There will be 3 projects given based on:
1. Berzier Curves
2. Corridor Maps
3. Simulated Annealing
4. Splines-based
Provided by Instructor:
1) A 3D guidance corridor (VG; in STL format)
2) the cost function equation
Code specifics:
The GUI must show the progress of the optimization during its computation (current point, best
point, number of iterations).
The initial path to start optimziaiton will be the centerline of the 3D VG
Input:
1. The 3D virtual corridor (VG)
2. Desired path and velocity profile boundaries
Output:
1. Optimum controller parameters
2. Max errors, average error, min distance from VC, average distance from VG
3. Max gradient, max slew rate.
2D AND 3D Gradient and Directional Derivatives
Theme: Learn to extract derivatives and gradients of multidimensional functions, and compare them.
Specifically, numerically calculate the directional derivative of a function A and compare it to another function
B.
Teams: There are two versions of the project: a 2D for 1 student team and 3D for 2- to 3- student teams. There
are other combinations of teams, contact the instructor
Description: Function A in 3D is a function A(x. y, z). First implement the code to calculate the partial
derivatives along the three axes (directional derivation) dA/dx, dA/dy and dA/dz. Then calculate the vector
dA/dr (r is the unit vector along axis X, Y, Z).
Algorithm Input: function A(x,y)/A(x,y,z), B(x,y)/B(x,y,z), comapriason
Algorithm Output: the derivatives of A(x,y)/A(x,y,z), comparison of the value of derivatives of A(x,y)/A(x,y,z) vs
B(x,y)/B(x,y,z) on each axis, comparison of the vector of derivatives A(x,y)/A(x,y,z) vs the vector defined by the
B(x,y)/B(x,y,z) function
Provided by the instructor: A(x,y)/A(x,y,z), B(x,y)/B(x,y,z).
Figure below shows an example of how the vectors of the directional derivatives are shown and relate to the
function of the ellipses 4x^2+y^2=c, where c is a constant
Generation of 3D or 4D Corridors
Theme: Implement a numerical approach for 3D segmentation method and generation of rendered 3D and 4D
corridors. The segmentation will be based on the Region-Growing algorithm and renderings on meshing.
Interpolation will be needed at higher resolution than images requiring careful interpolation so the mesh is
concervative in nature and does not collide or cross any structure.
Algorithm Input: Data D(x,y,z), Criterion C(i), Initialization I(x,y,z), k connectivity
Provided by the instructor: Pseudo algorithm of the desired method, Data D(x,y,z), various Criteria C(i),
Initialization I(x,y,z,j) and their associated Ground truth GT(x,y,z,i,j,k)
Data(x,y,z)
C(i)
PrX R(x,y,z,i,j,k)
I(x,y,z,j)
Figure 1: Overview of the code input/output. The output will be compared to GT to test the
correctness of the algorithm
Operator Selected Parameters & calculations:
1. 3D matrix: Input data D and initialization region I.
2. Function: Criterion C to apply to grow I using the data D. The function takes as input a set of value and
returns an interval of inclusion.
3. Scalar: k represents the connectivity of the morphological space and can have 3 values in 3D:
6: the voxels are considered neighbors if they have one face in common.
18: the voxels are neighbors if they have at least an edge in common.
26: the voxels are neighbors if they have at least a vertex in common.
Algorithm Output: The algorithm outputs the final stage R of the growing process as a binary 3D matrix, where
the Boolean represents the inclusion or not in the result. This result will be compared to the given ground truth
to ensure the process correctness
Algorithms: 3D morphological operations using a customable inclusion criterion
Algorithm pseudo-code:
Let R0 be the initial region, i.e. I.
While Rt is different than Rt-1 do:
o Let t+1 be the current step.
o Let V be the set of value of the voxels in Rt: V = {D(x,y,z) | Rt(x,y,z) is true}.
o Let A be the interval resulting of the call C(V).
o Let Rt+1 = Rt .
o For each k-connected neighbors (x,y,z) of the voxels in Rt, if D(x,y,z) is included in A, then
add (x,y,z) to Rt+1.
Return R, the last iteration of Rt.
Software Output: The software returns a region of k-connected region resulting the growth of an initial region I,
using an inclusion criterion C.
Figure 2: The input will be slices that have a gap between them. After segmentation the segmententation maps
will be used to fit a 3D mesh as shown in (A) and (B)
Studies:
Your code will be tested with two data sets provided by the instructor:
1. one will be a CINE MRI set of the beating heart (N slices each capturing the heart motion in M time
frames). Thus you will use your algorithm to segment NxM 2D slices. These will then be used to
generate a 4D of the segmentation map and a 4D mesh
2. the other will be a set of brain images that will eb sued to extract the vessels and a tumor generating a
3D segmentation map and 3D mesh
All data will be in DICOM and form the headers you can find their position in 3D space
Spline Interpolation and Error Estimation
Code specifics:
A GUI that shows Current Distributions, field, flux density and cut through projections on X, Y, Z.
Graphics tool allows interactively adjusting the distribution of the currents
Input:
1. The number of solenoids, their position and orientation
2. Size of the coils Size(j)
3. Cut through Size of distribution (rectangular) LX(J), Lz(J)
Output:
1. The field H (Hx, Hy, Hz)(i) and flux density B (Bx, By, Bz)(i)
2. Isosurfaces for an operator requested B value
1. Volume (as isosurfaces) with operator requested gradient (in ppm of Bcenter)
According to [1], the flux density produced by a circular current loop in all space is:
K(x) and E(x) are the complete elliptic integral of the first and second kind respectively.
[1]: Simple Analytic Expressions for the Magnetic Field of a Circular Current Loop, James Simpson, John
Lane, Christopher Immer, and Robert Youngquist, 2001.
Matlab implementation:
This function has been implemented into matlab.
[ B ] = Field_single_loop( M,I,a )
B: returned result. Vector containing each component of the magnetic flux density in the cylindrical coordinate
system [Br,Bθ,Bz], value are in Tesla.
M: Vector containing the coordinates of the calculation point in the cylindrical coordinate system. Values are in
meters.
A: radius of the current loop (meters)
I: current in the loop (in amps).
The cylindrical coil is discretized into currents loop. The magnetic field is calculated by summing the field
produced by each current loop. The previous function is used to calculate the flux density produced by the
current loops.
The flux density Bij produced by the current loop i,j at the calculation point M(Rm, θm, Zm) is:
Matlab implementation:
This function has been implemented into matlab:
[ B ] = Field_single_coil(M,Re,Ri,T,Itot )
B: returned result. Vector containing each component of the magnetic flux density in the cylindrical coordinate
system [Br,Bθ,Bz], value are in Tesla.
M: Vector containing the coordinates of the calculation point in the cylindrical coordinate system. Values are in
meters.
Re: External radius of the coil in meters.
Ri: Internal radius of the coil in meters.
T: thickness of the coil in meters.
Itot: Total current inside the coil, in amps. It is equal to the current in the electric wire multiplied by the number
of turns.
Study the following so you see how we treat 2 solenoids; your project will be for any arbitrary number of
coils
3/ Magnetic flux density produced by two cylindrical coils in all space
The field produced by two coils is calculated by summing the flux density produced by each coil. The two coils
axis are collinear to the z axis of the cylindrical coordinate system. The center of the coils are separated by d.
The flux density B produced by the two coils at the calculation point M(Rm, θm, Zm) is:
Matlab Implementation
This function has been implemented into matlab.
[ B ] = Field_two_coils( M,Re,Ri,T,d,Itot1,Itot2 )
B: returned result. Vector containing each component of the magnetic flux density in the cylindrical coordinate
system [Br,Bθ,Bz], value are in Tesla.
M: Vector containing the coordinates of the calculation point in the cylindrical coordinate system. Values are in
meters.
Re: External radius of the coil in meters.
Ri: Internal radius of the coil in meters.
T: thickness of the coil in meters.
d: distance between the center of the coils
Itot1: Total current inside the coil #1, in amps. It is equal to the current in the electric wire multiplied by the
number of turns.
Itot2: Total current inside the coil #2, in amps. It is equal to the current in the electric wire multiplied by the
number of turns.
Spline Interpolation and Error Estimation
2|Page
1 Introduction
Interpolation
In most of the scientific applications we only know a limited number of data which
represent the values of a function for a limited number of values of the independent
variable. So whenever we want to know the values at some unknown points we always
need to estimate the values of the function for some intermediate values of the
independent variable. This can be achieved using Curve fitting.
This can be done using various methods like
1. Piecewise constant interpolation
2. Linear interpolation
3. Polynomial interpolation
4. Spline interpolation.
B-Spline Interpolation
B-Splines find their applications in the construction of Rail Road Tracks, ships and
flights etc. In flight modeling and production, splines can be used to represent
machine tool cutter paths, engineering analysis and simulation, navigation and
guidance systems. For instance, we consider the navigation systems, the entire path of
the flight needs to be generated from a given set of locations (which can be considered
as “Control Points”) on the globe. Given the source and destination locations, we need
to generate a smooth plan that passes through the first and last control points, which
is where we bring the B-Splines into the scenario. The objective of this project is to
generate a smooth spline using the given set of control points.
Advantages of choosing this method over the other methods
B-Spline interpolation is very useful when compared to other parametric curves
because in case of other curves the order of the curve is fixed based on the number of
control points so as the number of control points increases the order of the curve
increases which makes it complicated to perform calculations. B-Spline curves
overcome this disadvantage.
For example if we are taking 4 control points then the degree of the polynomial that
we need to solve would be 4 and as we increase the number of control points this
degree increases making it more complicated. But using B-Spline curves we can even
control the degree of the polynomial that need to be generated.
3|Page
Moreover B-Spline curves also has the advantage of local propagation unlike global
propagation of other methods. In other interpolation methods as it is a global
propagation if there is a change in a single control point the shape of the complete
interpolant changes but in the case of B-Spline even though there is a change in a
single control point it only changes the segments which are related to this control point
and all other segments are not affected.
2 Process
The major steps involved in the Spline Fitting and Error Estimation are as mentioned
below:
1. Generating the Knot vector
2. Implementing the Deboor's Algorithm for B-Spline Interpolation
3. Sampling the points, to test the B-Spline Interpolation
4. Estimating the error between the original and test splines
Approach
The spline fitting involves capturing the user input which are referred to as Control
points Pi, then generating the Knot Vector t based on the order, k of the piecewise
segment of the B-Spline and the number of points, n. The knot vector is then used to
interpolate the user input by solving the Deboor’s recurrence formula r. The output
of the interpolation gives a set of points (which we term as “Ground truth”) stretched
between the first point and the last point, which are smoothed by the control points.
The order k determines how many control points effect each segment in the B-Spline.
By default, we have taken the value of k to be 3, since it solves global propagation
problem compared to other interpolation methods and maintains curvature
continuity, meaning that two curves joining at a point they go in the same direction
where they meet and also have same radius at that point and also slope continuity,
meaning that the two curves not only touch, but they do even go in the same direction
at the point where they touch.
3 B-Spline Interpolation
Given a set of points and the order of the segment, the first and last points control
only one segment within the B-Spline. Remaining points control the segments
depending upon the value of k.
4|Page
3.1 Knot Vector Generation
Once we obtain the n+1 control points P0, P1, P2,……, Pn and degree k, we can generate
a knot vector. For a B-Spline curve of degree k, we need m+1 knots where m=n+k+1.
Precisely, the first k knots are 0’s and the remaining knots would be in an incrementing
order till the (m-k)th knot and the last k knots will have the same value.
0 𝑖𝑓 𝑖 ≤ 𝑘
𝑡𝑖 = { 𝑖 − 𝑘 𝑖𝑓 𝑘 ≤ 𝑖 ≤ 𝑛
𝑛−𝑘+2 𝑖𝑓 𝑖 > 𝑛
Where k is the order of each of the piecewise polynomial segments that form the B-
Spline curve. A polynomial of degree 3 solves the problem of slope continuity and
curvature continuity, hence in our project we choose the k value to be 3. A polynomial
degree above 3, doesn’t have any signification change. The basis function for the B-
Spline is defined by the Knot-Sequence t. The basis function for a polynomial segment
of the order of k can be defined as below:
1, 𝑖𝑓 𝑡 𝜖 [𝑡𝑖 , 𝑡𝑖+1 ),
𝑁𝑖,1 (𝑡) = {
0, 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
and if k > 1,
5|Page
𝑡 − 𝑡𝑖 𝑡𝑖+𝑘 − 𝑡
𝑁𝑖,𝑘 (𝑡) = ( ) 𝑁𝑖,𝑘−1 (𝑡) + ( )𝑁 (𝑡)
𝑡𝑖+𝑘−1 − 𝑡𝑖 𝑡𝑖+𝑘 − 𝑡𝑖+1 𝑖+1,𝑘−1
Where t defines the Knot vector. By solving the equation r(t),we generate the data
points Di which form the spline and are controlled by the control points Pi.
4 Sampling Points
After generating the “Ground Truth” i.e., the data points Di, we do sampling to
select n control points to generate a new spline. These new set of control points will
be referred to as Si. We have used three different samples to analyze the
performance of the interpolation method we have implemented:
4.1 Left-Skewed: Choosing the control points such that, more points towards
the beginning of the curve and fewer points towards the ending of the curve.
4.2 Right-Skewed: Choosing the control points such that, fewer points towards
the beginning of the curve and more points towards the ending of the curve.
4.3 Uniformly-Distributed: Choosing the control points such that they are
uniformly distributed from the beginning to the ending of the curve.
5 Error Estimation
Once we have the test set of control points Si, we interpolate the sample using the knot
vector and deboor’s algorithm for spline interpolation. The interpolated points are
then plotted. The plot clearly shows the deviation of the test samples from the
“Ground Truth”. We then calculate the average error distance between the original
and the test sample curves. We have used Euclidean distance between each of the
points. The average of the sum of all the distances gives the amount of deviation. We
calculate the error using the below mentioned formula:
6|Page
Where n is the number of points in “Ground Truth” Di.
6 Tools
We have implemented the project in MATLAB. It provides a variety of tool bars
which enable for a better GUI and proper plotting in 3-D Co-ordinate system.
7 Algorithm
The spline fitting and error-estimation consists of the following steps:
i. Input a set of ‘n’ points and order ‘k’ for the piecewise polynomial
ii. Calculate the Knot Vector
iii. Generate the piecewise polynomial equation for each of the segments
between two control points using Deboor’s algorithm
iv. Generate the spline from the output set of points from spline
interpolation
v. Select a set of points from the spline satisfying the following three
conditions:
o Points sparse towards the beginning of the spline curve
o Points sparse towards the end of the spline curve
o Points equally distributed throughout the spline
vi. Interpolate the BSpline
vii. Estimate the error
7|Page
Block Diagram:
Points
Knot Vector B-Spline Sampling Error
User Input
Generation Interpolation and Estimation
Interpolation
8|Page
Fig 2: Manual method of input
8.1.2 GUI
For selecting the input points through GUI, we first display an empty X-Y axis and
select the x, y co-ordinates. Then in another plot we display the Y-Z axis and restrict
the selection of z, to only the corresponding y, z co-ordinates where y is from the
previous selection. Once you select a point in Y-Z plot, user should press enter to
confirm the selection. The below images show the two axes which are used for the
selection of x, y and z co-ordinates:
9|Page
Fig 4: Capturing the y, z co-ordinates
The output obtained by interpolating the above points is shown in the figure below:
10 | P a g e
Fig 5: Plot of the original spline and Sample Test Splines
The above image displays the original alpine and the test splines generated from
sampling the “Ground Truth”. The top-right corner of the image displays various
line formats used for each of the splines and also the corresponding average error
distance for the Left-Skewed, Right-Skewed and Uniformly Distributed samples.
The output obtained by interpolating the above points is shown in the figure below:
11 | P a g e
Fig 6: Plot of the original spline and Sample Test Splines
The above image displays the original alpine and the test splines generated from
sampling the “Ground Truth”. The top-right corner of the image displays various
line formats used for each of the splines and also the corresponding average error
distance for the Left-Skewed, Right-Skewed and Uniformly Distributed samples.
The output obtained by interpolating the above points is shown in the figure below:
12 | P a g e
Fig 7: Plot of the original spline and Sample Test Splines
The above image displays the original alpine and the test splines generated from
sampling the “Ground Truth”. The top-right corner of the image displays various
line formats used for each of the splines and also the corresponding average error
distance for the Left-Skewed, Right-Skewed and Uniformly Distributed samples.
8.3 Observations
From the above tests the following observations have been made regarding the
average error distance:
Dataset 1 Dataset 2 Dataset 3
Left-Skewed 13.7511 9.76 13.7193
Right-Skewed 16.5237 22.015 28.057
Uniformly-Distributed 8.2181 5.8713 7.607
The above table displays the corresponding average error distances calculated for the
test samples, generated from each of the datasets. From the above table, following
observations can be made:
The average error distance is less for the uniformly-distributed test sample in
all of the datasets.
The average error distance for left-skewed and right-skewed test samples
doesn’t follow any specific trend.
13 | P a g e
9 Challenges
Initially when we started with getting input from the user using a GUI we faced
issue with getting a 3D input from the user because so we finally decided with
getting the 3D input in two 2D planes like XY plane and YZ plane. For this
first we are asking user to select a point from the XY plane and once he
selects a point as we know the Y coordinates, in the YZ plane we are
restricting the user to this Y value and asking him to select some Z value.
10 Conclusions
From the above experimentations we can conclude that the number of points
and the distribution of these points affects the shape of the B-Spline
generated.
11 References
https://www.wikiwand.com/en/Interpolation
https://www.wikiwand.com/en/B-spline
http://www.geos.ed.ac.uk/~yliu23/docs/lect_spline.pdf
http://scholar.lib.vt.edu/theses/available/etd-04192001-172731/unrestricted/chapter_4.pdf
14 | P a g e
Appendix
Steps to execute the program:
i. Install MatLab version R2014a
ii. Load all the files in the FinalCode folder into MatLab
iii. Open the file start.m and click run
iv. Select the mode of input and capture the data points
v. The results will be displayed
15 | P a g e