forked from MouseLightPipeline/pipeline-featmatch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsurvey_match_count_for_random_pairs.m
48 lines (42 loc) · 2.16 KB
/
survey_match_count_for_random_pairs.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
script_folder_path = fileparts(mfilename('fullpath')) ;
memo_folder_path = fullfile(script_folder_path, 'memos') ;
% Build an index of the paths to raw tiles
raw_tile_index = compute_or_read_from_memo(memo_folder_path, ...
sprintf('raw-tile-index-%s', sample_date), ...
@()(build_raw_tile_index(raw_tiles_path)), ...
do_force_computation) ;
tile_index_from_ijk1 = raw_tile_index.tile_index_from_ijk1 ;
ijk1_from_tile_index = raw_tile_index.ijk1_from_tile_index ;
xyz_from_tile_index = raw_tile_index.xyz_from_tile_index ;
relative_path_from_tile_index = raw_tile_index.relative_path_from_tile_index ;
% Display some features of the raw tile index
tile_lattice_shape = size(raw_tile_map)
tile_count = length(relative_path_from_tile_index)
% How many pairs for a set of 1000 'random' tiles
random_pair_count = 1000 ;
stuff_from_pair_index = ...
compute_or_read_from_memo(memo_folder_path, ...
sprintf('stuff-from-pair-index-%s', sample_date), ...
@()(compute_stuff_from_pair_index(sample_date, random_pair_count, xyz_from_tile_index, raw_tile_map, relative_path_from_tile_index)), ...
do_force_computation) ;
% Break out results
match_count_from_pair_index = stuff_from_pair_index.match_count_from_pair_index ;
center_tile_xyz_from_pair_index = stuff_from_pair_index.center_tile_xyz_from_pair_index ;
center_tile_relative_path_from_pair_index = stuff_from_pair_index.center_tile_relative_path_from_pair_index ;
median_match_count = median(match_count_from_pair_index)
max_match_count = max(match_count_from_pair_index)
fraction_match_count_is_zero = mean(match_count_from_pair_index==0)
% Plot a histogram of the results
f = figure('color', 'w') ;
a = axes(f) ;
edges = 0:10:500 ;
h = histogram(a, match_count_from_pair_index, edges) ;
h.EdgeColor = 'none' ;
h.FaceColor = [0 0 0] ;
xlim([edges(1) edges(end)]) ;
xlabel('Matches per tile pair') ;
ylabel('Count') ;
title(sample_date) ;
f.Name = sprintf('%s-match-count-histogram', sample_date) ;
print_pdf(f) ;
print_png(f,[],300) ;