0001 classdef BCObject < hgsetget
0002 properties
0003 dataset
0004 frame
0005 id
0006 col
0007 row
0008 area
0009 shape
0010 type
0011 status
0012
0013 end
0014
0015 methods
0016
0017 function cell = BCObject (dataset, frame, id, col, row, area, shape)
0018
0019
0020
0021
0022
0023
0024
0025
0026 if nargin == 1
0027
0028 if isstruct(dataset)
0029 cell = BCObject(dataset.dataset,...
0030 dataset.frame,...
0031 dataset.id,...
0032 dataset.col,...
0033 dataset.row);
0034 end
0035
0036 if length(dataset) == 5
0037 cell = BCObject(dataset(1),...
0038 dataset(2),...
0039 dataset(3),...
0040 dataset(4),...
0041 dataset(5));
0042 end
0043 elseif nargin >= 5
0044
0045 if ~isnumeric(dataset)
0046 error('BCObject: Dataset should be an integer.');
0047 end
0048 if ~isnumeric(frame)
0049 error('BCObject: Frame should be an integer.');
0050 end
0051 if ~isnumeric(id)
0052 error('BCObject: Id should be an integer.');
0053 end
0054 if ~isnumeric(col)
0055 error('BCObject: Col should be an integer.');
0056 end
0057 if ~isnumeric(row)
0058 error('BCObject: Row should be an integer.');
0059 end
0060
0061 cell.dataset = dataset;
0062 cell.frame = frame;
0063 cell.id = id;
0064 cell.col = col;
0065 cell.row = row;
0066
0067 if nargin == 7
0068 cell.area = area;
0069 cell.shape = shape;
0070 end
0071 else
0072 error('BCObject: Incorrect number of input arguments.');
0073 end
0074
0075 end
0076
0077
0078 function array = toArray(cell)
0079 array = [cell.dataset, cell.frame, cell.id, cell.col, cell.row];
0080 end
0081
0082
0083 function str = toStruct(cell)
0084 str = struct('dataset', cell.dataset,...
0085 'frame' , cell.frame,...
0086 'id' , cell.id,...
0087 'col' , cell.col,...
0088 'row' , cell.row);
0089 end
0090
0091
0092 function str = toString(cell)
0093 str = ['Cell #', num2str(cell.id),...
0094 ' (', num2str(cell.col),...
0095 ', ', num2str(cell.row),...
0096 ') in frame ', num2str(cell.frame),...
0097 ' of dataset ', num2str(cell.dataset)];
0098
0099
0100 end
0101
0102
0103 function die(cell)
0104 delete(cell);
0105 end
0106
0107 end
0108 end