


ssoSegFunPerReg : starts segmentation of phase image and sets error flags
It creates the first set of good, bad and permanent segments and if
CONST.seg.OPTI_FLAG is set to true it optimizes the region sizes.
It uses perRegionOpti to optimize the regions.
INPUT :
phase_ : phase image
CONST : segmentation constants
header : string displayed with infromation
dataname :
crop_box : information about alignement of the image
OUTPUT :
data : contains information about the segments and mask, for more
information look at superSeggerOpti.
err_flag : set to true if there are more segments than max
Copyright (C) 2016 Wiggins Lab
Written by Stella Styliandou & Paul Wiggins.
University of Washington, 2016
This file is part of SuperSegger.
SuperSegger is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
SuperSegger is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with SuperSegger. If not, see <http://www.gnu.org/licenses/>.

0001 function [data, err_flag] = ssoSegFunPerReg( phase, CONST, header, dataname, crop_box) 0002 % ssoSegFunPerReg : starts segmentation of phase image and sets error flags 0003 % It creates the first set of good, bad and permanent segments and if 0004 % CONST.seg.OPTI_FLAG is set to true it optimizes the region sizes. 0005 % It uses perRegionOpti to optimize the regions. 0006 % 0007 % INPUT : 0008 % phase_ : phase image 0009 % CONST : segmentation constants 0010 % header : string displayed with infromation 0011 % dataname : 0012 % crop_box : information about alignement of the image 0013 % 0014 % OUTPUT : 0015 % data : contains information about the segments and mask, for more 0016 % information look at superSeggerOpti. 0017 % err_flag : set to true if there are more segments than max 0018 % 0019 % 0020 % Copyright (C) 2016 Wiggins Lab 0021 % Written by Stella Styliandou & Paul Wiggins. 0022 % University of Washington, 2016 0023 % This file is part of SuperSegger. 0024 % 0025 % SuperSegger is free software: you can redistribute it and/or modify 0026 % it under the terms of the GNU General Public License as published by 0027 % the Free Software Foundation, either version 3 of the License, or 0028 % (at your option) any later version. 0029 % 0030 % SuperSegger is distributed in the hope that it will be useful, 0031 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0032 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0033 % GNU General Public License for more details. 0034 % 0035 % You should have received a copy of the GNU General Public License 0036 % along with SuperSegger. If not, see <http://www.gnu.org/licenses/>. 0037 0038 if ~exist('header','var') 0039 header = ''; 0040 end 0041 0042 if ~exist('dataname','var') 0043 dataname = ''; 0044 end 0045 0046 if ~exist('crop_box','var') 0047 crop_box = ''; 0048 end 0049 0050 0051 % create the masks and segments 0052 disp_seg = ~CONST.seg.OPTI_FLAG; 0053 data = superSeggerOpti( phase ,[], disp_seg ,CONST, 1, header, crop_box); 0054 0055 if numel(data.segs.score) > CONST.superSeggerOpti.MAX_SEG_NUM; 0056 err_flag = true; 0057 save([dataname,'_too_many_segs'],'-STRUCT','data'); 0058 disp( [header,'BSSO ',dataname,'_too_many_segs'] ); 0059 return 0060 else 0061 err_flag = false; 0062 end 0063 0064 % optimize the regions with bad scores 0065 if CONST.seg.OPTI_FLAG 0066 data = perRegionOpti( data, 1, CONST,header); 0067 drawnow 0068 else 0069 data = intMakeRegs( data, CONST ); 0070 end 0071 0072 end 0073