-
Notifications
You must be signed in to change notification settings - Fork 0
/
pad_and_find_candidate_somata.m
54 lines (46 loc) · 2.97 KB
/
pad_and_find_candidate_somata.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
49
50
51
52
53
54
function feature_struct_from_candidate_index = ...
pad_and_find_candidate_somata(rendered_folder_path, ...
gfp_channel_index, ...
background_channel_index, ...
zoom_level, ...
origin_at_zoom_level_xyz, ...
spacing_at_zoom_level_xyz, ...
substack_origin_ijk1, ...
substack_shape_ijk, ...
pad_depth_in_um, ...
parameters)
% substack_origin_ijk1 is the origin of the substack within the full stack at this zoom
substack_shape_xyz = spacing_at_zoom_level_xyz .* substack_shape_ijk ;
substack_origin_xyz = origin_at_zoom_level_xyz + spacing_at_zoom_level_xyz .* (substack_origin_ijk1-1) ;
pad_depth_ijk = ceil(pad_depth_in_um ./ spacing_at_zoom_level_xyz) ; % 3 x 1
padded_substack_origin_ijk1 = substack_origin_ijk1 - pad_depth_ijk ;
padded_substack_shape_ijk = substack_shape_ijk + 2*pad_depth_ijk ;
padded_substack_yxz = ...
get_mouselight_rendered_substack(rendered_folder_path, gfp_channel_index, padded_substack_origin_ijk1, padded_substack_shape_ijk, zoom_level) ;
padded_background_substack_yxz = ...
get_mouselight_rendered_substack(rendered_folder_path, background_channel_index, padded_substack_origin_ijk1, padded_substack_shape_ijk, zoom_level) ;
% substack_mip = max(padded_substack_yxz,[], 3) ;
%
% figure('color', 'w') ;
% imagesc(substack_mip) ;
% colormap(gray(256)) ;
% axis image
padded_substack_origin_xyz = spacing_at_zoom_level_xyz .* (padded_substack_origin_ijk1-1) + origin_at_zoom_level_xyz ;
% coord of voxel center of lowest-indices voxel
feature_struct_from_candidate_index = ...
find_candidate_somata_in_uint16_stack(padded_substack_yxz, ...
padded_background_substack_yxz, ...
padded_substack_origin_xyz, ...
origin_at_zoom_level_xyz, ...
spacing_at_zoom_level_xyz, ...
substack_origin_xyz, ...
substack_shape_xyz, ...
parameters) ;
% find_candidate_somata_in_uint16_stack(padded_substack_yxz, ...
% padded_substack_origin_xyz, ...
% origin_at_zoom_level_xyz, ...
% spacing_at_zoom_level_xyz, ...
% substack_origin_xyz, ...
% substack_shape_xyz, ...
% parameters)
end