MCPcopy Index your code
hub / github.com/ColmapView/Colmapview.github.io / resolve

Function resolve

src/utils/imageMappingCsvResolver.ts:118–140  ·  view source on GitHub ↗
(ctx: ImageResolveContext)

Source from the content-addressed store, hash-verified

116export const imageMappingCsvStrategy: ImageSourceStrategy = {
117 id: 'image-mapping-csv',
118 async resolve(ctx: ImageResolveContext) {
119 if (!ctx.fetchText) {
120 return null;
121 }
122 // Prefer a mapping CSV in the model directory; fall back to any in the tree.
123 const candidates = ctx.filePaths.filter(
124 (path) => getBasename(path).toLowerCase() === IMAGE_MAPPING_CSV_FILENAME
125 );
126 const csvPath =
127 candidates.find((path) => getParentDir(path) === ctx.modelDir) ?? candidates[0];
128 if (!csvPath) {
129 return null;
130 }
131
132 const text = await ctx.fetchText(csvPath);
133 if (!text) {
134 return null;
135 }
136 const imageNameToPath = parseImageMappingCsv(text);
137 return Object.keys(imageNameToPath).length > 0
138 ? { kind: 'per-image', imageNameToPath }
139 : null;
140 },
141};

Callers

nothing calls this directly

Calls 3

getBasenameFunction · 0.90
getParentDirFunction · 0.90
parseImageMappingCsvFunction · 0.85

Tested by

no test coverage detected