11function combineBaGoLROIs(pathnameR , filesR , pathnameB , filesB , MAPNfile , ...
2- keep_numbering )
2+ keep_numbering , GaussIm )
33% ---------- Possibly, combine individually processed BaGoL ROIs into a single
44% _ROIs.mat file using the _ROIs.mat file that was used to define
55% the ROIs originally from the SR data
@@ -34,6 +34,8 @@ function combineBaGoLROIs(pathnameR, filesR, pathnameB, filesB, MAPNfile, ...
3434% otherwise if true, assume MAPN_*.mat files
3535% keep_numbering retain the ROI numbering even if there are missing ROIs
3636% (which will be treated as empty) [default: false]
37+ % GaussIm true if the original SR ROIs were chosen from a Gaussian image
38+ % [default: false]
3739%
3840% OUTPUTS:
3941% Saves pathnameB/Analysis/*_BaGoL_ROIs.mat
@@ -44,6 +46,9 @@ function combineBaGoLROIs(pathnameR, filesR, pathnameB, filesB, MAPNfile, ...
4446 if ~exist(' keep_numbering' , ' var' )
4547 keep_numbering = false ;
4648 end
49+ if ~exist(' GaussIm' , ' var' )
50+ GaussIm = false ;
51+ end
4752
4853 results_dir = pathnameB ;
4954
@@ -149,10 +154,19 @@ function combineBaGoLROIs(pathnameR, filesR, pathnameB, filesB, MAPNfile, ...
149154 for j = 1 : n_labels
150155 Xnm = RoI{i }.X{j };
151156% if RT.GaussIm % if GaussIm, have DIPimage style coordinates
152- % Ynm = XYsize(2) - RoI{i}.Y;
157+ % Ynm = XYsize(2) - RoI{i}.Y{j} ;
153158% else
154159 Ynm = RoI{i }.Y{j };
155160% end
161+ % If the original SR ROIs were chosen via GaussIm and then run
162+ % individually through BaGoL, ymin and ymax are flipped about the
163+ % center of the image, so need to be corrected. This problem
164+ % really should be fixed when the BaGoL ROI is defined, but for now
165+ % ...
166+ if GaussIm && (ymin > min(Ynm ) || ymax < max(Ynm ))
167+ ymin = XYsize(2 ) - ymax ;
168+ ymax = XYsize(2 ) - ymin ;
169+ end
156170 l = xmin <= Xnm & Xnm <= xmax & ymin <= Ynm & Ynm <= ymax ;
157171 fprintf(' Cell %d ROI %d Label %d : %d points\n ' , c , i , j , sum(l ));
158172 % Check that l includes some points!
0 commit comments