How to create respiratory curve (plot) from two segmented CT scans?

1 Ansicht (letzte 30 Tage)
Veronika
Veronika am 12 Apr. 2017
Dear all,
I know, that this problem isn´t your specialization, but I try, if there is any specialist in this topic. I have two CT scans of thorax (exhale and inhale). I segmented this images, so I got coordinates for each image. I subtracted these two sets of points (two cells) from each other and I got one cell array (1237x2 double). Now I would like to create respiratory curve from that, I know that axe X is time, but I don´t know, how get axe Y. I tried this, because this combination seemed to me the most logical:
grayImage1 = dicomread('000048.dcm');
grayImage2 = dicomread('000086.dcm');
[rows, columns, numberOfColorChannels] = size(grayImage1);
if numberOfColorChannels > 1
% Máme barevný obraz, musíme ho převést na černobílý = vybereme zelený kanál
grayImage1 = grayImage1(:, :, 2); % zelený kanál
end
[rows, columns, numberOfColorChannels] = size(grayImage2);
if numberOfColorChannels > 1
% Máme barevný obraz, musíme ho převést na černobílý = vybereme zelený kanál
grayImage2 = grayImage2(:, :, 2); % zelený kanál
end
figure(1)
subplot(2,2,1)
imshow(grayImage1, [])
subplot(2,2,2)
imshow(grayImage2, [])
thresholdValue = 900
binaryImage_dech1 = grayImage1 > thresholdValue;
% Odstranění okolí.
binaryImage_dech1 = imclearborder(binaryImage_dech1);
% Vyplnění otvorů.
binaryImage_dech1 = imfill(binaryImage_dech1, 'holes');
% Vymazání menších otvorů.
binaryImage_dech1 = bwareaopen(binaryImage_dech1, 1150);
%Roztažení binárního obrazu pro přesnější segmentaci
se = strel('line',5,100);
binaryImage_dech1= imdilate(binaryImage_dech1,se);
binaryImage_dech2 = grayImage2 > thresholdValue;
% Odstranění okolí.
binaryImage_dech2 = imclearborder(binaryImage_dech2);
% Vyplnění otvorů.
binaryImage_dech2 = imfill(binaryImage_dech2, 'holes');
% Vymazání menších otvorů.
binaryImage_dech2 = bwareaopen(binaryImage_dech2, 1150);
%Roztažení binárního obrazu pro přesnější segmentaci
se = strel('line',5,100);
binaryImage_dech2= imdilate(binaryImage_dech2,se);
subplot(2,2,3)
imshow(binaryImage_dech1, [])
subplot(2,2,4)
imshow(binaryImage_dech2, [])
figure(2)
subplot(2,2,1)
imshow(grayImage1, []);
title('Segmentace okolí');
axis image;% Ujištění, že se obraz po zvětšení okna nezdeformuje.
hold on;
boundaries1 = bwboundaries(binaryImage_dech1);
numberOfBoundaries = size(boundaries1, 1);
for k = 1 : numberOfBoundaries
thisBoundary1 = boundaries1{k};
plot(thisBoundary1(:,2), thisBoundary1(:,1), 'r', 'LineWidth', 2);
end
figure(2)
subplot(2,2,2)
imshow(grayImage2, []);
title('Segmentace okolí');
axis image;% Ujištění, že se obraz po zvětšení okna nezdeformuje.
hold on;
boundaries2 = bwboundaries(binaryImage_dech2);
numberOfBoundaries = size(boundaries2, 1);
for k = 1 : numberOfBoundaries
thisBoundary2 = boundaries2{k};
plot(thisBoundary2(:,2), thisBoundary2(:,1), 'r', 'LineWidth', 2);
end
thisBoundary1_bigger = [thisBoundary1; zeros(5,2)];
thisBoundary1_bigger = [zeros(5,2); thisBoundary1];
dech = thisBoundary2 - thisBoundary1_bigger
figure(3)
plot(dech(:,2))
I attach two CT scans in zip for this code.
Thank you for your time and answers.

Antworten (0)

Kategorien

Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by