forked from MouseLightPipeline/pipeline-featmatch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compute_pointmatch_on_single_pair_in_live_sample.m
36 lines (33 loc) · 1.76 KB
/
compute_pointmatch_on_single_pair_in_live_sample.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
function match_count = compute_pointmatch_on_single_pair_in_live_sample(sample_date, central_tile_relative_path, other_tile_relative_path)
% Set paths to inputs, outputs
tile1 = fullfile('/nrs/mouselight/pipeline_output', sample_date, 'stage_3_descriptor_output', central_tile_relative_path) ;
tile2 = fullfile('/nrs/mouselight/pipeline_output', sample_date, 'stage_3_descriptor_output', other_tile_relative_path) ;
acqusitionfolder1 = fullfile('/groups/mousebrainmicro/mousebrainmicro/data', sample_date, 'Tiling', central_tile_relative_path) ;
acqusitionfolder2 = fullfile('/groups/mousebrainmicro/mousebrainmicro/data', sample_date, 'Tiling', other_tile_relative_path) ;
output_folder_path = tempname(get_scratch_folder_path()) ;
ensure_folder_exists(output_folder_path) ;
escaped_output_folder_path = escape_path_for_bash(output_folder_path) ;
cleaner_command_line = sprintf('rm -rf %s', escaped_output_folder_path) ;
cleaner = onCleanup(@()(system(cleaner_command_line))) ;
% Run the code under test
pixel_shift = '[0 0 0]' ;
ch = [] ; % not used
max_descriptor_count = 10000 ;
try
exitcode = ...
pointmatch(tile1, tile2, acqusitionfolder1, acqusitionfolder2, output_folder_path, pixel_shift, ch, max_descriptor_count) ;
catch me
fprintf('pointmatch() threw an error:\n') ;
disp(me.getReport()) ;
match_count = 0 ;
return
end
if exitcode ~= 0 ,
fprintf('pointmatch() returned a nonzero exit code (%s).\n', exitcode) ;
match_count = 0 ;
return
end
output_file_name = fullfile(output_folder_path, 'channel-1-match-Z.mat') ;
load(output_file_name, 'paireddescriptor') ;
match_count = size(paireddescriptor.X, 1)
end