**Post: #1**

1) Perform PCA to obtain the K–L transformation matrix for

the target VOI, determine the reduced dimension P for the

local intensity vector space, and calculate the K–L transformed

local intensity vector ωi = {ωi1, ωi2, . . . , ωiP }

for each voxel i = 1, . . . , I.

2) Set the classification threshold T as the maximum PC

variance, and set a value for the maximum class number

K based on prior anatomical knowledge.

3) i = 1, set the first voxel label v1 = 1, its local intensity

vector ω1 as the representative vector c1 for the first class,

n1 = 1 as the number of voxels belonging to class 1, and

K = 1 as the current number of classes.

4) i = i + 1, calculate the squared Euclidean distance

d(ωi, ck ) between the local intensity vector ωi of the

current voxel and the representative vector ck for each

existing class k = 1, . . . , K.

5) Let d(ωi, cm) = min1≤k≤K{d(ωi, ck )}, if d(ωi, cm) <

T or K = K, the label for the ith voxel is vi = m. cm is

updated by cm = (nm ∗ cm + ωi)/(nm + 1), and nm =

nm + 1.Otherwise, a newclassK = K + 1is generated

with representative vector cK = ωi , and the current voxel

is labeled as vi = K s.t. K <= K.

6) Repeat from step 4) until i = I to complete a whole scan.

7) If K < K, repeat steps 1) to 6) for another whole scan

while setting the classification threshold T to be the variance

of the second or higher-order PC until reaching the

desired number of tissue types K = K.

I want to know how can i develope this algorithm in matlab.