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 );
2222assert(isa(dids ,' matlab.io.Datastore' ));
2323
2424%% Test 02: Call the read
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 );
3434t = read(dids );
3535assert(iscell(t ));
3636assert(numel(t ) == 2 );
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 );
4343read(dids );
4444[t ,info ] = read(dids );
4545assert(iscell(t ));
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 );
5454count = 0 ;
5555while (hasdata(dids ))
5656 read(dids );
5959assert(count == 38 );
6060
6161%% Test 05: Call read when out of data
62- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
62+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
6363try
6464 read(dids );
6565catch ME
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 );
7373allt = readall(dids );
7474assert(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 );
7878while (hasdata(dids ))
7979 read(dids );
8080end
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 );
8787reset(dids );
8888[t ,info ] = read(dids );
8989assert(iscell(t ));
9393assert(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 );
9797read(dids );
9898read(dids );
9999read(dids );
106106assert(info == " set=1/centerframe=32" );
107107
108108%% Test 23: Call the reset method after readall
109- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
109+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
110110read(dids );
111111tall = readall(dids );
112112reset(dids );
118118assert(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 );
122122while (hasdata(dids ))
123123 read(dids );
124124end
131131assert(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 );
135135p = progress(dids );
136136assert(p == 0 );
137137
138138%% Test 32: Call the progress method after readall but before read.
139- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
139+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
140140readall(dids );
141141p = progress(dids );
142142assert(p == 0 );
143143
144144%% Test 33: Call the progress method after read
145- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
145+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
146146read(dids );
147147p = progress(dids );
148148assert((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 );
152152while (hasdata(dids ))
153153 read(dids );
154154end
155155p = progress(dids );
156156assert((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 );
160160idx = 1 ;
161161while (hasdata(dids ))
162162 p(idx ) = progress(dids );
168168assert(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 );
172172t = preview(dids );
173173assert(iscell(t ));
174174assert(numel(t ) == 2 );
177177assert((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 );
181181read(dids );
182182read(dids );
183183t = preview(dids );
188188assert((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 );
192192readall(dids );
193193t = preview(dids );
194194assert(iscell(t ));
198198assert((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 );
202202read(dids );
203203read(dids );
204204reset(dids );
210210assert((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 );
214214while hasdata(dids )
215215 read(dids );
216216end
222222assert((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 );
226226read(dids );
227227read(dids );
228228preview(dids );
234234assert(info == " set=3/centerframe=34" );
235235
236236%% Test 47: Readall after preview works correctly
237- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
237+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
238238preview(dids );
239239allt = readall(dids );
240240assert(all(size(allt )==[38 2 ]));
241241
242242%% Test 48: Hasdata works correctly after preview
243- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
243+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
244244read(dids );
245245preview(dids );
246246assert(hasdata(dids ));
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 );
253253subds = partition(dids ,10 ,7 );
254254assert(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 );
258258subds = partition(dids ,10 ,7 );
259259assert(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 );
263263subds = partition(dids ,10 ,7 );
264264assert(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 );
268268subds = partition(dids ,10 ,7 );
269269[t ,info ] = read(subds );
270270assert(iscell(t ));
274274assert(info == " set=1/centerframe=56" );
275275
276276%% Test 54: Call last Partition, read all data
277- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
277+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
278278subds = partition(dids ,13 ,13 );
279279while hasdata(subds )
280280 read(subds );
281281end
282282
283283%% Test 55: Call Partition, check that total number of sets/frames is correct
284- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
284+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
285285partsets = 0 ;
286286for iii = 1 : 10
287287 subds = partition(dids ,10 ,iii );
290290assert(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 );
294294subds = partition(dids ,1 ,1 );
295295assert(isequal(properties(dids ),properties(subds )));
296296assert(isequal(methods(dids ),methods(subds )));
297297assert(isequaln(read(subds ),read(dids )));
298298assert(isequaln(preview(subds ),preview(dids )));
299299
300300%% Test 57: Partition a partition again and validate
301- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
301+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
302302subds = partition(dids ,2 ,2 );
303303subsubds = partition(subds ,2 ,2 );
304304[t ,info ] = read(subsubds );
309309assert(info == " set=1/centerframe=61" );
310310
311311%% Test 58: Progress is working correctly in partitions
312- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
312+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
313313subds = partition(dids ,2 ,2 );
314314idx = 1 ;
315315clear p
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 );
331331subds = subset(dids ,5 : 20 );
332332[t ,info ]=read(subds );
333333assert(iscell(t ));
337337assert(info == " set=1/centerframe=36" );
338338
339339%% Test 61: Progress is working correctly in subsets
340- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
340+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
341341subds = subset(dids ,5 : 10 );
342342idx = 1 ;
343343clear p
354354
355355%% Test 71: Fail on wrong image size
356356try
357- dids = DeepInterpolationDataStore (WRONGSIZETESTSTACKFULLFILE ); % #ok<NASGU>
357+ dids = deepinterp .Datastore (WRONGSIZETESTSTACKFULLFILE ); % #ok<NASGU>
358358catch EM
359359 assert(strcmp(EM .message ,' Actual frame size is not equal to specified outputFrameSize' )," Fail on wrong tiff size" );
360360end
361361
362362%% Test 72: Read data with automatic resize
363363options.doAutoResize = true ;
364- dids = DeepInterpolationDataStore (WRONGSIZETESTSTACKFULLFILE , options );
364+ dids = deepinterp .Datastore (WRONGSIZETESTSTACKFULLFILE , options );
365365t = read(dids );
366366assert(iscell(t ));
367367assert(numel(t ) == 2 );
368368assert(all((size(t{1 })==[512 512 60 ])));
369369assert(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 );
373373shds = shuffle(dids );
374374assert(isa(shds ,' matlab.io.Datastore' ));
375375
376376%% Test 82: can read sequentially from shuffled datastore
377- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
377+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
378378shds = shuffle(dids );
379379count = 0 ;
380380while (hasdata(shds ))
384384assert(count == 38 );
385385
386386%% Test 83: can read all from shuffled datastore
387- dids = DeepInterpolationDataStore (TESTSTACKFULLFILE );
387+ dids = deepinterp .Datastore (TESTSTACKFULLFILE );
388388shds = shuffle(dids );
389389allt = readall(shds );
390- assert(all(size(allt )==[38 2 ]));
390+ assert(all(size(allt )==[38 2 ]));
0 commit comments