Skip to content

Commit

Permalink
update SNR calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
aboodbdaiwi committed Dec 6, 2024
1 parent 8aca3d8 commit dd35711
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion +Segmentation/PerformSegmentation.m
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
case 'Ventilation'
switch MainInput.SliceOrientation
case 'coronal'
if MainInput.NoProtonImage == 0 && strcmp(MainInput.Imagestosegment, 'Xe & Proton Registered') == 1
if MainInput.NoProtonImage == 0 && strcmp(MainInput.Imagestosegment, 'Proton & Xe Registered') == 1
SegmentType = 'vent_2D_2ch_cor'; %system('predict_mask_2DVent_w_H_coronal.exe')
elseif strcmp(MainInput.Imagestosegment, 'Xenon') == 1
SegmentType = 'vent_2D_1ch_cor';
Expand Down
10 changes: 5 additions & 5 deletions +VentilationFunctions/calculate_SNR.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@
% airwaymask = Segmentation.SegmentLungthresh(MR,1,1);
% end
% force airway mask
airwaymask = Segmentation.SegmentLungthresh(MR,0.5,1);
airwaymask = Segmentation.SegmentLungthresh(MR,1,0.3);
% airwaymask = double(MR > 2000);
% imslice(backgroundmask)

backgroundmask = double(imcomplement(maskarray_dilated).*~airwaymask);
background1 = (MR).*(backgroundmask);

% imslice(backgroundmask)
% % Label 0s in the background noise array as NaNs
% background1(background1 == 0) = NaN;
%
Expand Down Expand Up @@ -109,8 +109,8 @@
mean_noise(isnan(mean_noise))=0;
std_noise(isnan(std_noise))=0;

SNR_slice(n) = round(signal_n_avg(n) / std_noise(n),2)*sqrt(2 - (pi/2)); %signal to noise ratio
SNRvv_slice(n) = round(signalvv_avg(n) / std_noise(n),2)*sqrt(2 - (pi/2)); %signal to noise ratio
SNR_slice(n) = round((signal_n_avg(n) - mean_noise(n)) / std_noise(n),2)*sqrt(2 - (pi/2)); %signal to noise ratio
SNRvv_slice(n) = round((signalvv_avg(n) - mean_noise(n)) / std_noise(n),2)*sqrt(2 - (pi/2)); %signal to noise ratio
end
SNR_slice(isnan(SNR_slice))=0;
SNR_slice(isinf(SNR_slice)) = 0;
Expand Down
7 changes: 4 additions & 3 deletions +VentilationFunctions/calculate_VDP_CCHMC.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@

%% VDP Calculation Code:
MR = Ventilation.Image;
maskarray = double(Ventilation.LungMask + Ventilation.VesselMask);
maskarray(maskarray > 1) = 0;
maskarray = double(maskarray);
maskarray = double(Ventilation.LungMask);
% maskarray = double(Ventilation.LungMask + Ventilation.VesselMask);
% maskarray(maskarray > 1) = 0;
% maskarray = double(maskarray);
complete = Ventilation.CompleteThresh;
incomplete = Ventilation.IncompleteThresh;
hyper = Ventilation.HyperventilatedThresh;
Expand Down
4 changes: 1 addition & 3 deletions +VentilationFunctions/calculate_VHI.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@

% Extract input data and define the effective binary mask
image = Ventilation.Image;
maskarray = double(Ventilation.LungMask + Ventilation.VesselMask);
maskarray(maskarray > 1) = 0; % Exclude overlapping regions
maskarray = double(maskarray);
maskarray = double(Ventilation.LungMask);

[rows, cols, slices] = size(image);

Expand Down
Binary file modified XIPline.mlapp
Binary file not shown.

0 comments on commit dd35711

Please sign in to comment.