## Medical Image Segmentation

Medical Image Segmentation is the process of automatic or semi-automatic detection of boundaries within a 2D or 3D image. A major difficulty of medical image segmentation is the high variability in medical images. First and foremost, the human anatomy itself shows major modes of variation. Furthermore many different modalities (X-ray, CT, MRI, microscopy, PET, SPECT, Endoscopy, OCT, and many more) are used to create medical images. The result of the segmentation can then be used to obtain further diagnostic insights. Possible applications are the automatic measurement of organs, cell counting, or simulations based on the extracted boundary information. Next stage is segmentation which mainly concentrates on tumour detection.

## Markov Random Field Segmentation

This method is applied to the filtered image in which it converts an intensity image to a binary image. To convert it into a binary image, the threshold value is chosen by this method to minimize the intra-class variance of the background and foreground pixels.

## Morphological Operation

Morphological Operation is applied to smooth the edges because the edges of the output image become irregular after applying the threshold. Then the morphological close and open operation is applied to the binary image.

### Bone cancer

An Enchondroma is a benign tumour found in bone marrow. Enchondroma is in common a benign bone tumour is made of cartilage that is found in the short tubular bones of the hand and feet, distal femur, and proximal humerus. The studies show that enchondroma is most common in middle age people. Tumour excisions and tissue differentiation is the most arduous process and these tissues can be diagnosis by imaging with CT scan, x-ray or MRI.

Filtering process is important to remove the noise as well as it smoothes the images because of the captured image will be in poor quality. Among the others MR imaging technique is best because of its higher resolution pixels, it is based on the process that uses highly charged magnetic fields to make images of inside the body. The MRI (magnetic resonance imaging) sequences with T1, T2, STIR and PDW series provided different information about the tumor. MR has more than one methodology to classify images; these are atlas methods, shape methods, variation segmentation and fuzzy methods.

Segmentation process is used to variate the tumor cells and fuzzy methods integrates the images using multi-spectral analysis. Thresholding method is used in the existing system and it is the most common technique, which divides the image into a binary image. Sometimes thresholding method will lack of sensitivity needed for accurate classification. In the proposed system we have used the Markov Random field, Feature Extraction and Classifier to get accurate result of the image.

## Naive Bayes Classifier

Naive Bayes classifier is applied for better categorisation of the Enchondroma disease in the

case: benign that is Affected or normal image. Naive Bayes classifiers can be given a set of

variables, X = {x1, x2, x…, xd}, we want to construct the posterior probability for the event Cj among a set of possible outcomes C = {c1, c2, c…,cd}. In a more familiar language, X is the predictors and C is the set of categorical levels present in the dependent variable. Using Bayes’ rule:

P(Cj | x1,x2,….xd) p(x1,x2,….xd|Cj) p(Cj)———- (1)

where p(Cj | x1,x2,x…,xd) is the posterior probability of class membership, i.e., the probability that X belongs to Cj.

*clc*

*clear all*

*close all*

*k= imread(‘2.jpg’);*

*y=imresize(k,[256 256]);*

*figure,*

*imshow(k);*

*title(‘Enchondroma affected Image’)*

*h = ones(5,5) / 25;*

*I2 = imfilter(k,h);*

*figure,*

*imshow(I2), title(‘Average Filtered Image’)*

*I=I2;*

*disp(‘ENTER 1 FOR FUZZY C-Means’)*

*if ndims(I)==3*

*I=rgb2gray(I);*

*else*

*I=I;*

*end*

*in=1;*

*% for t=1:size(I,1)*

*I=imresize(I,[256 256]);*

*figure,imshow(I);title(‘Original image’);*

*if in==1*

*[M N]=size(I);*

*data=double(reshape(I,[size(I,1)*size(I,2) 1]));*

*n=3;*

*[center, U, obj_fcn] =fcm(data, n);*

*maxU = max(U);*

*data = data’;*

*wholeD = zeros(size(data));*

*for k = 1:n*

*indexk = (U(k,:) == maxU);*

*Ik = indexk.*data;*

*Ik = reshape(Ik,M,N);*

*result{k} = Ik;*

*wholeG(indexk) = k-1;*

*end*

*mean_cluster_val = zeros(3,1);*

*for k = 1:n*

*mean_cluster_val(k) = mean(center(k));*

*end*

*[mean_cluster_val,idx] = sort(mean_cluster_val);*

*img=result{idx(end)};*

*img=medfilt2(img,[2 2]);*

*end*

*BW = img;*

*figure,*

*imshow(BW)*

*title([‘FCM clustered segmented image with ‘,num2str(n),’ bins’]);*

*se = strel(‘disk’,11);*

*erodedBW = imerode(BW,se);*

*figure,*

*imshow(erodedBW)*

*title(‘Morphological Operations – Erosion’)*

*se = strel(‘disk’,4);*

*dilatedBW = imerode(erodedBW,se);*

*figure,*

*imshow(dilatedBW)*

*title(‘Morphological Operations – Dilation’)*

*outt=bif(k,3,0.2,0.1);*

*figure,*

*imshow(outt);*

*title(‘Bilateral Filtered Image’);*

*I=outt;*

*disp(‘ENTER 1 FOR FUZZY C-Means’)*

*if ndims(I)==3*

*I=rgb2gray(I);*

*else*

*I=I;*

*end*

*in=1;*

*% for t=1:size(I,1)*

*I=imresize(I,[256 256]);*

*figure,*

*imshow(I);title(‘Original image’);*

*if in==1*

*[M N]=size(I);*

*data=double(reshape(I,[size(I,1)*size(I,2) 1]));*

*n=3;*

*[center, U, obj_fcn] =fcm(data, n);*

*maxU = max(U);*

*data = data’;*

*wholeD = zeros(size(data));*

*for k = 1:n*

*indexk = (U(k,:) == maxU);*

*Ik = indexk.*data;*

*Ik = reshape(Ik,M,N);*

*result{k} = Ik;*

*wholeG(indexk) = k-1;*

*end*

*mean_cluster_val = zeros(3,1);*

*for k = 1:n*

*mean_cluster_val(k) = mean(center(k));*

*end*

*[mean_cluster_val,idx] = sort(mean_cluster_val);*

*img=result{idx(end)};*

*img=medfilt2(img,[2 2]);*

*end*

*BW1 = img;*

*figure,*

*imshow(BW1)*

*title([‘FCM clustered segmented image with ‘,num2str(n),’ bins’]);*

*se = strel(‘disk’,11);*

*erodedBW1 = imerode(BW1,se);*

*figure,*

*imshow(erodedBW1)*

*title(‘Morphological Operations – Erosion’)*

*se = strel(‘disk’,1);*

*dilatedBW1 = imerode(erodedBW1,se);*

*figure,*

*imshow(dilatedBW1)*

*title(‘Morphological Operations – Dilation’)*

## Results and Discussion

Hello sir,I am an engineering student.How can I see the results and program explanations?

How the above code works? How can we run it?

Hello sir,I am an engineering student from biomedical department.My mini project is related to your topic.I have doubts on your program.can you please explain the program?

Kindly elaborate your query.

bif() what is this function? I am getting an error in this stage, can you please rectify this?