Skip to content

Commit 331e924

Browse files
authored
Update TestDeepInterpolationDataStore.m
Update custom datastore test suite to use new 'enpacked' class name with +deepinterp root namespace
1 parent 7a7990d commit 331e924

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

tests/TestDeepInterpolationDataStore.m

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
%% Test 01: Check if matlab.io.Datastore is superclass.
2020
% A deepinterpolation datastore inherits from abstract Datastore
21-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
21+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
2222
assert(isa(dids,'matlab.io.Datastore'));
2323

2424
%% Test 02: Call the read
@@ -30,7 +30,7 @@
3030
% The first frame that allows that is the 32nd!
3131
% The combination of training data and center frame is called a "set" here, and the
3232
% number of sets, following the logic above, is N-Frames - 62.
33-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
33+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
3434
t = read(dids);
3535
assert(iscell(t));
3636
assert(numel(t) == 2);
@@ -39,7 +39,7 @@
3939

4040
%% Test 03: Call the read again
4141
% Standard sequential datastore behavior: advance to "second" center-frame
42-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
42+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
4343
read(dids);
4444
[t,info] = read(dids);
4545
assert(iscell(t));
@@ -50,7 +50,7 @@
5050

5151
%% Test 04: Successfully read until no more data
5252
% The testdatastack should return 38 sets of training frames and reference frame
53-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
53+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
5454
count = 0;
5555
while(hasdata(dids))
5656
read(dids);
@@ -59,7 +59,7 @@
5959
assert(count == 38);
6060

6161
%% Test 05: Call read when out of data
62-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
62+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
6363
try
6464
read(dids);
6565
catch ME
@@ -69,12 +69,12 @@
6969
%% Test 11: Call the readall method
7070
% Standard sequential datastore behavior: return all data in a nx2 Cell array, for
7171
% the test dataset n==38
72-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
72+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
7373
allt = readall(dids);
7474
assert(all(size(allt)==[38 2]));
7575

7676
%% Test 12: Call the readall method when out of data
77-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
77+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
7878
while(hasdata(dids))
7979
read(dids);
8080
end
@@ -83,7 +83,7 @@
8383

8484
%% Test 21: Call the reset method before any read
8585
% Reset to "first" frame (in fact, the 32nd frame in the stack...)
86-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
86+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
8787
reset(dids);
8888
[t,info] = read(dids);
8989
assert(iscell(t));
@@ -93,7 +93,7 @@
9393
assert(info == "set=1/centerframe=32");
9494

9595
%% Test 22: Call the reset method after some reads
96-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
96+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
9797
read(dids);
9898
read(dids);
9999
read(dids);
@@ -106,7 +106,7 @@
106106
assert(info == "set=1/centerframe=32");
107107

108108
%% Test 23: Call the reset method after readall
109-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
109+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
110110
read(dids);
111111
tall = readall(dids);
112112
reset(dids);
@@ -118,7 +118,7 @@
118118
assert(info == "set=1/centerframe=32");
119119

120120
%% Test 24: Call the reset method when out of data
121-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
121+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
122122
while(hasdata(dids))
123123
read(dids);
124124
end
@@ -131,32 +131,32 @@
131131
assert(info == "set=1/centerframe=32");
132132

133133
%% Test 31: Call the progress method before any reads
134-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
134+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
135135
p = progress(dids);
136136
assert(p==0);
137137

138138
%% Test 32: Call the progress method after readall but before read.
139-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
139+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
140140
readall(dids);
141141
p = progress(dids);
142142
assert(p==0);
143143

144144
%% Test 33: Call the progress method after read
145-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
145+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
146146
read(dids);
147147
p = progress(dids);
148148
assert((p-0.0270)<1e-4);
149149

150150
%% Test 34: Call the progress method when out of data
151-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
151+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
152152
while(hasdata(dids))
153153
read(dids);
154154
end
155155
p = progress(dids);
156156
assert((p-1.0)<1e-4);
157157

158158
%% Test 35: Progress produces correct output over all sets
159-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
159+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
160160
idx = 1;
161161
while(hasdata(dids))
162162
p(idx) = progress(dids);
@@ -168,7 +168,7 @@
168168
assert(all(diff(p) > 0), "progress must be monotonically increasing");
169169

170170
%% Test 41: Preview methods returns first set
171-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
171+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
172172
t = preview(dids);
173173
assert(iscell(t));
174174
assert(numel(t) == 2);
@@ -177,7 +177,7 @@
177177
assert((t{1}(323,23,44)-138)<1e-4);
178178

179179
%% Test 42: Preview methods returns first set after reads
180-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
180+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
181181
read(dids);
182182
read(dids);
183183
t = preview(dids);
@@ -188,7 +188,7 @@
188188
assert((t{1}(323,23,44)-138)<1e-4);
189189

190190
%% Test 43: Preview methods returns first set after readall
191-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
191+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
192192
readall(dids);
193193
t = preview(dids);
194194
assert(iscell(t));
@@ -198,7 +198,7 @@
198198
assert((t{1}(323,23,44)-138)<1e-4);
199199

200200
%% Test 44: Preview methods returns first set after reads and reset
201-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
201+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
202202
read(dids);
203203
read(dids);
204204
reset(dids);
@@ -210,7 +210,7 @@
210210
assert((t{1}(323,23,44)-138)<1e-4);
211211

212212
%% Test 45: Preview methods returns first set when out of data
213-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
213+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
214214
while hasdata(dids)
215215
read(dids);
216216
end
@@ -222,7 +222,7 @@
222222
assert((t{1}(323,23,44)-138)<1e-4);
223223

224224
%% Test 46: Read after preview is from correct location
225-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
225+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
226226
read(dids);
227227
read(dids);
228228
preview(dids);
@@ -234,13 +234,13 @@
234234
assert(info == "set=3/centerframe=34");
235235

236236
%% Test 47: Readall after preview works correctly
237-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
237+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
238238
preview(dids);
239239
allt = readall(dids);
240240
assert(all(size(allt)==[38 2]));
241241

242242
%% Test 48: Hasdata works correctly after preview
243-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
243+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
244244
read(dids);
245245
preview(dids);
246246
assert(hasdata(dids));
@@ -249,22 +249,22 @@
249249
% A partition of the deepinterpolation datastore is merely pointing to a different
250250
% startframe and has a smaller number of available sets. All the other behaviors are
251251
% derived from that
252-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
252+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
253253
subds = partition(dids,10,7);
254254
assert(isa(subds,'matlab.io.Datastore'));
255255

256256
%% Test 51: Call Partition, check if the partition has correct properties
257-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
257+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
258258
subds = partition(dids,10,7);
259259
assert(isequal(properties(dids),properties(subds)));
260260

261261
%% Test 52: Call Partition, check if the partition has correct methods
262-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
262+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
263263
subds = partition(dids,10,7);
264264
assert(isequal(methods(dids),methods(subds)));
265265

266266
%% Test 53: Call Partition, successfully read from a partition
267-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
267+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
268268
subds = partition(dids,10,7);
269269
[t,info] = read(subds);
270270
assert(iscell(t));
@@ -274,14 +274,14 @@
274274
assert(info == "set=1/centerframe=56");
275275

276276
%% Test 54: Call last Partition, read all data
277-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
277+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
278278
subds = partition(dids,13,13);
279279
while hasdata(subds)
280280
read(subds);
281281
end
282282

283283
%% Test 55: Call Partition, check that total number of sets/frames is correct
284-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
284+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
285285
partsets = 0;
286286
for iii = 1:10
287287
subds = partition(dids,10,iii);
@@ -290,15 +290,15 @@
290290
assert(partsets-38 < 1e-4);
291291

292292
%% Test 56: Call partition with partition=1 and index=1 and validate
293-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
293+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
294294
subds = partition(dids,1,1);
295295
assert(isequal(properties(dids),properties(subds)));
296296
assert(isequal(methods(dids),methods(subds)));
297297
assert(isequaln(read(subds),read(dids)));
298298
assert(isequaln(preview(subds),preview(dids)));
299299

300300
%% Test 57: Partition a partition again and validate
301-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
301+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
302302
subds = partition(dids,2,2);
303303
subsubds = partition(subds,2,2);
304304
[t,info] = read(subsubds);
@@ -309,7 +309,7 @@
309309
assert(info == "set=1/centerframe=61");
310310

311311
%% Test 58: Progress is working correctly in partitions
312-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
312+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
313313
subds = partition(dids,2,2);
314314
idx = 1;
315315
clear p
@@ -327,7 +327,7 @@
327327
%% Test 60: Create a Subset of the datastore and validate
328328
% deepinterpolation datastore is subsettable, again this just assigns the correct
329329
% startframe and number of available sets, but points to the same file
330-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
330+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
331331
subds = subset(dids,5:20);
332332
[t,info]=read(subds);
333333
assert(iscell(t));
@@ -337,7 +337,7 @@
337337
assert(info == "set=1/centerframe=36");
338338

339339
%% Test 61: Progress is working correctly in subsets
340-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
340+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
341341
subds = subset(dids,5:10);
342342
idx = 1;
343343
clear p
@@ -354,27 +354,27 @@
354354

355355
%% Test 71: Fail on wrong image size
356356
try
357-
dids = DeepInterpolationDataStore(WRONGSIZETESTSTACKFULLFILE); %#ok<NASGU>
357+
dids = deepinterp.Datastore(WRONGSIZETESTSTACKFULLFILE); %#ok<NASGU>
358358
catch EM
359359
assert(strcmp(EM.message,'Actual frame size is not equal to specified outputFrameSize'),"Fail on wrong tiff size");
360360
end
361361

362362
%% Test 72: Read data with automatic resize
363363
options.doAutoResize = true;
364-
dids = DeepInterpolationDataStore(WRONGSIZETESTSTACKFULLFILE, options);
364+
dids = deepinterp.Datastore(WRONGSIZETESTSTACKFULLFILE, options);
365365
t = read(dids);
366366
assert(iscell(t));
367367
assert(numel(t) == 2);
368368
assert(all((size(t{1})==[512 512 60])));
369369
assert(all((size(t{2})==[512 512])));
370370

371371
%% Test 81: Shuffling returns randomized datastore without error
372-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
372+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
373373
shds = shuffle(dids);
374374
assert(isa(shds,'matlab.io.Datastore'));
375375

376376
%% Test 82: can read sequentially from shuffled datastore
377-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
377+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
378378
shds = shuffle(dids);
379379
count = 0;
380380
while(hasdata(shds))
@@ -384,7 +384,7 @@
384384
assert(count == 38);
385385

386386
%% Test 83: can read all from shuffled datastore
387-
dids = DeepInterpolationDataStore(TESTSTACKFULLFILE);
387+
dids = deepinterp.Datastore(TESTSTACKFULLFILE);
388388
shds = shuffle(dids);
389389
allt = readall(shds);
390-
assert(all(size(allt)==[38 2]));
390+
assert(all(size(allt)==[38 2]));

0 commit comments

Comments
 (0)