function [ref_multiple_signal_amp, ref_mean_signal_amp] = fn_extract_sensitivities_for_defects_of_interest(sensitivity, defects_of_interest, mask, zimin, zimax, ximin, ximax, signal_scaling)
switch defects_of_interest.type
    case 'all'
        di = find(...
            sensitivity.size >= defects_of_interest.min_size & ...
            sensitivity.size <= defects_of_interest.max_size & ...
            ((sensitivity.angle >= defects_of_interest.min_angle & ...
            sensitivity.angle <= defects_of_interest.max_angle) | isinf(sensitivity.angle))...
            );
    case 'crack'
        di = find(...
            sensitivity.size >= defects_of_interest.min_size & ...
            sensitivity.size <= defects_of_interest.max_size & ...
            sensitivity.angle >= defects_of_interest.min_angle & ...
            sensitivity.angle <= defects_of_interest.max_angle ...
            );
    case 'SDH'
        di = find(...
            sensitivity.size >= defects_of_interest.min_size & ...
            sensitivity.size <= defects_of_interest.max_size & ...
            isinf(sensitivity.angle) ...
            );
end


ref_multiple_signal_amp = permute(sensitivity.amp(zimin:zimax, ximin:ximax,:,di), [1,2,4,3]) * signal_scaling;
ref_multiple_signal_amp = ref_multiple_signal_amp .* repmat(permute(mask(:,:,:,1), [1,2,4,3]), [1,1,size(ref_multiple_signal_amp, 3),1]);
ref_multiple_signal_amp(isnan(ref_multiple_signal_amp)) = 0;
ref_mean_signal_amp = squeeze(mean(sensitivity.amp(zimin:zimax, ximin:ximax,:,:),4)) * signal_scaling;
ref_mean_signal_amp(isnan(ref_mean_signal_amp)) = 0;

end