How to save an average voxel values from multiple ROIs in a dicom slice?
Show older comments
I want to extract an average voxel values form each ROIs drawn on dicom slice. How can I do that? Using the following code I read the dicom slice, then draw 4 rois, now I want to save the ROI intensty statistics such as the average, minimum, maximum and standard deviation in voxel values within the ROI. How to complete the code below to get that done?
close all; clear; clc;
%% load and read dicom slice
info_ct = dicominfo('37.100.dcm');
Height = info_ct.Height;
Width = info_ct.Width;
slope = info_ct.RescaleSlope;
intercept = info_ct.RescaleIntercept;
ct_matrix = slope * double(dicomread(info_ct)) + intercept; % respect slope and intercept
%% Now, draw 4 ROIs on dicom slice
figure
N = 4;
I = imshow(ct_matrix(:,:,1), [-800 1000]);
% Define the Region of Interest
e = drawcircle(gca, 'Label', '1'); % draw 1 ROI
f = drawcircle(gca, 'Label', '2'); % draw 2 ROI
g = drawcircle(gca, 'Label', '3'); % draw 3 ROI
h = drawcircle(gca, 'Label', '4'); % draw 4 ROI
% Create a Mask
BW1 = createMask(e, I); % 1s at ROI and 0s everywhere
BW1 = double(BW1);
BW2 = createMask(f, I);
BW2 = double(BW2);
BW3 = createMask(g, I);
BW3 = double(BW3);
BW4 = createMask(h, I);
BW4 = double(BW4);
....
Accepted Answer
More Answers (0)
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!