필터 지우기
필터 지우기

How to calculate the Volume of the segmented tumour or ROI?

조회 수: 6 (최근 30일)
Amirah
Amirah 2017년 9월 19일
댓글: Image Analyst 2017년 9월 20일
I have tumour MRI images, and I segment the tumour and binarize it using another program using Matlab, I want to calculate: The signal intensity (SI) in that ROI (mean and max values) get the pixels relative frequency according to the SI histogram of this ROI with fixed pins width, and its skewness, kurtosis and 95-percentile then normalize the SI within each pixel inside the ROI to the ROI's volume cumulative frequency slope of the normalized ROI I did generate the flowing script but I do not know how to calculate the ROI' volume, also, since I new to Matlab I do not know if my script is correct
% load the images
cbfm=load_untouch_nii('singCBF.nii.gz');cbf=double(cbfm.img);
MASK=load_untouch_nii('tumour-low-bin.nii.gz'); mask=double(MASK.img);
%to show the cbf_map
reshaped_cbf=reshape(cbf, [128 128 1 20]);
montage(reshaped_cbf, [0 60]), title('cbf'), colormap(jet),colorbar
%apply the mask
masked_cbf_t=cbf.*mask;
%%to show the cbf_map, mesh of each ROI and mesh of the mean ROI
reshaped_t=reshape(masked_cbf_t, [128 128 1 20]);
figure; montage(reshaped_t, [0 60]), title('masked.t'), colormap(jet),colorbar
figure;for a=1:14; subplot(4,4,a); mesh(masked_cbf_t(:,:,a)),title('masked.cbf.t'); end
m_r_c=nanmean(reshaped_t(:,:,:,:),4);
figure; imagesc(m_r_c, [0 60]), title('masked.t'), colormap(jet),colorbar
mesh(m_r_c), title('mean.t')
%remove the zeros and NaN from the ROI and calculate the mean and the max
masked_cbf_t(isnan(masked_cbf_t))=0;masked_cbf_t=masked_cbf_t(masked_cbf_t~=0);
masked_cbf_t=masked_cbf_t(masked_cbf_t>0);
mean_t=nanmean(masked_cbf_t(:))
max_cbf_t=max(masked_cbf_t(:))
%%get the relative frequency for the t
m_cbf_t=int8(masked_cbf_t);
[n_t,xout_t]=imhist(m_cbf_t);
rf_t=(n_t/sum(n_t))*100;
cf_t=cumsum(imhist(m_cbf_t));
%
figure; bar(xout_t,rf_t),title('r.f.t'),xlim([0, 150]);figure; imhist(m_cbf_t),title('f.t'),xlim([0, 150])
;figure;bar(xout_t,cf_t),title('c.f.t'),xlim([0, 150])
percent_95_rf_t=prctile(rf_t(:),95)
kur_t=kurtosis(rf_t(:))
ske_t=skewness(rf_t(:))
%cumulative frequency slope
coefficients_t = polyfit(xout_t, cf_t,2);
slope_cf_t = coefficients_t(2)
%%to confirm that the mask in the correct location
topped=cat(4,cbf,mask,mask);
figure; montage(permute(topped,[1,2,4,3])/2,[0 60]), title('topped'), colormap(jet),colorbar
%load the normal area which is in the basal ganglia(not affect by the
%age)and remove the zeros and NaN
BG=load_untouch_nii('bg-low-bin.nii.gz');bg=double(BG.img);
masked_cbf_bg=cbf.*bg;
masked_cbf_bg(isnan(masked_cbf_bg))=0;masked_cbf_bg=masked_cbf_bg(masked_cbf_bg~=0);
mean_bg=nanmean(masked_cbf_bg(:))
max_cbf_bg=max(masked_cbf_bg(:))
%%get the relative frequency for the bg
m_cbf_bg=int8(masked_cbf_bg);
[n_bg,xout_bg]=imhist(m_cbf_bg);
rf_bg=(n_bg/sum(n_bg))*100;
cf_bg=cumsum(imhist(m_cbf_bg));
%
figure; bar(xout_bg,rf_bg),title('r.f.bg'),xlim([0, 150]);figure; imhist(m_cbf_bg),title('f.bg'),xlim([0, 150]);
figure;bar(xout_bg,cf_bg),title('c.f.bg'),xlim([0, 150])
his_rf_bg=[xout_bg,rf_bg];
his_cf_bg=[xout_bg,cf_bg];
percent_95_rf_bg=prctile(rf_bg(:),95)
kur_bg=kurtosis(rf_bg(:))
ske_bg=skewness(rf_bg(:))
%cumulative frequency slope
coefficients_bg = polyfit(xout_bg, cf_bg,2);
slope_cf_bg = coefficients_bg(2)
r_mean_bg= mean_t / mean_bg
r_max_bg= (max_cbf_t / max_cbf_bg)
r_bg=(masked_cbf_t(:))/max(masked_cbf_bg(:));
r_cbf_bg=int8(r_bg);
[n_r_bg,xout_r_bg]=imhist(r_cbf_bg);
rf_r_bg=(n_r_bg/sum(n_r_bg))*100;
cf_r_bg=cumsum(imhist(r_cbf_bg));
%
figure; bar(xout_r_bg,rf_r_bg),title('r.f.r.bg'),xlim([0, 150]);figure; imhist(r_cbf_bg),title('f.r.bg'),xlim([0, 150]);
figure;bar(xout_r_bg,cf_r_bg),title('c.f.r.bg'),xlim([0, 150])
percent_95_rf_r_bg=prctile(rf_r_bg(:),95)
kur_r_bg=kurtosis(rf_r_bg(:))
ske_r_bg=skewness(rf_r_bg(:))
%cumulative frequency slope
coefficients_r_bg = polyfit(xout_r_bg, cf_r_bg,2);
slope_cf_r_bg = coefficients_r_bg(2)

답변 (1개)

Image Analyst
Image Analyst 2017년 9월 19일
I'm not sure where your segmented/binary image is in your code, but basically to get the volume, you can use regionprops() (if you have multiple blobs),
props = regionprops(labeledImage, 'Area');
or simply sum() if you have segmented it such that the tumor is the only blob in there:
volume = sum(binaryImage(:));
  댓글 수: 2
Amirah
Amirah 2017년 9월 20일
편집: Amirah 2017년 9월 20일
Thank you for your reply; I did segment a tumour from the binary image manually using the ITKsnap. As I mentioned, I am new to Matlab, so I am not sure if my script is correct any advice? Thank you in advance Amirah
Image Analyst
Image Analyst 2017년 9월 20일
Nope. I can't even run it (no data).

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by