Skip to content

Commit 537a2ce

Browse files
committed
Fixed combineBaGoLROIs to handle GaussIm defined ROIs.
1 parent 80fa042 commit 537a2ce

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

MATLAB/+smi_cluster/@ClusterInterface/ClusterInterface.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
combinedStatistics2(SC, colors, line_type, pathname, files, ...
3636
base_name, A_ROI, doHopkins)
3737
combineBaGoLROIs(pathnameR, filesR, pathnameB, filesB, MAPNfile, ...
38-
keep_numbering)
38+
keep_numbering, GaussIm)
3939
defineBaGoLROIs(pathnameR, filesR, pathnameB, filesB, MAPNfile, ...
4040
OriginLLvsUL)
4141
defineROIs(pathname, files, Pixel2nm, RT, oneROI, ROI_sizes)

MATLAB/+smi_cluster/@ClusterInterface/combineBaGoLROIs.m

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function 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!

MATLAB/+smi_helpers/versionSMITE.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@
2020
%version = '1.2.2'; % made HopTestPts and HopTests user adjustable
2121
%version = '1.2.3'; % add example script Example_SPT_movie
2222
%version = '1.2.4'; % add GaussIm option for hierBaGoLwrapper ROI mode
23-
version = '1.2.5'; % Added a new output style (GaussSEConst) to plotROI
23+
%version = '1.2.5'; % Added a new output style (GaussSEConst) to plotROI
24+
version = '1.2.6'; % Fixed combineBaGoLROIs to handle GaussIm defined ROIs
2425
end

MATLAB/examples/simpleROIcluster.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
end
157157

158158
CI.combineBaGoLROIs(pathnameR, filesR, pathnameB, filesB, MAPNfile, ...
159-
keep_numbering);
159+
keep_numbering, RT.GaussIm);
160160

161161
%% ---------- Possibly, filter out some ROIs
162162

0 commit comments

Comments
 (0)