Segmentation of 3D images using EM algorithms
is a 3d array representing an image.
is the number of clusters/classes to be segmented.
is a matrix of size nclust x nclust, representing the prior weight of classes neighboring each other.
ratio of voxel dimension in x/y direction and z direction. Will be multiplied on beta for neighboring voxel in z direction.
only "cem" classification EM algorithm implemented.
is a logical variable. If TRUE, the variance is equal in each class.
is the maximum number of iterations.
is a logical array, representing the voxels to be used in the segmentation.
is a vector with mean of the normal prior of the expected values of all classes. Default is NA, which represents no prior assumption.
is a vector with standard deviations of the normal prior of the expected values of all classes.
stop criterion. Minimal change in sum of squared estimate of mean in order to stop.
if TRUE enforces number of clusters to be nclust. Otherwise classes might be removed during algorithm.
not used
if TRUE, function remains silent during running time
A list with "class": 3d array of class per voxel; "mu" estimated means; "sigma": estimated standard deviations.
if (FALSE) {
original<-array(1,c(300,300,50))
for (i in 1:5)original[(i*60)-(0:20),,]<-original[(i*60)-(0:20),,]+1
for (i in 1:10)original[,(i*30)-(0:15),]<-original[,(i*30)-(0:15),]+1
original[,,26:50]<-4-aperm(original[,,26:50],c(2,1,3))
img<-array(rnorm(300*300*50,original,.2),c(300,300,50))
img<-img-min(img)
img<-img/max(img)
try1<-segment(img,3,beta=0.5,z.scale=.3)
print(sum(try1$class!=original)/prod(dim(original)))
beta<-matrix(rep(-.5,9),nrow=3)
beta<-beta+1.5*diag(3)
try2<-segment(img,3,beta,z.scale=.3)
print(sum(try2$class!=original)/prod(dim(original)))
par(mfrow=c(2,2))
img(original)
img(img)
img(try1$class)
img(try2$class)
}