Skip to content

Commit 57254c5

Browse files
committed
[Matlab] Add basic Feature documentation
1 parent 27989d2 commit 57254c5

File tree

3 files changed

+69
-12
lines changed

3 files changed

+69
-12
lines changed

+nix/Feature.m

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
% nix.Feature class provides additional functionality to nix.Tag and nix.MultiTag.
2+
%
3+
% Features are created from a nix.Tag or a nix.MultiTag, linking these to an
4+
% additional nix.DataArray. The way how data from the respective DataArray
5+
% and the Tag/MultiTag are connected, is specified by the nix.LinkType of
6+
% the associated nix.Feature.
7+
%
8+
% nix.Property properties:
9+
% id (char): read-only, automatically created id of the entity.
10+
% linkType (nix.LinkType): see nix.LinkType description below.
11+
%
12+
% nix.LinkType.Tagged
13+
% This LinkType indicates, that the position and extent will be applied also
14+
% to the data stored via the Feature when it is fetched via the Tag/MultiTag.
15+
%
16+
% nix.LinkType.Untagged
17+
% This implies that the whole data stored in the linked DataArray belongs to
18+
% the Feature.
19+
%
20+
% nix.LinkType.Indexed
21+
% This LinkType is only valid for MultiTags where it indicates that the data linked
22+
% via this Feature has to be accessed according to the index in the respective
23+
% MulitTag position entry.
24+
%
25+
% Examples: %-- Returns the Features LinkType.
26+
% lt = currFeature.linkType();
27+
% %-- Sets the Feature LinkType. Has to be a valid nix.LinkType.
28+
% currFeature.linkType(nix.LinkType.Tagged);
29+
%
30+
% See also nix.LinkType, nix.DataArray, nix.Tag, nix.MultiTag.
31+
%
32+
%
133
% Copyright (c) 2016, German Neuroinformatics Node (G-Node)
234
%
335
% All rights reserved.
@@ -7,11 +39,9 @@
739
% LICENSE file in the root of the Project.
840

941
classdef Feature < nix.Entity
10-
% Feature nix Feature object
1142

1243
properties (Hidden)
13-
% namespace reference for nix-mx functions
14-
alias = 'Feature'
44+
alias = 'Feature' % nix-mx namespace to access Feature specific nix backend functions.
1545
end
1646

1747
properties (Dependent)
@@ -39,15 +69,38 @@
3969
end
4070

4171
function r = openData(obj)
72+
% Returns the DataArray referenced by the invoking Feature.
73+
%
74+
% Returns: (nix.DataArray) The unmodified DataArray entity
75+
% referenced by the invoking Feature.
76+
%
77+
% Example: getDataArray = currFeature.openData();
78+
%
79+
% See also nix.DataArray.
80+
4281
fname = strcat(obj.alias, '::openData');
4382
h = nix_mx(fname, obj.nixhandle);
4483
r = nix.Utils.createEntity(h, @nix.DataArray);
4584
end
4685

47-
function [] = setData(obj, data)
48-
id = nix.Utils.parseEntityId(data, 'nix.DataArray');
86+
function [] = setData(obj, idNameEntity)
87+
% Sets the DataArray referenced by the invoking Feature.
88+
%
89+
% idNameEntity (char/nix.DataArray): Name or id of the DataArray to be set
90+
% or the DataArray itself. Sets the
91+
% reference to the DataArray associated
92+
% with the invoking Feature. Will replace
93+
% any previous set reference.
94+
%
95+
% Example: currFeature.setData('some-data-array-id');
96+
% currFeature.setData('sessionData1');
97+
% currFeature.setData(dataArrayEntity);
98+
%
99+
% See also nix.DataArray.
100+
101+
parsed = nix.Utils.parseEntityId(idNameEntity, 'nix.DataArray');
49102
fname = strcat(obj.alias, '::setData');
50-
nix_mx(fname, obj.nixhandle, id);
103+
nix_mx(fname, obj.nixhandle, parsed);
51104
end
52105
end
53106

+nix/LinkType.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
% nix.LinkType class providing constant tyoes available for nix.Features
2+
%
3+
% See also nix.Feature.
4+
%
5+
%
16
% Copyright (c) 2016, German Neuroinformatics Node (G-Node)
27
%
38
% All rights reserved.
@@ -7,7 +12,6 @@
712
% LICENSE file in the root of the Project.
813

914
classdef LinkType
10-
% LINKTYPE nix link types
1115

1216
properties (Constant)
1317
Tagged = uint8(0);

tests/TestFeature.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
% TestFeature provides tests for all supported nix.Feature methods.
2+
%
13
% Copyright (c) 2016, German Neuroinformatics Node (G-Node)
24
%
35
% All rights reserved.
@@ -7,15 +9,13 @@
79
% LICENSE file in the root of the Project.
810

911
function funcs = TestFeature
10-
% TESTFEATURE tests for Feature
11-
1212
funcs = {};
1313
funcs{end+1} = @testOpenData;
1414
funcs{end+1} = @testHandleLinkType;
1515
funcs{end+1} = @testSetData;
1616
end
1717

18-
%% Test: Open data from feature
18+
%% Test: Open data from Feature
1919
function [] = testOpenData ( varargin )
2020
f = nix.File(fullfile(pwd, 'tests', 'testRW.h5'), nix.FileMode.Overwrite);
2121
b = f.createBlock('featureTest', 'nixBlock');
@@ -27,7 +27,7 @@
2727
assert(~isempty(feat.openData));
2828
end
2929

30-
%% Test: Get and set nix.LinkType
30+
%% Test: Get and set LinkType
3131
function [] = testHandleLinkType ( varargin )
3232
fileName = 'testRW.h5';
3333
f = nix.File(fullfile(pwd, 'tests', fileName), nix.FileMode.Overwrite);
@@ -63,7 +63,7 @@
6363
assert(f.blocks{1}.tags{1}.features{1}.linkType == 2);
6464
end
6565

66-
%% Test: Set data by entity, ID and name
66+
%% Test: Set data by entity, id and name
6767
function [] = testSetData ( varargin )
6868
fileName = 'testRW.h5';
6969
daName1 = 'featTestDA1';

0 commit comments

Comments
 (0)