Cov txheej txheem:
- Kauj Ruam 1: Kauj Ruam 1: Thauj Duab
- Kauj Ruam 2: Kauj Ruam 2: Qhib Lub Suab nrov thiab Histogram
- Kauj Ruam 3: Kauj Ruam 3: Teem Thresholds
- Kauj ruam 4: Tsim GUI
- Kauj ruam 5: Video Demo
Video: MatLab Lung Segmentation: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:24
Los ntawm: Phuc Lam, Paul Yeung, Eric Reyes
Kev lees paub tias qhov ua tsis raug ntawm lub ntsws ua segmentation yuav ua rau muaj cov ntaub ntawv tsis raug hais txog kev txheeb xyuas thaj tsam ntawm tus kab mob thiab tuaj yeem cuam tshuam ncaj qha rau cov txheej txheem kuaj mob. Cov txheej txheem pab khoos phis tawj niaj hnub ua tsis tiav los muab cov txiaj ntsig raug thaum cov kab mob hauv lub ntsws muaj cov duab nyuaj. Cov duab tsis txawv txav no tuaj yeem tshwm sim los ntawm pleural effusions, kev sib sau ua ke, thiab lwm yam. Ua ntawv thov cov txheej txheem ntsws sib cais, uas ib puag ncig ntawm lub ntsws raug cais los ntawm cov ntaub so ntswg ib puag ncig, peb lub app tuaj yeem txheeb xyuas thaj tsam nrog tus neeg siv cov tswv yim nkag los muab kev pom zoo ntawm cov duab ntawm lub ntsws, Lub hom phiaj ntawm MatLab txoj haujlwm no yog txhawm rau tsim cov neeg siv-phooj ywg sib tham sib lub ntsws app txhawm rau txheeb xyuas cov kab mob ntawm lub ntsws 'X-ray duab. Peb lub hom phiaj yog los tsim txoj hauv kev muaj txiaj ntsig zoo los qhia thiab txheeb xyuas lub ntsws tsis txawv txav txhawm rau muab cov kws kho mob thiab kws tshaj lij hluav taws xob txoj hauv kev ntseeg tau ntau dua los kuaj xyuas kab mob ntsws. Siv cov cuab yeej tsim qauv app hauv MatLab, txoj haujlwm tau tsim los ua haujlwm tshwj xeeb nrog xoo hluav taws xob hauv siab thiab suav tomography (CT) ntsuas, tab sis nws tseem tau sim ua haujlwm nrog MRI scan.
Cov lus qhia hauv qab no suav nrog peb cov txheej txheem lim suab nrov (qis-dhau Wiener lim) nrog rau cov duab pib (los ntawm kev siv qhov hnyav siv histogram ntawm cov duab grayscale) thiab siv morphological gradient (qhov sib txawv ntawm qhov nthuav dav thiab yaig ntawm cov duab) txheeb xyuas thaj tsam ntawm kev txaus siab. Cov lus qhia yuav piav qhia yuav ua li cas peb koom ua ke tag nrho cov ntsiab lus rau hauv cov duab siv interface (GUI).
Nco tseg:
1). Txoj haujlwm no tau tshoov siab los ntawm cov ntawv tshawb fawb: "Segmentation and Image Analysis of Abnormal Lungs at CT: Tam sim no mus kom ze, Teeb meem, thiab yav tom ntej tiam sis". Uas tuaj yeem pom ntawm no
2). Peb siv X-ray duab los ntawm NIH: Chaw Kho Mob. Qhov txuas tuaj yeem pom ntawm no
3). App designer pab tuaj yeem nrhiav tau ntawm no
4). Ua ntej siv txoj cai: koj yuav tsum hloov Dir path (kab 34) rau koj cov ntawv teev npe thiab hom duab (kab 35) (peb txheeb xyuas *.png).
Kauj Ruam 1: Kauj Ruam 1: Thauj Duab
Cov kauj ruam no yuav qhia koj thawj daim duab hauv cov nplai grey. Hloov 'name_of_picture.png' rau koj lub npe duab
meej; clc; kaw tag nrho;
%% Chaw thau khoom duab
raw_x_ray = 'name_of_picture.png';
Kuv = imread (raw_x_ray);
daim duab (101);
imshow (kuv);
colormap (txho);
lub npe ('Grayscale X-Ray');
Kauj Ruam 2: Kauj Ruam 2: Qhib Lub Suab nrov thiab Histogram
Txhawm rau txhawm rau nrhiav qhov pib rau cov duab teev cov xim grey, peb saib ntawm qhov histogram kom pom tias muaj cov qauv sib txawv. Nyeem ntxiv ntawm no
Kuv = wiener2 (kuv, [5 5]);
daim duab (102);
subplot (2, 1, 1);
imshow (kuv);
subplot (2, 1, 2);
imhist (kuv, 256);
Kauj Ruam 3: Kauj Ruam 3: Teem Thresholds
Cov kauj ruam no tso cai rau koj teeb tsa lub chaw pib raws li qhov histogram. morphologicalGradient yuav hais txog thaj tsam ntawm kev txaus siab rau liab, thiab kev ua haujlwm visboundaries hla cov kab lus piav qhia thiab lim ntawm lub ntsws liab.
Los ntawm kev siv thaj tsam thaj tsam, peb tuaj yeem qhia meej cov arrays ntawm kev ua tau zoo thiab txheeb lawv hauv qis. Tom ntej no kuv binarize cov duab sclae grey thiab siv morphlogical gradient method thiab mLoren Shurasking los qhia txog thaj tsam ntawm kev txaus siab (ROI). Cov kauj ruam tom ntej yog thim cov duab kom lub ntsws ROI dawb nyob rau tom qab dub. Kuv siv txoj haujlwm showMaskAsOverlay los tso saib 2 daim npog ntsej muag. Nco tseg: cov cai tau tshoov siab los ntawm Loren Shure, txuas.
Lasly, kuv tsim cov qauv xim liab los ntawm kev siv bwbwboundaries thiab npog daim duab lim thiab ciam teb.
a_thresh = Kuv> = 172; % teeb tsa qhov pib no
[labelImage, numberOfBlobs] = bwlabel (a_thresh);
khoom siv = thaj tsam cov khoom siv (a_thresh, 'tag nrho');
sortedSolidity = txheeb ([props. Solidity], 'nqis');
SB = sortedSolidity (1);
yog SB == 1 % SB tsuas lees txais kev sib tw == 1 lim tawm cov pob txha
binaryImage = imbinarize (kuv); daim duab (103);
imshow (binaryImage); colormap (txho);
SE = strel ('xwmfab', 3);
morphologicalGradient = imsubtract (imdilate (binaryImage, SE), imerode (binaryImage, SE));
daim npog = imbinarize (morphologicalGradient, 0.03);
SE = strel ('xwmfab', 2);
mask = imclose (mask, SE);
mask = imfill (daim npog, 'qhov');
mask = bwareafilt (daim npog, 2); % tswj tus naj npawb ntawm thaj tsam qhia
notMask = ~ daim npog;
daim npog = daim npog | bwpropfilt (notMask, 'Area', [-Inf, 5000 - eps (5000)]));
showMaskAsOverlay (0.5, daim npog, 'r'); % koj yuav tsum rub tawm app/ua haujlwm showMaskAsOverlay
BW2 = imfill (binaryImage, 'qhov');
new_image = BW2;
new_image (~ daim npog) = 0; % thim keeb kwm yav dhau thiab qhov
B = bwboundaries (tshiab_image); % tsuas tuaj yeem lees txais 2 qhov ntev
daim duab (104);
imshow (tshiab_image);
tuav
visboundaries (B);
kawg
Kauj ruam 4: Tsim GUI
Tam sim no, peb koom ua ke cov cai ua ntej hauv MATLAB app. Qhib App Designer hauv MATLAB (Tshiab> App). Ua ntej, peb tsim lub interface los ntawm nyem-tuav-thiab rub hauv peb txoj kab mus rau hauv chaw ua haujlwm nruab nrab. Tom ntej no, peb nyem-tuav-luag ob lub nyees khawm, ib qho hloov kho kab ntawv (kab ntawv), ib qho hloov chaw (lej), ib qho swb, thiab ib daim ntawv qhia zaub mov nco. Ob txoj kab yuav txhua qhov tso saib ua ntej thiab tshuaj xyuas cov duab, thiab lub thib peb axis yuav tso saib keeb kwm ntawm pixels rau qhov saib ua ntej "xaiv" duab. Lub thawv hloov kho (cov ntawv) lub thawv yuav tso saib cov ntawv ntawm txoj kev xaiv cov duab, thiab daim teb hloov kho (lej) yuav tso saib pom thaj tsam ntawm lub ntsws.
Tam sim no hloov los ntawm kev tsim saib rau hauv kev saib pom hauv App Designer. Nkag mus rau hauv qhov chaws tus lej rau cov khoom los ntawm txhaj rau lub pob "Properties" liab nrog lub cim ntxiv los ntawm nws. Pib ua ntej cov khoom Kuv, qhov pib, thiab thaj tsam ToExtract raws li hauv cov cai hauv qab no. Tom ntej no, nyem rau lub pob nyob rau sab xis sab xis ntawm thaj chaw ua haujlwm (Tus Txheej Txheem Browser) thiab mus los ntawm Callbacks> Mus rau… callback. Ntxiv cov cai rau "ua haujlwm SelectImageButtonPushed (app, xwm txheej)." Txoj cai no tso cai rau koj xaiv cov duab los tshuaj xyuas los ntawm koj lub computer siv uigetfile. Tom qab xaiv ib daim duab, daim duab saib ua ntej yuav tshwm nyob rau hauv qab cov kab ntawv nrog los ntawm keeb kwm yav dhau. Tom qab ntawd, txoj cai-nyem rau lwm lub pob thiab rov ua cov txheej txheem qub los tsim kev hu xov tooj.
Ntxiv rau hauv cov cai hauv qab "ua haujlwm AnalyzeImageButtonPushed (app, xwm txheej)." Txoj cai no yuav ua tus lej pixel suav thiab nrhiav pom blob ntawm qhov saib ua ntej thaum tshawb xyuas cov duab khawm (qhov twg los xij uas koj tau nyem rau tus lej no). Tom qab teeb tsa cov nyees khawm, peb tam sim no yuav teeb tsa lub slider thiab cov ntawv qhia zaub mov nco-down. Txoj cai-nyem qhov slider, tsim kev hu rov qab thiab ntxiv rau cov lej hauv qab "ua haujlwm FilterThresholdSliderValueChanged (app, xwm txheej)" kom txog thaum kawg. Qhov no tso cai rau tus slider los kho qhov grey-siv qhov pib.
Tsim kom muaj kev hu rov qab rau cov ntawv qhia zaub mov nco, thiab ntxiv rau cov lej hauv qab "ua haujlwm AreastoExtractDropDownValueChanged (app, xwm txheej)" kom tso rau hauv cov ntawv qhia zaub mov hloov kho cov naj npawb ntawm blobs pom ntawm cov duab tsom xam. Tam sim no, nyem rau txhua qhov chaw hauv Component Browser thiab hloov lawv lub zog rau koj nyiam, xws li hloov cov npe ntawm cov koomhaum, tshem cov qag, thiab hloov pauv. Luag thiab tso cov khoom ntawm Component Browser hauv Tsim Saib kom ua haujlwm tau yooj yim thiab nkag siab yooj yim. Tam sim no koj muaj app hauv MATLAB uas tuaj yeem tshuaj xyuas cov duab ntawm lub ntsws rau thaj tsam pixel!
khoom (Nkag mus = ntiag tug) Kuv = ; % cov ntaub ntawv duab
pib = 257; %qhov pib rau binarizing siv zog grey
regionsToExtract = 2;
kawg
muaj nuj nqi SelectImageButtonPushed (app, xwm txheej)
clc; Dir = 'C: / Users / danie / Downloads / images_004 / images'; %txheeb xyuas cov ntaub ntawv tsis raug "ua ntej"
[imageExt, path] = uigetfile ('*. png'); %lob qhov sib txawv ntawm lub npe duab
imageName = [Dir filesep imageExt]; %sib koom ua ke tsis sib xws thiab cov hlua sib txawv
app. I = imread (imageName); %nyeem cov duab
imshow (app. I, 'niam txiv', app. UIAxes); %tso saib daim duab
app. FilePathEditField. Value = txoj kev; %tso saib cov ntaub ntawv ntawm qhov twg thawj daim duab los ntawm
kawg
muaj nuj nqi Txheeb XyuasImageButtonPushed (app, xwm txheej)
originalImage = app. I;
originalImage = wiener2 (app. I, [5 5]); %dot-tshem tawm lim
histogram (app. AxesHistogram, app. I, 256); %tso saib histogram ntawm daim duab
a_thresh = originalImage> = app.threshold; % teeb tsa qhov pib no
labelImage = bwlabel (a_thresh);
khoom siv = thaj tsam cov khoom siv (a_thresh, 'tag nrho');
sortedSolidity = txheeb ([props. Solidity], 'nqis');
SB = sortedSolidity (1);
yog SB == 1 % SB tsuas lees txais kev sib tw == 1 lim tawm cov pob txha
SE = strel ('xwmfab', 3);
morphologicalGradient = imsubtract (imdilate (labelImage, SE), imerode (labelImage, SE));
daim npog = imbinarize (morphologicalGradient, 0.03);
SE = strel ('xwmfab', 2);
mask = imclose (mask, SE);
mask = imfill (daim npog, 'qhov');
daim npog = bwareafilt (daim npog, app.regionsToExtract);
% tswj tus naj npawb ntawm thaj tsam qhia
notMask = ~ daim npog;
daim npog = daim npog | bwpropfilt (notMask, 'Area', [-Inf, 5000 - eps (5000)]));
BW2 = imfill (labelImage, 'qhov');
new_image = BW2;
new_image (~ daim npog) = 0;
B = bwboundaries (tshiab_image); % tsuas tuaj yeem lees txais 2 qhov ntev imshow (new_image, 'niam txiv', app. UIAxes2);
tuav (app. UIAxes2, 'rau');
visboundaries (B);
teeb (gca, 'YDir', 'thim rov qab');
lungArea = bwarea (tshiab_image);
app. PixelAreaEditField. Value = lungArea;
kawg
kawg
muaj nuj nqi FilterThresholdSliderValueChanged (app, xwm txheej)
app.threshold = app. FilterThresholdSlider. Value;
kawg
muaj nuj nqi AreastoExtractDropDownValueChanged (app, xwm txheej) stringNumber = app. AreastoExtractDropDown. Value;
app.regionsToExtract = str2double (stringNumber);
kawg
kawg
Pom zoo:
Arduino Tsheb Rov Qab Chaw Nres Tsheb Ceeb Toom - Cov Kauj Ruam ntawm Kauj Ruam: 4 Kauj Ruam
Arduino Tsheb Rov Qab Chaw Nres Tsheb Ceeb Toom | Cov kauj ruam ib kauj ruam: Hauv txoj haujlwm no, kuv yuav tsim qhov yooj yim Arduino Tsheb Rov Qab Tsheb Nres Tsheb Nres Sensor Siv Arduino UNO thiab HC-SR04 Ultrasonic Sensor. Qhov no Arduino raws Lub Tsheb Rov Qab ceeb toom tuaj yeem siv rau Kev Tshawb Fawb Txog Tus Kheej, Robot Ranging thiab lwm yam
Tsev Automation Kauj Ruam ntawm Kauj Ruam Siv Wemos D1 Mini Nrog PCB Tsim: 4 Kauj Ruam
Tsev Automation Kauj Ruam Ib Leeg Siv Wemos D1 Mini Nrog PCB Tsim: Tsev Automation Kauj Ruam los ntawm Kauj Ruam siv Wemos D1 Mini nrog PCB Tsim cov tub ntxhais kawm ntawv qib siab. Tom qab ntawd ib tus ntawm peb cov tswv cuab tuaj
RC Taug Qab Neeg Hlau Siv Arduino - Kauj Ruam Ib kauj ruam: 3 Kauj Ruam
RC Tracked Robot Siv Arduino - Kauj Ruam Ib Nrab: Hav guys, Kuv rov qab los nrog lwm tus neeg hlau txias chassis los ntawm BangGood. Vam tias koj tau dhau los ntawm peb cov phiaj xwm yav dhau los - Spinel Crux V1 - Tus Cwj Pwm Tswj Tus Neeg Hlau, Spinel Crux L2 - Arduino Xaiv thiab Muab Neeg Hlau nrog Robotic caj npab thiab Badland Braw
Kawm Yuav Ua Li Cas Kos Tus Tswm Ciab - Kauj Ruam Ib Kauj Ruam: 6 Kauj Ruam
Kawm Yuav Ua Li Cas Thiaj Li Tswmciab - Kauj Ruam Ib kauj ruam: Cov tswm ciab no siv sijhawm 10 feeb los kos yog tias koj ua raws kuv cov kauj ruam ua tib zoo
DIY Arduino Robotic Arm, Kauj Ruam ntawm Kauj Ruam: 9 Kauj Ruam
DIY Arduino Robotic Arm, Kauj Ruam ntawm Kauj Ruam: Cov ntawv qhia no yog qhia koj yuav tsim lub Caj Npab Caj Npab ntawm koj tus kheej li cas