function gt_label = load_ground_truth(parent_dirs, name_root, params)

gt_path = fullfile(parent_dirs{:}, sprintf(params.gtrank_format, name_root));

gt_label = [];
if exist(gt_path, 'file')
    load(gt_path, 'gt_label');

    % Crop and resize image.
    if isfield(params, 'crop')
        gt_label = gt_label(params.crop(1):params.crop(2), ...
                            params.crop(3):params.crop(4), :);
    end
    
    if isfield(params, 'scale')
        gt_label = imresize(gt_label, params.scale, 'nearest');
    end
end

end
