Lab assignment L2

Non-Linear function estimation

For due dates see the calendar web page. For hand in details the lab main page.

Objective

To practice the use and implementation of overdetermined equation systems/model fitting (Heath Ch3, Ch7) though a practical application.

Procedure

340 students are not required to do Exercise 3 (they can directly download the data).

Exercise 1: Polynomial interpolation/approximation (10 points)

First consider how to fit a polynomial to sin(x). (Note the similarity to the coefficient functions below). If you haven't done the readings, and tried the on-line polynomial calculator from the lectures page, consider doing this first. Then generate an example data vector for the sin function:

Consider m = 0.5, 1, 2, 3. Then

Exercise 2: Fit a Polynomial along a brain tumor contour (10 points)

Fit a polynomial of order n along the contour of the brain tumor located in a brain MRI. The images are located in ~c340/web_docs/labs/labAssign2/brain_tumor.There are three images:tumor.jpg(real brain MRI image), tumor_groundtruth.jpg (Tumor labelled by radiologist) and tumorContour.jpg(Contour of the tumor labelled by radiologist). Find the set of points on tumor contour using following matlab code:

Start to fit a piecewise (imagine the contour is divided into a number of pieces) polynomial of order n along the contour so that it more or less approximates (in least square sense) the contour drawn by radiologist . The value of n may or may not be same for all pieces.Find least square error between your fitted contour and radiologist drawn contour.

hints: To fit polynomial you can use either (1) all border pixels (2) subsampling of border pixels (3) collecting points on the contour using matlab command ginput but make sure collecting points should be sparsely densed so that the fitted polynomial follows approximately the tumor border and both residual and visual inspection will provide satisfactory results.To divide contour into a number of pieces you have to select border pixels having maximum curvature (where curve bends) as control points and fit polynomial independently between two consecutive control points.

Exercise 3: Fit a spline along a brain tumor contour (10 points)

Fit a piecewise cubic spline curve (Heath Ch7.4.2) along the contour of the brain tumor on the images of exercise 2.Find least square error also between your fitted contour and radiologist drawn contour.

hints: There are several options for you to select control points on the contour: a)You can place sparse points on the contour using matlab function ginput, b) You can use every border pixel, c)You can use a subsampling of the border pixels, d) You can fit exact polynimials between each two control points or e)You can use more points than the order of the polynomial and then approximate. But make sure the residual error and visual inspection will give satisfactory result.