Skull striping without affecting tumor region
Mostra commenti meno recenti
Can anyone help me to remove the skull part of the brain image without effecting the tumor region? the image is http://imageshack.us/photo/my-images/196/img6oe.jpg/ Actually the intensity level of tumor as well as the skull part is really high and whatever i tried, it effects the tumor region as well. kindly help me regarding this:
Risposte (3)
Matt Kindig
il 5 Lug 2012
Modificato: Matt Kindig
il 5 Lug 2012
If you have the Image Processing Toolbox, you can use 'regionprops' to identify the various objects after your thresholding. For your particular image, I was able to identify the tumor using the following approach:
img = imread('/path/to/your/filename.jpg');
bw = (img > 0.5*255); %thresholded to remove background and white/gray matter
lbl = bwlabel(bw); %labelled regions
props = regionprops(lbl, 'Solidity', 'Area');
% solidity is the percentage "filled" of an area. For the skull,
%the solidity will be really low.
solidity = [props.Solidity];
area = [ props.Area];
hiSolid= solidity > 0.2; %get only high solidity objects
maxArea = max( area(hiSolid));
tumorLabel = find( area==maxArea); %label of tumor
tumor = ismember(lbl, tumorLabel); %b/w image of tumor
imshow(tumor); %this isolates tumor
3 Commenti
Sehrish
il 5 Lug 2012
Matt Kindig
il 5 Lug 2012
Modificato: Matt Kindig
il 5 Lug 2012
Sure, one way is to first extract everything inside the skull, and then remove everything that is the skull itself. Something like this seems to work. Again, not necessarily a general solution, but it should give you an overview of some common image processing functions that can help.
insideSkull = (img > 0.3*255); %isolate all dense material
insideSkull = imfill(insideSkull, 'holes');
bw = (img > 0.4*255);
lbl = bwlabel(skull);
skull = find(Solidity < 0.2);
skull = ismember(lbl, skull);
skullOrBorder = skull | ~insideSkull;
noSkull = img;
noSkull(skullOrBorder)=0;
imshow(noSkull); %this only contains gray matter and tumor
You might need to adjust the thresholds to get better performance. Also, I would recommend looking at the Demos for the Image Processing Toolbox. You can access them from the Help browser using Help->Image Processing Toolbox->Demos.
Sehrish
il 5 Lug 2012
Unless you have a huge number of images, I think the best solution is to mask it manually, because no algorithm is as good as the eye. For example I use the program MIPAV, which can read many different scanner formats.
Anton Semechko
il 5 Lug 2012
Modificato: Anton Semechko
il 5 Lug 2012
The simplest way to segment the tumor in the sample image would be to use region growing algorithm. There are a few implementations of this method on FEX, but for the following demo I used this one:
1) Download the function titled 'regiongrowing' from the link given above into your working directory.
2) Segment the tumor using pixel position [380 480] as the seed point:
% get the sample image
im=imread('http://desmond.imageshack.us/Himg196/scaled.php?server=196&filename=img6oe.jpg&res=landing');
% segment the ROI
thr=15; % intensity similarity tolerance
bw=regiongrowing(double(im),380,480,thr);
% fill in the holes
bw=imfill(bw,'holes');
% visualize the segmentation
r=im; g=im; b=im;
r(bw)=255; g(bw)=255;
rgb=cat(3,r,g,b);
figure, imshow(rgb)
clear r g b
You will get different results depending on the value of 'thr' parameter.
Hope this helps.
9 Commenti
Anton Semechko
il 5 Lug 2012
Modificato: Anton Semechko
il 5 Lug 2012
do the following to segment the skull:
% get the sample image
im=imread('http://desmond.imageshack.us/Himg196/scaled.php?server=196&filename=img6oe.jpg&res=landing');
% segment the ROI
thr=50; % intensity similarity tolerance
bw=regiongrowing(double(im),516,390,thr);
% visualize the segmentation
r=im; g=im; b=im;
r(bw)=255; g(bw)=255; b(bw)=0;
rgb=cat(3,r,g,b);
figure, imshow(rgb)
clear r g b
Anton Semechko
il 5 Lug 2012
Modificato: Anton Semechko
il 5 Lug 2012
and here is how you can close up the small holes in the skull:
% Identify the brain cavity and the small undersegmented regions in the skull
bw2=imfill(bw,'holes');
bw2=bw2&~bw;
% Isolate the brain cavity
a=false(size(bw));
a(300,400)=true;
bw3=imreconstruct(a,bw2);
% Only retain small undersegmented regions in the skull
bw2=bw2&~bw3;
% Patch-up the original segmentation
bw2=bw|bw2;
% Visualize the segmentation
r=im; g=im; b=im;
r(bw2)=255; g(bw2)=255; b(bw)=0;
rgb=cat(3,r,g,b);
figure, imshow(rgb)
clear a bw3 r g b
Sehrish
il 5 Lug 2012
Anton Semechko
il 5 Lug 2012
and that's precisely what the code in the last two comments does ... did you try it?
Anton Semechko
il 5 Lug 2012
Modificato: Anton Semechko
il 5 Lug 2012
I guess you may want to learn how to copy and paste first, and then learn programming. Here is full code:
% get the sample image
im=imread('http://desmond.imageshack.us/Himg196/scaled.php?server=196&filename=img6oe.jpg&res=landing');
% segment the ROI
thr=60; % intensity similarity tolerance
bw=regiongrowing(double(im),516,390,thr);
% Identify the brain cavity and the small undersegmented regions in the skull
bw2=imfill(bw,'holes');
bw2=bw2&~bw;
% Isolate the brain cavity
a=false(size(bw));
a(300,400)=true;
bw3=imreconstruct(a,bw2);
% Only retain small undersegmented regions in the skull
bw2=bw2&~bw3;
% Patch-up the original segmentation
bw2=bw|bw2;
% Visualize the segmentation
r=im; g=im; b=im;
r(bw2)=255; g(bw2)=255; b(bw2)=0;
rgb=cat(3,r,g,b);
figure('color','w')
subplot(1,2,1), imshow(im)
subplot(1,2,2), imshow(rgb)
clear a bw3 r g b
And don't forget to download the 'regiongrowing' function into your working directory from here:
saranya
il 30 Gen 2013
great work. thank you. it helped me a lot.am doing my final year project in brain tumor detection. the above code works only for this particular image http://desmond.imageshack.us/Himg196/scaled.php?server=196&filename=img6oe.jpg&res=landing how to implement the same code for other images that i have????? am new to matlab.....guide me pls....
Image Analyst
il 30 Gen 2013
You have to adapt it. That's what image processing is all about. Often people make an algorithm that works fine for just one image but is not robust enough for all similar images. That's where you skill as an image analyst comes in. You have to figure out what parameters need to be veried for the other images, for example, threshold values, minimum sizes, kernel width, etc. It's your project, and you have your images, so it's up to you, and perhaps the radiologist who's helping you that supplied you with the images.
elif yoldas
il 15 Apr 2016
code is not done work and image is not found :(
Categorie
Scopri di più su Biomedical Imaging in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!