Skip to content

Commit

Permalink
Corrected frame of saved render image in cat_surf_results.m
Browse files Browse the repository at this point in the history
ChristianGaser committed Feb 20, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 7e08fdf commit 790ba73
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Contents.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
% Computational Anatomy Toolbox
% Version 2545 (CAT12.9) 2024-02-18
% Version 2548 (CAT12.9) 2024-02-19
% ______________________________________________________________________
%
% Christian Gaser, Robert Dahnke
15 changes: 8 additions & 7 deletions cat_surf_results.m
Original file line number Diff line number Diff line change
@@ -3012,15 +3012,16 @@ function save_image(obj, event_obj, filename)
set(H.figure, 'InvertHardcopy', 'off', 'PaperPositionMode', 'auto');

% posc to correct margin of the figure [r t l b] if no dataplot is present
if isfield(H, 'dataplot') && strcmpi(get(H.dataplot,'Visible'),'on')
pos = round(getpixelposition(H.panel(1)));
else
pos = round(getpixelposition(H.panel(1)));
posc = [70 70 70 0]; pos = [pos(1) + posc(1), pos(2) + posc(4), pos(3) - posc(1) - posc(3), pos(4) - posc(2) - posc(4)];
hh0 = getframe(H.figure);
sz0 = [0 0 size(hh0.cdata,[2 1])];
pos = round(sz0.*H.panel(1).Position);

if ~(isfield(H, 'dataplot') && strcmpi(get(H.dataplot,'Visible'),'on'))
posc = [70 70 70 70]; pos = [pos(1) + posc(1), pos(2) + posc(2) + posc(4), pos(3) - posc(1) - posc(3), pos(4) - posc(2) - posc(4)];
end
hh = getframe(H.figure,pos);

img = frame2im(hh);
img = frame2im(hh0);
img = img(pos(2)+1:pos(2)+pos(4),pos(1)+1:pos(1)+pos(3),:);
if H.results_sel ~= 4 && ~isfield(H, 'dataplot')
% crop image if it's not a flatmap
sz = size(img);
2 changes: 1 addition & 1 deletion doc/cat.html
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@

<div id="content">
<br />
<p align="center" style="text-align:center;">This is <b>CAT12.9 (r2545) from 2024-02-18</b><br />You can update your copy of CAT12 here: <a href="matlab:cat_update(1);">Check for update</a>.<br />If you find any bug, please report them at <a href="mailto:vbmweb@gmail.com">vbmweb@gmail.com</a>.</p>
<p align="center" style="text-align:center;">This is <b>CAT12.9 (r2548) from 2024-02-19</b><br />You can update your copy of CAT12 here: <a href="matlab:cat_update(1);">Check for update</a>.<br />If you find any bug, please report them at <a href="mailto:vbmweb@gmail.com">vbmweb@gmail.com</a>.</p>
<h1 style="text-align:center;"><img src="images/CAT.png" width=40% height=auto alt="CAT" ></h1>

<hr />

0 comments on commit 790ba73

Please sign in to comment.