340 students are not required to do Exercise 3 (they can directly download the data).
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:
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.
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.