|
a |
|
b/Image features calculation code/Not Working/calculateIntensityFeatures.m |
|
|
1 |
function calculateIntensityFeatures(pixelCoords, images, boxSize) |
|
|
2 |
|
|
|
3 |
range = (boxSize-1)/2; |
|
|
4 |
|
|
|
5 |
fid = fopen ('intensity_features.txt', 'a'); |
|
|
6 |
fprintf(fid, '%s,%s,%s,%s,%s \n','intense', 'maxInt', 'minInt', 'meanInt', 'SDInt'); |
|
|
7 |
|
|
|
8 |
|
|
|
9 |
%intensityFeatures = zeros( size(pixelCoords, 2) , 5); |
|
|
10 |
|
|
|
11 |
for i=1:size(images,2) |
|
|
12 |
if i==1 || (strcmp(images(i-1), images(i))==0) |
|
|
13 |
%CTimage = retrieveImage(char(images(i))); |
|
|
14 |
CTimage = preProcessDicom(char(images(i))); |
|
|
15 |
end |
|
|
16 |
|
|
|
17 |
bBox = double(CTimage(pixelCoords(2,i)-range:pixelCoords(2,i)+range,pixelCoords(1,i)-range:pixelCoords(1,i)+range)); |
|
|
18 |
|
|
|
19 |
intense = bBox(range+1, range+1); |
|
|
20 |
maxInt = max(max(bBox)); |
|
|
21 |
minInt = min(min(bBox)); |
|
|
22 |
meanInt = mean2(bBox); |
|
|
23 |
SDInt = std2(bBox); |
|
|
24 |
|
|
|
25 |
fprintf(fid, '%d,%d,%d,%d,%d \n', intense, maxInt, minInt, meanInt, SDInt); |
|
|
26 |
|
|
|
27 |
%intensityFeatures(i,:) = [intense maxInt minInt meanInt SDInt]; |
|
|
28 |
disp(i) |
|
|
29 |
end |
|
|
30 |
|
|
|
31 |
fclose(fid); |
|
|
32 |
|
|
|
33 |
%xlswrite(filename, [{'intense'} {'maxInt'} {'minInt'} {'meanInt'} {'SDInt'}], 'A1:E1'); |
|
|
34 |
%success = xlswrite(filename, intensityFeatures, 'Sheet1', 'A2'); |
|
|
35 |
|