Skip to content

Commit

Permalink
separated integration tests from unit tests, updated script for slab …
Browse files Browse the repository at this point in the history
…stitching
  • Loading branch information
khaledkhairy committed Mar 24, 2016
1 parent 823d288 commit a7fb684
Show file tree
Hide file tree
Showing 27 changed files with 800 additions and 7,693 deletions.
4 changes: 0 additions & 4 deletions X_A_584665.txt

This file was deleted.

3,386 changes: 0 additions & 3,386 deletions X_A_632360.txt

This file was deleted.

3,386 changes: 0 additions & 3,386 deletions X_A_97541.txt

This file was deleted.

13 changes: 11 additions & 2 deletions classes/@Msection/show_tile.m
Expand Up @@ -57,9 +57,18 @@
im = [];
return;
else
%[im, Wbox, imlabel] = render_poly_02(L.tiles, scale, Wbox, 0,t, mask_list, mask_fn);
[im, Wbox, imlabel] = render_poly_06(L.tiles, scale, Wbox, 0, stack);
t = obj.tiles(tile_show);
rc.baseURL = t.server;
rc.owner = t.owner;
rc.project = t.project;
rc.stack = t.stack;
im = get_image_box_renderer(rc, t.z, Wbox, scale, t.dir_temp_render, t.renderer_id);



%%% use Renderer client for getting individual tiles, and let matlab assemble them
% [im, Wbox, imlabel] = render_poly_06(L.tiles, scale, Wbox, 0, stack);
%
warning off;imshow(im);warning on;
% %% optionally show the text labels overlaid onto the tile images
if fz
Expand Down
40 changes: 40 additions & 0 deletions external/get_image_box_renderer.m
@@ -0,0 +1,40 @@
function [im, v] = get_image_box_renderer(rc, z, Wbox, scale, dir_temp_render, renderer_id)
% Returns the image of a specified box in collection rc
% use Renderer client for complete box
% /v1/owner/{owner}/project/{project}/stack/{stack}/z/{z}/box/{x},{y},{width},{height},{scale}/jpeg-image
%
% Author: Khaled Khairy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
v = [];
fn = [dir_temp_render '/tile_image_' num2str(randi(1000)) '_' renderer_id '.jpg'];
url = sprintf('%s/owner/%s/project/%s/stack/%s/z/%s/box/%.0f,%.0f,%.0f,%.0f,%s/render-parameters?filter=true',...
rc.baseURL, rc.owner, rc.project, rc.stack, num2str(z),Wbox(1), ...
Wbox(2), ...
Wbox(3), ...
Wbox(4), ...
num2str(scale));



% we will try multiple times
cmd = sprintf('/groups/flyTEM/flyTEM/render/bin/render.sh --memory 7g --out %s --parameters_url "%s"', fn, url);
[a, resp_str] = system(cmd);
file_ready = 0;
count = 1;
while ~(file_ready) && count<200
pause(0.05);
file_ready = [exist(fn,'file')==2];
count = count + 1;
end
try
pause(1.0);
im = imread(fn, 'jpeg');
%if nargout>1, v = webread(url);end
catch err_reading_image
kk_disp_err(err_reading_image);
disp('Retrying');
pause(1.0);
im = imread(fn, 'jpeg');
end
im = rgb2gray(im);
delete(fn);
39 changes: 39 additions & 0 deletions external/get_image_box_renderer.m~
@@ -0,0 +1,39 @@
function [im, v] = get_image_box_renderer(rc, z, Wbox, scale, dir_temp_render, renderer_id)
% Returns the image of a specified box in collection rc
% use Renderer client for complete box
% /v1/owner/{owner}/project/{project}/stack/{stack}/z/{z}/box/{x},{y},{width},{height},{scale}/jpeg-image
%
% Author: Khaled Khairy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
v = [];
fn = [dir_temp_render '/tile_image_' num2str(randi(1000)) '_' renderer_id '.jpg'];
url = sprintf('%s/owner/%s/project/%s/stack/%s/z/%s/box/%.0f,%.0f,%.0f,%.0f,%s/render-parameters?filter=true',...
rc.baseURL, rc.owner, rc.project, rc.stack, num2str(z),Wbox(1), ...
Wbox(2), ...
Wbox(3), ...
Wbox(4), ...
num2str(scale));

if nargout>1, v = webread(url);end

% we will try four times
cmd = sprintf('/groups/flyTEM/flyTEM/render/bin/render.sh --memory 7g --out %s --parameters_url "%s"', fn, url);
[a, resp_str] = system(cmd);
file_ready = 0;
count = 1;
while ~(file_ready) && count<200
pause(0.01);
file_ready = [exist(fn,'file')==2];
count = count + 1;
end
try
pause(1.0);
im = imread(fn, 'jpeg');
catch err_reading_image
kk_disp_err(err_reading_image);
disp('Retrying');
pause(1.0);
im = imread(fn, 'jpeg');
end
im = rgb2gray(im);
delete(fn);
11 changes: 11 additions & 0 deletions external/get_section_bounds_renderer.m
@@ -0,0 +1,11 @@
function [Wbox, bbox] = get_section_bounds_renderer(rc, z)
% returns Wbox = [x y width height] of the section L as specified in rc
% /v1/owner/{owner}/project/{project}/stack/{stack}/z/{z}/bounds


url = sprintf('%s/owner/%s/project/%s/stack/%s/z/%s/bounds',...
rc.baseURL, rc.owner, rc.project, rc.stack, num2str(z));

js = webread(url);
Wbox = [js.minX js.minY js.maxX-js.minX js.maxY-js.minY];
bbox = [js.minX js.minY js.maxX js.maxY];
33 changes: 20 additions & 13 deletions external/point_match_gen_SIFT.m
@@ -1,5 +1,5 @@
function [m12_1, m12_2, js] = point_match_gen_SIFT(t1, t2)
% Return point-matches based on SIFT features
function [m12_1, m12_2, v] = point_match_gen_SIFT(url1, url2)
% Return point-matches based on SIFT features --- still under development
%
% Depends on Eric T.'s packaging of Saalfeld's code that uses SIFT and filters point matches
%
Expand All @@ -8,14 +8,25 @@
%
% Author: Khaled Khairy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
m12_1 = [];
m12_2 = [];
v = [];
if nargin<3, run_local = 1;end

% URLs could be anything that the Renderer can interpret accoring to its API.
% for example tile urls should look like this:
% url1 = sprintf('%s/owner/%s/project/%s/stack/%s/tile/%s/render-parameters?filter=true',...
% t1.server, t1.owner, t1.project, t1.stack, t1.renderer_id);
% url2 = sprintf('%s/owner/%s/project/%s/stack/%s/tile/%s/render-parameters?filter=true',...
% t2.server, t2.owner, t2.project, t2.stack, t2.renderer_id);

% tile urls should look like this:
%http://10.37.5.60:8080/render-ws/v1/owner/flyTEM/project/test/stack/EXP_v12_SURF_rough_1_4/tile/151215054802009008.3.0/render-parameters?filter=true
% command issued to system
%/groups/flyTEM/flyTEM/render/bin/gen-match.sh --memory 7G --numberOfThreads 8 --baseDataUrl "${BASE_DATA_URL}" --owner trautmane --collection test_match_gen ${TILE_URL_PAIRS} | tee -a log.txt

tm = clock;
file_code = [num2str(tm(6)) '_' num2str(randi(1000000000000))];

file_code = num2str(randi(1000000)) ;
fn_pm = ['/groups/flyTEM/home/khairyk/mwork/temp/matches_' file_code '.json'];
fn_log = ['groups/flyTEM/home/khairyk/mwork/temp/log_' file_code '.txt'];

Expand All @@ -27,10 +38,6 @@
str_collection = '--collection test_match_gen ';


url1 = sprintf('%s/owner/%s/project/%s/stack/%s/tile/%s/render-parameters?filter=true',...
t1.server, t1.owner, t1.project, t1.stack, t1.renderer_id);
url2 = sprintf('%s/owner/%s/project/%s/stack/%s/tile/%s/render-parameters?filter=true',...
t2.server, t2.owner, t2.project, t2.stack, t2.renderer_id);
str_pairs =[url1 ' ' url2];

str_parameters = [' --matchStorageFile ' fn_pm ' | tee -a ' fn_log];
Expand All @@ -39,8 +46,8 @@


[a, resp_str] = system(str);
disp(resp_str);

%disp(resp_str);
%wait_for_file(fn_pm, 10);

%% read json file
try
Expand All @@ -61,14 +68,14 @@
m12_2 = m12_2(indx,:);
m12_1 = m12_1(indx,:);
end
figure; showMatchedFeatures(get_image(t1), get_image(t2), m12_1, m12_2, 'montage');

else
warning('No point-matches found');
warning('No point-matches found -- empty set returned');
end


%% cleanup
delete fn_pm;
delete(fn_pm);



Expand Down
29 changes: 18 additions & 11 deletions external/point_match_gen_SIFT.m~
@@ -1,5 +1,5 @@
function [m12_1, m12_2, js] = point_match_gen_SIFT(t1, t2)
% Return point-matches based on SIFT features
function [m12_1, m12_2, v] = point_match_gen_SIFT(url1, url2, run_local)
% Return point-matches based on SIFT features --- still under development
%
% Depends on Eric T.'s packaging of Saalfeld's code that uses SIFT and filters point matches
%
Expand All @@ -8,14 +8,25 @@ function [m12_1, m12_2, js] = point_match_gen_SIFT(t1, t2)
%
% Author: Khaled Khairy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
m12_1 = [];
m12_2 = [];
v = [];
if nargin<3, run_local = 1;end

% URLs could be anything that the Renderer can interpret accoring to its API.
% for example tile urls should look like this:
% url1 = sprintf('%s/owner/%s/project/%s/stack/%s/tile/%s/render-parameters?filter=true',...
% t1.server, t1.owner, t1.project, t1.stack, t1.renderer_id);
% url2 = sprintf('%s/owner/%s/project/%s/stack/%s/tile/%s/render-parameters?filter=true',...
% t2.server, t2.owner, t2.project, t2.stack, t2.renderer_id);

% tile urls should look like this:
%http://10.37.5.60:8080/render-ws/v1/owner/flyTEM/project/test/stack/EXP_v12_SURF_rough_1_4/tile/151215054802009008.3.0/render-parameters?filter=true
% command issued to system
%/groups/flyTEM/flyTEM/render/bin/gen-match.sh --memory 7G --numberOfThreads 8 --baseDataUrl "${BASE_DATA_URL}" --owner trautmane --collection test_match_gen ${TILE_URL_PAIRS} | tee -a log.txt

tm = clock;
file_code = [num2str(tm(6)) '_' num2str(randi(1000000000000))];

file_code = num2str(randi(1000000)) ;
fn_pm = ['/groups/flyTEM/home/khairyk/mwork/temp/matches_' file_code '.json'];
fn_log = ['groups/flyTEM/home/khairyk/mwork/temp/log_' file_code '.txt'];

Expand All @@ -27,10 +38,6 @@ str_owner = '--owner trautmane ';
str_collection = '--collection test_match_gen ';


url1 = sprintf('%s/owner/%s/project/%s/stack/%s/tile/%s/render-parameters?filter=true',...
t1.server, t1.owner, t1.project, t1.stack, t1.renderer_id);
url2 = sprintf('%s/owner/%s/project/%s/stack/%s/tile/%s/render-parameters?filter=true',...
t2.server, t2.owner, t2.project, t2.stack, t2.renderer_id);
str_pairs =[url1 ' ' url2];

str_parameters = [' --matchStorageFile ' fn_pm ' | tee -a ' fn_log];
Expand All @@ -40,7 +47,7 @@ str = [base_cmd str_memory str_n_threads str_base_data_url str_owner str_collect

[a, resp_str] = system(str);
disp(resp_str);

wait_for_file(fn_pm, 10);

%% read json file
try
Expand All @@ -61,14 +68,14 @@ if ~isempty(v{1}.matches.p)
m12_2 = m12_2(indx,:);
m12_1 = m12_1(indx,:);
end
figure; showMatchedFeatures(get_image(t1), get_image(t2), m12_1, m12_2, 'montage');

else
warning('No point-matches found');
end


%% cleanup
delete fn_pm;
delete(fn_pm);



Expand Down

0 comments on commit a7fb684

Please sign in to comment.