|
12 | 12 | % ndi.session.dir, and asks the same readers. |
13 | 13 | % |
14 | 14 | % NEEDS DID-matlab's lightsheet migrators (claude/ecstatic-pascal-md91fw, |
15 | | -% 000aeb8 and later) and the composition did-schema they target, so |
| 15 | +% f363d98 and later: the method and the label on notes, Jess 2026-10-15) and the composition did-schema they target, so |
16 | 16 | % test-import-v2.yml runs it on the `next` leg only. It is not filtered on |
17 | 17 | % `current`; it is not selected there. |
18 | 18 | % |
@@ -60,27 +60,66 @@ function migrateAndWrite(testCase) |
60 | 60 |
|
61 | 61 | methods (Test) |
62 | 62 |
|
63 | | - function testTheBuilderNameIsTheMigrators(testCase) |
| 63 | + function testTheMethodIsTheMigrators(testCase) |
64 | 64 | % ndi.vintage.lightsheetPyramidDocs finds migrated pyramids by |
65 | | - % this one string; it must be the migrator's, character for |
66 | | - % character. |
67 | | - names = {}; |
| 65 | + % this method node (Jess 2026-10-15), on the path |
| 66 | + % interaction.method.node; it must be the migrator's, character |
| 67 | + % for character, and at that path. |
| 68 | + obs = []; |
68 | 69 | for k = 1:numel(testCase.Out) |
69 | | - d = testCase.Out{k}; |
70 | | - if strcmp(d.document_class.class_name, 'entity') || ... |
71 | | - strcmp(d.document_class.class_name, 'software') |
72 | | - n = ndi.v2.blockOf(d, 'software', 'name', ''); |
73 | | - if ~isempty(n), names{end+1} = char(n); end %#ok<AGROW> |
74 | | - end |
| 70 | + if strcmp(testCase.Out{k}.base.id, 'pyr_ls_1'), obs = testCase.Out{k}; end |
75 | 71 | end |
76 | | - testCase.verifyTrue(any(strcmp(names, ndi.vintage.lightsheetBuilderName())), ... |
77 | | - sprintf('software entities in the migration: %s', strjoin(names, ' | '))); |
| 72 | + testCase.assertNotEmpty(obs, 'the pyramid''s observation'); |
| 73 | + m = ndi.v2.blockOf(obs, 'interaction', 'method', []); |
| 74 | + if iscell(m), m = m{1}; end |
| 75 | + testCase.assertTrue(isstruct(m) && isfield(m, 'node'), ... |
| 76 | + 'the migrated pyramid carries interaction.method'); |
| 77 | + M = ndi.vintage.lightsheetMethod(); |
| 78 | + testCase.verifyEqual(char(m.node), M.node); |
| 79 | + testCase.verifyEqual(char(m.name), M.name); |
| 80 | + end |
| 81 | + |
| 82 | + function testTheLabelStaysOnTheObservation(testCase) |
| 83 | + % Jess 2026-10-15: the label is the observation's notes after the |
| 84 | + % batch pass, and the store body's description holds the NGFF |
| 85 | + % multiscales name only. |
| 86 | + d = testCase.Session.database_search(ndi.query('base.id', 'exact_string', 'pyr_ls_1')); |
| 87 | + testCase.assertNumElements(d, 1); |
| 88 | + testCase.verifyEqual(char(ndi.v2.blockOf(d{1}.document_properties, ... |
| 89 | + 'statement', 'notes', '')), 'brain 7 cleared'); |
| 90 | + [p, vintage] = ndi.vintage.lightsheetPyramid(d{1}, testCase.Session); |
| 91 | + testCase.verifyEqual(vintage, 'V_eta'); |
| 92 | + testCase.verifyEqual(p.label, 'brain 7 cleared'); |
| 93 | + testCase.verifyEqual(p.pyramid_name, 'mean'); |
| 94 | + testCase.verifyEqual(p.pyramid_type, '', 'pyramid_type is dropped'); |
| 95 | + end |
| 96 | + |
| 97 | + function testWithoutThePassTheReaderStillGetsTheLabel(testCase) |
| 98 | + % A bare v1_to_v2 call leaves the multiscales name after the |
| 99 | + % migrator's separator in notes; the reader's separator must be |
| 100 | + % the same literal, so the label it reads is the label alone. |
| 101 | + out = did2.convert.v1_to_v2({ndi.unittest.vintage.TestLightsheetMigrated.v1Pyramid()}, ... |
| 102 | + 'Validate', true, 'TargetVersion', 'V_eta'); |
| 103 | + testCase.assertEmpty(out.quarantine, ... |
| 104 | + ndi.unittest.vintage.TestLightsheetMigrated.reasons(out)); |
| 105 | + obs = []; |
| 106 | + for k = 1:numel(out.migrated) |
| 107 | + d = out.migrated{k}.toStruct(); |
| 108 | + if strcmp(d.base.id, 'pyr_ls_1'), obs = d; end |
| 109 | + end |
| 110 | + testCase.assertNotEmpty(obs); |
| 111 | + notes = char(ndi.v2.blockOf(obs, 'statement', 'notes', '')); |
| 112 | + testCase.verifySubstring(notes, 'NGFF multiscales name "mean"', ... |
| 113 | + 'without the pass the name is still on the notes'); |
| 114 | + p = ndi.vintage.lightsheetPyramid(obs); |
| 115 | + testCase.verifyEqual(p.label, 'brain 7 cleared'); |
78 | 116 | end |
79 | 117 |
|
80 | 118 | function testTheMigratedPyramidIsFoundAndListed(testCase) |
81 | 119 | docs = ndi.vintage.lightsheetPyramidDocs(testCase.Session); |
82 | 120 | ids = cellfun(@(d) d.id(), docs, 'UniformOutput', false); |
83 | | - testCase.verifyEqual(ids, {'pyr_ls_1'}, 'the pyramid keeps its id'); |
| 121 | + testCase.verifyEqual(ids, {'pyr_ls_1'}, ... |
| 122 | + 'the pyramid keeps its id, and is found by its method'); |
84 | 123 | rows = ndi.gui.app.LightsheetZarrManager.pyramidRows(testCase.Session); |
85 | 124 | testCase.verifyNumElements(rows, 1); |
86 | 125 | testCase.verifyEqual(rows(1).subjectID, 'subj_ls_1'); |
|
0 commit comments