18
18
19
19
%% Test 01: Check if matlab.io.Datastore is superclass.
20
20
% A deepinterpolation datastore inherits from abstract Datastore
21
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
21
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
22
22
assert(isa(dids ,' matlab.io.Datastore' ));
23
23
24
24
%% Test 02: Call the read
30
30
% The first frame that allows that is the 32nd!
31
31
% The combination of training data and center frame is called a "set" here, and the
32
32
% number of sets, following the logic above, is N-Frames - 62.
33
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
33
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
34
34
t = read(dids );
35
35
assert(iscell(t ));
36
36
assert(numel(t ) == 2 );
39
39
40
40
%% Test 03: Call the read again
41
41
% Standard sequential datastore behavior: advance to "second" center-frame
42
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
42
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
43
43
read(dids );
44
44
[t ,info ] = read(dids );
45
45
assert(iscell(t ));
50
50
51
51
%% Test 04: Successfully read until no more data
52
52
% The testdatastack should return 38 sets of training frames and reference frame
53
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
53
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
54
54
count = 0 ;
55
55
while (hasdata(dids ))
56
56
read(dids );
59
59
assert(count == 38 );
60
60
61
61
%% Test 05: Call read when out of data
62
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
62
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
63
63
try
64
64
read(dids );
65
65
catch ME
69
69
%% Test 11: Call the readall method
70
70
% Standard sequential datastore behavior: return all data in a nx2 Cell array, for
71
71
% the test dataset n==38
72
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
72
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
73
73
allt = readall(dids );
74
74
assert(all(size(allt )==[38 2 ]));
75
75
76
76
%% Test 12: Call the readall method when out of data
77
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
77
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
78
78
while (hasdata(dids ))
79
79
read(dids );
80
80
end
83
83
84
84
%% Test 21: Call the reset method before any read
85
85
% Reset to "first" frame (in fact, the 32nd frame in the stack...)
86
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
86
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
87
87
reset(dids );
88
88
[t ,info ] = read(dids );
89
89
assert(iscell(t ));
93
93
assert(info == " set=1/centerframe=32" );
94
94
95
95
%% Test 22: Call the reset method after some reads
96
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
96
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
97
97
read(dids );
98
98
read(dids );
99
99
read(dids );
106
106
assert(info == " set=1/centerframe=32" );
107
107
108
108
%% Test 23: Call the reset method after readall
109
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
109
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
110
110
read(dids );
111
111
tall = readall(dids );
112
112
reset(dids );
118
118
assert(info == " set=1/centerframe=32" );
119
119
120
120
%% Test 24: Call the reset method when out of data
121
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
121
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
122
122
while (hasdata(dids ))
123
123
read(dids );
124
124
end
131
131
assert(info == " set=1/centerframe=32" );
132
132
133
133
%% Test 31: Call the progress method before any reads
134
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
134
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
135
135
p = progress(dids );
136
136
assert(p == 0 );
137
137
138
138
%% Test 32: Call the progress method after readall but before read.
139
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
139
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
140
140
readall(dids );
141
141
p = progress(dids );
142
142
assert(p == 0 );
143
143
144
144
%% Test 33: Call the progress method after read
145
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
145
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
146
146
read(dids );
147
147
p = progress(dids );
148
148
assert((p - 0.0270 )<1e- 4 );
149
149
150
150
%% Test 34: Call the progress method when out of data
151
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
151
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
152
152
while (hasdata(dids ))
153
153
read(dids );
154
154
end
155
155
p = progress(dids );
156
156
assert((p - 1.0 )<1e- 4 );
157
157
158
158
%% Test 35: Progress produces correct output over all sets
159
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
159
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
160
160
idx = 1 ;
161
161
while (hasdata(dids ))
162
162
p(idx ) = progress(dids );
168
168
assert(all(diff(p ) > 0 ), " progress must be monotonically increasing" );
169
169
170
170
%% Test 41: Preview methods returns first set
171
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
171
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
172
172
t = preview(dids );
173
173
assert(iscell(t ));
174
174
assert(numel(t ) == 2 );
177
177
assert((t{1 }(323 ,23 ,44 )-138 )<1e- 4 );
178
178
179
179
%% Test 42: Preview methods returns first set after reads
180
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
180
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
181
181
read(dids );
182
182
read(dids );
183
183
t = preview(dids );
188
188
assert((t{1 }(323 ,23 ,44 )-138 )<1e- 4 );
189
189
190
190
%% Test 43: Preview methods returns first set after readall
191
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
191
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
192
192
readall(dids );
193
193
t = preview(dids );
194
194
assert(iscell(t ));
198
198
assert((t{1 }(323 ,23 ,44 )-138 )<1e- 4 );
199
199
200
200
%% Test 44: Preview methods returns first set after reads and reset
201
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
201
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
202
202
read(dids );
203
203
read(dids );
204
204
reset(dids );
210
210
assert((t{1 }(323 ,23 ,44 )-138 )<1e- 4 );
211
211
212
212
%% Test 45: Preview methods returns first set when out of data
213
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
213
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
214
214
while hasdata(dids )
215
215
read(dids );
216
216
end
222
222
assert((t{1 }(323 ,23 ,44 )-138 )<1e- 4 );
223
223
224
224
%% Test 46: Read after preview is from correct location
225
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
225
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
226
226
read(dids );
227
227
read(dids );
228
228
preview(dids );
234
234
assert(info == " set=3/centerframe=34" );
235
235
236
236
%% Test 47: Readall after preview works correctly
237
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
237
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
238
238
preview(dids );
239
239
allt = readall(dids );
240
240
assert(all(size(allt )==[38 2 ]));
241
241
242
242
%% Test 48: Hasdata works correctly after preview
243
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
243
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
244
244
read(dids );
245
245
preview(dids );
246
246
assert(hasdata(dids ));
249
249
% A partition of the deepinterpolation datastore is merely pointing to a different
250
250
% startframe and has a smaller number of available sets. All the other behaviors are
251
251
% derived from that
252
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
252
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
253
253
subds = partition(dids ,10 ,7 );
254
254
assert(isa(subds ,' matlab.io.Datastore' ));
255
255
256
256
%% Test 51: Call Partition, check if the partition has correct properties
257
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
257
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
258
258
subds = partition(dids ,10 ,7 );
259
259
assert(isequal(properties(dids ),properties(subds )));
260
260
261
261
%% Test 52: Call Partition, check if the partition has correct methods
262
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
262
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
263
263
subds = partition(dids ,10 ,7 );
264
264
assert(isequal(methods(dids ),methods(subds )));
265
265
266
266
%% Test 53: Call Partition, successfully read from a partition
267
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
267
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
268
268
subds = partition(dids ,10 ,7 );
269
269
[t ,info ] = read(subds );
270
270
assert(iscell(t ));
274
274
assert(info == " set=1/centerframe=56" );
275
275
276
276
%% Test 54: Call last Partition, read all data
277
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
277
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
278
278
subds = partition(dids ,13 ,13 );
279
279
while hasdata(subds )
280
280
read(subds );
281
281
end
282
282
283
283
%% Test 55: Call Partition, check that total number of sets/frames is correct
284
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
284
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
285
285
partsets = 0 ;
286
286
for iii = 1 : 10
287
287
subds = partition(dids ,10 ,iii );
290
290
assert(partsets - 38 < 1e-4 );
291
291
292
292
%% Test 56: Call partition with partition=1 and index=1 and validate
293
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
293
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
294
294
subds = partition(dids ,1 ,1 );
295
295
assert(isequal(properties(dids ),properties(subds )));
296
296
assert(isequal(methods(dids ),methods(subds )));
297
297
assert(isequaln(read(subds ),read(dids )));
298
298
assert(isequaln(preview(subds ),preview(dids )));
299
299
300
300
%% Test 57: Partition a partition again and validate
301
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
301
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
302
302
subds = partition(dids ,2 ,2 );
303
303
subsubds = partition(subds ,2 ,2 );
304
304
[t ,info ] = read(subsubds );
309
309
assert(info == " set=1/centerframe=61" );
310
310
311
311
%% Test 58: Progress is working correctly in partitions
312
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
312
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
313
313
subds = partition(dids ,2 ,2 );
314
314
idx = 1 ;
315
315
clear p
327
327
%% Test 60: Create a Subset of the datastore and validate
328
328
% deepinterpolation datastore is subsettable, again this just assigns the correct
329
329
% startframe and number of available sets, but points to the same file
330
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
330
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
331
331
subds = subset(dids ,5 : 20 );
332
332
[t ,info ]=read(subds );
333
333
assert(iscell(t ));
337
337
assert(info == " set=1/centerframe=36" );
338
338
339
339
%% Test 61: Progress is working correctly in subsets
340
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
340
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
341
341
subds = subset(dids ,5 : 10 );
342
342
idx = 1 ;
343
343
clear p
354
354
355
355
%% Test 71: Fail on wrong image size
356
356
try
357
- dids = DeepInterpolationDataStore (WRONGSIZETESTSTACKFULLFILE ); % #ok<NASGU>
357
+ dids = deepinterp .Datastore (WRONGSIZETESTSTACKFULLFILE ); % #ok<NASGU>
358
358
catch EM
359
359
assert(strcmp(EM .message ,' Actual frame size is not equal to specified outputFrameSize' )," Fail on wrong tiff size" );
360
360
end
361
361
362
362
%% Test 72: Read data with automatic resize
363
363
options.doAutoResize = true ;
364
- dids = DeepInterpolationDataStore (WRONGSIZETESTSTACKFULLFILE , options );
364
+ dids = deepinterp .Datastore (WRONGSIZETESTSTACKFULLFILE , options );
365
365
t = read(dids );
366
366
assert(iscell(t ));
367
367
assert(numel(t ) == 2 );
368
368
assert(all((size(t{1 })==[512 512 60 ])));
369
369
assert(all((size(t{2 })==[512 512 ])));
370
370
371
371
%% Test 81: Shuffling returns randomized datastore without error
372
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
372
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
373
373
shds = shuffle(dids );
374
374
assert(isa(shds ,' matlab.io.Datastore' ));
375
375
376
376
%% Test 82: can read sequentially from shuffled datastore
377
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
377
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
378
378
shds = shuffle(dids );
379
379
count = 0 ;
380
380
while (hasdata(shds ))
384
384
assert(count == 38 );
385
385
386
386
%% Test 83: can read all from shuffled datastore
387
- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
387
+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
388
388
shds = shuffle(dids );
389
389
allt = readall(shds );
390
- assert(all(size(allt )==[38 2 ]));
390
+ assert(all(size(allt )==[38 2 ]));
0 commit comments