function [cornerMap_dt,cornerStrength_dt,dt_time,cornerMap_dt_nms] = classifyDataSetAccordingToHarris(dataset, threshold, strengthMaps)
% Hassan Nahas
%Sarah Meshreqy
%This functions applies the harris detector to every image in a dataset. A
%strengthmap is generated and a threshold is used to control the number of
%corners detected.

%initialize containers
cornerMap_dt = cell(1, length(dataset));
cornerMap_dt_nms = cell(1, length(dataset));
cornerStrength_dt = cell(1, length(dataset));
if length(threshold) > 1
    thresholds = threshold;
else
    thresholds = ones(length(dataset),1)*threshold;
end
% thresholds
tic;
for i = 1 : length(dataset)

    if (isempty(strengthMaps)) % can take in a strengthmap that has been previously calculated
        [ cornerStrength_dt{i} ] = classifyImageAccordingToHarris( dataset{i}, 3,0.1 );
    else
        cornerStrength_dt{i} = strengthMaps{i};
    end
    
    strengthi = cornerStrength_dt{i};
    strengthi(strengthi < thresholds(i)) = 0;
    strengthi(strengthi >= thresholds(i)) = 1;
    cornerMap_dt{i} = strengthi;
    %cornerMap_dt{i} = classifyImageAccordingToTree( Tree,dataset{i},thresholds(i),[] );
    
    [ cornerMap_dt_nms{i} ] = nonmaximalsuppression( cornerStrength_dt{i}.* cornerMap_dt{i});
    
end
dt_time = toc;
end

