Skip to content

Commit 5812628

Browse files
committed
Added specific entry points for Patrick pipeline
1 parent d112dd9 commit 5812628

5 files changed

+92
-3
lines changed

compute_landmarks.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#! /bin/bash
2+
3+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
4+
cd "$SCRIPT_DIR"
5+
/misc/local/matlab-2019a/bin/matlab -batch "modpath; compute_landmarks_for_patrick_pipeline('$1', '$2', '$3')"
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
function compute_landmarks_for_patrick_pipeline(p_map_root_path, landmarks_root_path, tile_relative_path, ...
2+
do_force_computation, do_run_in_debug_mode)
3+
% Deal with args
4+
if ~exist('do_force_computation', 'var') || isempty(do_force_computation) ,
5+
do_force_computation = false ;
6+
end
7+
if ~exist('do_run_in_debug_mode', 'var') || isempty(do_run_in_debug_mode) ,
8+
do_run_in_debug_mode = false ;
9+
end
10+
11+
% Make sure the output folder exists
12+
landmark_folder_path = fullfile(landmarks_root_path, tile_relative_path) ;
13+
ensure_folder_exists(landmark_folder_path) ;
14+
15+
% Run for all channels
16+
channel_count = 2 ;
17+
for channel_index = 1 : channel_count ,
18+
compute_landmarks_for_single_tile_channels(p_map_root_path, tile_relative_path, landmarks_root_path, ...
19+
channel_index, ...
20+
do_force_computation, do_run_in_debug_mode) ;
21+
end
22+
end
23+
24+
25+
26+
function compute_landmarks_for_single_tile_channels(p_map_root_path, landmarks_root_path, tile_relative_path, ...
27+
channel_index, ...
28+
do_force_computation, do_run_in_debug_mode)
29+
30+
% Compute the p-map file path
31+
[~,day_tile_index_as_string] = fileparts2(tile_relative_path) ;
32+
channel_index0 = channel_index - 1 ;
33+
channel_index0_as_string = num2str(channel_index0) ;
34+
p_map_file_name = sprintf('%s-prob.%s.h5', day_tile_index_as_string, channel_index0_as_string) ;
35+
p_map_tile_folder_path = fullfile(p_map_root_path, tile_relative_path) ;
36+
p_map_file_path = fullfile(p_map_tile_folder_path, p_map_file_name) ;
37+
38+
% Generate the landmarks from the p-map
39+
landmark_file_name = sprintf('%s-desc.%s.txt', day_tile_index_as_string, channel_index0_as_string) ;
40+
landmark_folder_path = fullfile(landmarks_root_path, tile_relative_path) ;
41+
landmark_file_path = fullfile(landmark_folder_path, landmark_file_name) ;
42+
43+
% % Make sure the output folder exists
44+
% ensure_folder_exists(landmark_folder_path) ;
45+
46+
% Run the core code
47+
siz = '[11 11 11]' ;
48+
sig1 = '[3.405500 3.405500 3.405500]' ;
49+
sig2 = '[4.049845 4.049845 4.049845]' ;
50+
ROI = '[5 1019 5 1531 5 250]' ;
51+
rt = '4' ;
52+
exitcode = dogDescriptor(p_map_file_path, landmark_file_path, siz, sig1, sig2, ROI, rt) ;
53+
if exitcode ~= 0 ,
54+
error('dogDescriptor() returned a nonzero exit code (%s) when trying to produce output file %s', exitcode, landmark_file_path) ;
55+
end
56+
end

compute_z_matches.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#! /bin/bash
2+
3+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
4+
cd "$SCRIPT_DIR"
5+
/misc/local/matlab-2019a/bin/matlab -batch "modpath; compute_z_matches_for_patrick_pipeline('$1', '$2', '$3', '$4', '$5')"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
function compute_z_matches_for_patrick_pipeline(landmarks_root_path, z_matches_root_path, tile_relative_path, ...
2+
fluorescence_root_path, other_tile_relative_path)
3+
4+
% Synthesize all the tile folder paths
5+
central_tile_landmark_folder_path = fullfile(landmarks_root_path, tile_relative_path) ;
6+
other_tile_landmark_folder_path = fullfile(landmarks_root_path, other_tile_relative_path) ;
7+
central_tile_fluorescence_folder_path = fullfile(fluorescence_root_path, tile_relative_path) ;
8+
other_tile_fluorescence_folder_path = fullfile(fluorescence_root_path, other_tile_relative_path) ;
9+
output_folder_name = fullfile(z_matches_root_path, tile_relative_path) ;
10+
11+
% Run for all channels
12+
pointmatch(central_tile_landmark_folder_path, ...
13+
other_tile_landmark_folder_path, ...
14+
central_tile_fluorescence_folder_path, ...
15+
other_tile_fluorescence_folder_path, ...
16+
output_folder_name) ;
17+
end

landmark-matching/pointmatch.m

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,21 @@ function pointmatch(central_tile_landmark_folder_path, ...
1111
% Front-end function to do z point-matching in the Patrick pipeline.
1212

1313
% Deal with arguments
14+
if ~exist('sample_metadata', 'var') || isempty(sample_metadata) ,
15+
sample_metadata = [] ; % only used when in debug mode
16+
end
1417
if ~exist('manual_nominal_other_tile_ijk_offset', 'var') || isempty(manual_nominal_other_tile_ijk_offset) ,
15-
manual_nominal_other_tile_ijk_offset = [] ;
18+
manual_nominal_other_tile_ijk_offset = [] ; % Means to just calculate the nominal offset
1619
end
1720
if ~exist('central_tile_ijk1', 'var') || isempty(central_tile_ijk1) ,
18-
central_tile_ijk1 = [nan nan nan] ;
21+
central_tile_ijk1 = [nan nan nan] ; % only ever used for debugging, and currently not used at all
1922
end
2023
if ~exist('maximum_landmark_count', 'var') || isempty(maximum_landmark_count) ,
21-
maximum_landmark_count = 1e3 ;
24+
maximum_landmark_count = 1e4 ;
2225
end
26+
if do_run_in_debug_mode && isempty(sample_metadata) ,
27+
error('sample_metadata must be nonempty in debug mode') ;
28+
end
2329

2430
% Read in stuff from input files
2531
central_tile_scope_struct = readScopeFile(central_tile_raw_folder_path) ;

0 commit comments

Comments
 (0)