Skip to content

Commit 651deb7

Browse files
committed
fix bug in horzcat
1 parent 931b210 commit 651deb7

File tree

5 files changed

+75
-12
lines changed

5 files changed

+75
-12
lines changed

src/@Image/cat.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
data = cat(dim, data, var.Data);
2727
end
2828

29-
res = Image('data', data);
29+
res = Image('data', data, 'Parent', obj);

src/@Image/horzcat.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@
1616

1717
% ------
1818
% Author: David Legland
19-
% e-mail: david.legland@inra.fr
19+
% e-mail: david.legland@inrae.fr
2020
% Created: 2011-08-04, using Matlab 7.9.0.529 (R2009b)
2121
% Copyright 2011 INRA - Cepia Software Platform.
2222

23-
data = obj.data;
24-
name = obj.name;
23+
data = obj.Data;
24+
name = obj.Name;
2525

2626
for i = 1:length(varargin)
27-
var = varargin{i};
28-
data = [data ; var.data]; %#ok<AGROW>
27+
var = varargin{i};
28+
data = [data ; var.Data]; %#ok<AGROW>
2929

30-
name = strcat(name, '+', var.name);
30+
name = strcat(name, '+', var.Name);
3131
end
3232

3333
res = Image( ...
34-
'data', data, ...
35-
'parent', obj, ...
36-
'name', name);
34+
'Data', data, ...
35+
'Parent', obj, ...
36+
'Name', name);

src/@Image/vertcat.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@
55
% RES = [IMG1 ; IMG2];
66
%
77
% Example
8-
% vertcat
8+
% % duplicate image in vertical direction
9+
% img = Image.read('cameraman.tif');
10+
% res = vertcat(img, img);
11+
% show(res);
912
%
1013
% See also
1114
% horzcat, repmat, cat
1215
%
1316

1417
% ------
1518
% Author: David Legland
16-
% e-mail: david.legland@inra.fr
19+
% e-mail: david.legland@inrae.fr
1720
% Created: 2011-08-04, using Matlab 7.9.0.529 (R2009b)
1821
% Copyright 2011 INRA - Cepia Software Platform.
1922

tests/image/test_horzcat.m

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
function tests = test_horzcat
2+
% Test suite for the file horzcat.
3+
%
4+
% Test suite for the file horzcat
5+
%
6+
% Example
7+
% test_horzcat
8+
%
9+
% See also
10+
% horzcat
11+
12+
% ------
13+
% Author: David Legland
14+
15+
% Created: 2020-12-07, using Matlab 9.8.0.1323502 (R2020a)
16+
% Copyright 2020 INRAE - BIA-BIBS.
17+
18+
tests = functiontests(localfunctions);
19+
20+
function test_Simple(testCase) %#ok<*DEFNU>
21+
% Test call of function without argument.
22+
23+
data = 200 * ones([20 30], 'uint8');
24+
img = Image(data);
25+
26+
res = horzcat(img, img);
27+
28+
assertTrue(testCase, isa(res, 'Image'));
29+
assertEqual(testCase, size(res), [60 20]);
30+

tests/image/test_vertcat.m

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
function tests = test_vertcat
2+
% Test suite for the file vertcat.
3+
%
4+
% Test suite for the file vertcat
5+
%
6+
% Example
7+
% test_vertcat
8+
%
9+
% See also
10+
% vertcat
11+
12+
% ------
13+
% Author: David Legland
14+
15+
% Created: 2020-12-07, using Matlab 9.8.0.1323502 (R2020a)
16+
% Copyright 2020 INRAE - BIA-BIBS.
17+
18+
tests = functiontests(localfunctions);
19+
20+
function test_Simple(testCase) %#ok<*DEFNU>
21+
% Test call of function without argument.
22+
23+
data = 200 * ones([20 30], 'uint8');
24+
img = Image(data);
25+
26+
res = vertcat(img, img);
27+
28+
assertTrue(testCase, isa(res, 'Image'));
29+
assertEqual(testCase, size(res), [30 40]);
30+

0 commit comments

Comments
 (0)