Commit 81c55d1c authored by Eamon Doyle's avatar Eamon Doyle
Browse files

include some statistics

parent 1df5631a
No preview for this file type
...@@ -24,7 +24,7 @@ function varargout = mergeRoiTool(varargin) ...@@ -24,7 +24,7 @@ function varargout = mergeRoiTool(varargin)
% Edit the above text to modify the response to help mergeRoiTool % Edit the above text to modify the response to help mergeRoiTool
% Last Modified by GUIDE v2.5 14-Mar-2024 07:53:15 % Last Modified by GUIDE v2.5 10-Apr-2024 08:12:13
% Begin initialization code - DO NOT EDIT % Begin initialization code - DO NOT EDIT
gui_Singleton = 1; gui_Singleton = 1;
...@@ -713,3 +713,51 @@ function sliceNum_KeyPressFcn(hObject, eventdata, handles) ...@@ -713,3 +713,51 @@ function sliceNum_KeyPressFcn(hObject, eventdata, handles)
% handles structure with handles and user data (see GUIDATA) % handles structure with handles and user data (see GUIDATA)
set(handles.slider2,'Value',get(handles.sliceNum,'Value')); set(handles.slider2,'Value',get(handles.sliceNum,'Value'));
% --- Executes on button press in statsButton.
function statsButton_Callback(hObject, eventdata, handles)
% hObject handle to statsButton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%stats text variable
st = "Statistics";
lungVoxels = size(find(handles.lungMatrix),1);
lungNormal = size(find(handles.lungMatrix==1),1);
lungHypo = size(find(handles.lungMatrix==2),1);
lungHyper = size(find(handles.lungMatrix==3),1);
lungBronchodyslasia = size(find(handles.lungMatrix==4),1);
lungVol = -1;
if strcmp(handles.dcminfo.SOPClassUID,'1.2.840.10008.5.1.4.1.1.4.1')
%this is an enhanced dicom
d = handles.dcminfo;
sliceThickness = d.PerFrameFunctionalGroupsSequence.Item_1.PixelMeasuresSequence.Item_1.SliceThickness;
sliceSpacing = d.PerFrameFunctionalGroupsSequence.Item_1.PixelMeasuresSequence.Item_1.SpacingBetweenSlices;
if sliceThickness ~= sliceSpacing
warndlg("Slice thickness does not equal slice spacing, lung volume may be very wrong");
end
pixelSpacing = d.PerFrameFunctionalGroupsSequence.Item_1.PixelMeasuresSequence.Item_1.PixelSpacing;
pixelsPerLungMatVox = handles.lungGridSize^2;
lmVoxVol = pixelSpacing(1)*pixelSpacing(2)*sliceThickness*pixelsPerLungMatVox;
lungVol = lungVoxels * lmVoxVol;
elseif strcmp(handles.dcminfo.SOPClassUID,'1.2.840.10008.5.1.4.1.1.4')
% this is a classic dicom
warndlg('Classic dicom does not compute lung volume stats yet');
else
error('SOPClassUID %s not equal to MR Classic or Enhance DICOM SOPClassUID',handles.dcminfo.SOPClassUID );
end
st = st + sprintf("Counts:\n");
st = st + sprintf(" Total Lung Voxels: %d (%03.2f%%)\n",lungVoxels, 100*lungVoxels/lungVoxels);
st = st + sprintf(" Normal Lung Voxels: %d (%03.2f%%)\n",lungNormal, 100*lungNormal/lungVoxels);
st = st + sprintf(" Hypointense Voxels: %d (%03.2f%%)\n",lungHypo, 100*lungHypo/lungVoxels);
st = st + sprintf(" Hyperintense Voxels: %d (%03.2f%%)\n",lungHyper, 100*lungHyper/lungVoxels);
st = st + sprintf(" Bronchodyspl Voxels: %d (%03.2f%%)\n",lungBronchodyslasia, 100*lungBronchodyslasia/lungVoxels);
st = st + sprintf("\nVolumes:\n");
st = st + sprintf(" Estimated Total Lung Volume: %06.1f cc", lungVol);
set(handles.statsTextbox,'String',st);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment