|
a |
|
b/Image features calculation code/Working/Utility and Misc/GetRadiologistsRatings.m |
|
|
1 |
function [ RATINGS ] = GetRadiologistsRatings( data, rowNumber ) |
|
|
2 |
%GetRadiologistsRatings Collects radiologists ratings belonging to all the |
|
|
3 |
%borders related to the same nodule image. |
|
|
4 |
% Takes the location of the Excel file with the doctors semantic ratings, |
|
|
5 |
% and the name of the outline file you are interested in. Finds the name |
|
|
6 |
% of the source image, then collects the radiologists ratings for that |
|
|
7 |
% source image. Returns everything in the RATINGS structure. Easier than |
|
|
8 |
% using dicominfo('1.dcm') since we need the rating .xlsx or we're stuck |
|
|
9 |
% anyway. |
|
|
10 |
% Gives the # of ratings, ID of source image, IDs of related border |
|
|
11 |
% images, and the ratings: subtlety,internalStructure,calcification,sphericity, |
|
|
12 |
% margin,lobulation,spiculation,texture,malignancy. |
|
|
13 |
|
|
|
14 |
%modified column numbers |
|
|
15 |
%find how many ratings for this nodule |
|
|
16 |
noduleID = cell2mat(data(rowNumber,6)); |
|
|
17 |
i = 1; |
|
|
18 |
while rowNumber+i <= size(data,1) && strcmp(cell2mat(data(rowNumber + i, 6)), noduleID) == 1 |
|
|
19 |
i = i+1; |
|
|
20 |
end |
|
|
21 |
totalRatings = i; |
|
|
22 |
matchingRows = (rowNumber:rowNumber + totalRatings - 1); |
|
|
23 |
%1 subtlety, 2 calcification, 3 sphericity, 4 margin, 5 lobulation, |
|
|
24 |
%6 spiculation, 7 texture, 8 malignancy |
|
|
25 |
RATINGS.totalRatings = totalRatings; |
|
|
26 |
RATINGS.noduleID = noduleID; |
|
|
27 |
RATINGS.relatedInstances = cell2mat(data(matchingRows, 1)); |
|
|
28 |
RATINGS.subtlety = cell2mat(data(matchingRows, 10)); |
|
|
29 |
RATINGS.calcification = cell2mat(data(matchingRows, 11)); %not a 'ranking' number |
|
|
30 |
RATINGS.sphericity = cell2mat(data(matchingRows, 12)); |
|
|
31 |
RATINGS.margin = cell2mat(data(matchingRows, 13)); |
|
|
32 |
RATINGS.lobulation = cell2mat(data(matchingRows, 14)); |
|
|
33 |
RATINGS.spiculation = cell2mat(data(matchingRows, 15)); |
|
|
34 |
RATINGS.texture = cell2mat(data(matchingRows, 16)); |
|
|
35 |
RATINGS.malignancy = cell2mat(data(matchingRows, 17)); |
|
|
36 |
%RATINGS.internalStructure = cell2mat(data(matchingRows, 11)); %useless also not a ranking number |
|
|
37 |
RATINGS.sourceID = RATINGS.noduleID(1:30); |
|
|
38 |
RATINGS.sourceDirectory = char(data(matchingRows, 9)); %only need one of the identical entries |
|
|
39 |
|
|
|
40 |
RATINGS.stdev = [std(RATINGS.subtlety), std(RATINGS.calcification), ... |
|
|
41 |
std(RATINGS.sphericity), std(RATINGS.margin), std(RATINGS.lobulation),... |
|
|
42 |
std(RATINGS.spiculation), std(RATINGS.texture), std(RATINGS.malignancy)]; |
|
|
43 |
RATINGS.rows = [rowNumber, rowNumber+totalRatings-1]; |
|
|
44 |
%Get borders in numerical form. |
|
|
45 |
borderCells = data(matchingRows, 21); |
|
|
46 |
RATINGS.borders = ParseBorderCells(borderCells); |
|
|
47 |
RATINGS.area = cell2mat(data(matchingRows, 71)); |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
%Get extrema from x,y coordinates in the borders |
|
|
51 |
minCorner = min(RATINGS.borders{1}); %initialize |
|
|
52 |
maxCorner = max(RATINGS.borders{1}); |
|
|
53 |
for i = 2:length(RATINGS.borders) %iterate |
|
|
54 |
minCorner = min([minCorner; RATINGS.borders{i}]); |
|
|
55 |
maxCorner = max([maxCorner; RATINGS.borders{i}]); |
|
|
56 |
end |
|
|
57 |
RATINGS.boundingBox = [minCorner; maxCorner]; |
|
|
58 |
|
|
|
59 |
end |
|
|
60 |
|