Skip to content

Commit

Permalink
Merge pull request #16 from RodDalBen/development
Browse files Browse the repository at this point in the history
fix foreground/background separation. Disable template functionality. Issue #15
  • Loading branch information
RodDalBen authored Jan 26, 2024
2 parents 512c555 + 20b1218 commit 330a9be
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
10 changes: 6 additions & 4 deletions toolbox/SHINE_color.m
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
end

output_folder = outputpath;
template_folder = fullfile(pwd,'SHINE_color_TEMPLATE'); %marretado pra funcionar - PRECISAMOS INCLUIR UM ARGUMENTO NA LINHA DE COMANDO? OU ESSE CAMINHO NAO E' POSSIVEL POR LA?
template_folder = fullfile(pwd,'SHINE_color_TEMPLATE'); %template feature disable. Dummy value passed

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SHINE_color: wizard
Expand All @@ -248,9 +248,7 @@
error('At least 2 images are required. Please check pathnames and file format.') % SHINE_color: >= 2 images required
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SHINE_color: display info about transformations
it = displayInfo(mode,wholeIm,background,it);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SHINE_color: perform transformations
Expand All @@ -262,10 +260,14 @@
if cs == 1
% SHINE_color: separate foreground from background
[mask_fgr,mask_bgr,background] = maskFgrBgr(wholeIm,channel3,numim,background,template_folder,imformat,nargin);
% SHINE_color: display info about transformations
it = displayInfo(mode,wholeIm,background,it);
channel3_mod = processImage(channel3, mode, wholeIm, mask_fgr, mask_bgr, optim, rescaling);
elseif cs == 2
% SHINE_color: separate foreground from background
[mask_fgr,mask_bgr,background] = maskFgrBgr(wholeIm,channel1,numim,background,template_folder,imformat,nargin);
% SHINE_color: display info about transformations
it = displayInfo(mode,wholeIm,background,it);
channel1_mod = processImage(channel1, mode, wholeIm, mask_fgr, mask_bgr, optim, rescaling);
elseif cs == 3
channel1_mod = processImage(channel1, mode, wholeIm, [], [], optim, rescaling);
Expand Down
6 changes: 3 additions & 3 deletions toolbox/processImage.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
channel_mod = lumMatch(channel);
else
channel_mod = lumMatch(channel,mask_fgr);
channel_mod = lumMatch(channel,mask_bgr);
channel_mod = lumMatch(channel_mod,mask_bgr);
end
disp('Progress: lumMatch successful')
case {2, 5, 6}
if wholeIm == 1
channel_mod = histMatch(channel,optim);
else
channel_mod = histMatch(channel,optim,[],mask_fgr);
channel_mod = histMatch(channel,optim,[],mask_bgr);
channel_mod = histMatch(channel_mod,optim,[],mask_bgr);
end
disp('Progress: histMatch successful')
end
Expand All @@ -59,7 +59,7 @@
channel_mod = histMatch(channel,optim);
else
channel_mod = histMatch(channel,optim,[],mask_fgr);
channel_mod = histMatch(channel,optim,[],mask_bgr);
channel_mod = histMatch(channel_mod,optim,[],mask_bgr);
end
disp('Progress: histMatch successful')
end
Expand Down
1 change: 1 addition & 0 deletions toolbox/separate.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

if nargin < 3 || background > 255 || background < 0
background = image(find(max(imhist(image))));
%[~, background] = max(imhist(image));
end
idx = image==background;
image(idx) = 0;
Expand Down
6 changes: 3 additions & 3 deletions toolbox/userWizard.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
'Behavior Research Methods, 42(3), 671?684. http://doi.org/10.3758/BRM.42.3.671\n\n'])
error('Please select another colorspace.');

end
end
end

while y_n_plot ~= 1 && y_n_plot ~= 2
Expand Down Expand Up @@ -224,8 +224,8 @@
if wim == 2
wim = 0;
while wim ~= 2 && wim ~= 3
wim = 1+input('Segmentation of: [1=source images, 2=template(s)]: ');
if isempty(wim) == 1
wim = 1+input('Segmentation of: [1=source images]: '); %2=template(s)]: '); -template feature disable
if isempty(wim) == 1 || wim ~= 2 %template feature disable
disp(quitmsg)
error('Please select an option');
end
Expand Down

0 comments on commit 330a9be

Please sign in to comment.