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

Function findImagesRootDir

src/utils/colmapPathResolver.ts:208–217  ·  view source on GitHub ↗

* The canonical `images` root ancestor of an image path, if any. Images are * often nested in per-camera subdirectories (e.g. `images/cam_1/00.png`), so * the images directory is the `images` ancestor, not the file's immediate * parent. Returns null when no `images` segment is an ancestor.

(path: string)

Source from the content-addressed store, hash-verified

206 * parent. Returns null when no `images` segment is an ancestor.
207 */
208function findImagesRootDir(path: string): string | null {
209 const segments = path.replace(/\\/g, '/').split('/');
210 // Skip the filename (last segment); search ancestor directory segments.
211 for (let i = segments.length - 2; i >= 0; i -= 1) {
212 if (segments[i].toLowerCase() === 'images') {
213 return segments.slice(0, i + 1).join('/');
214 }
215 }
216 return null;
217}
218
219export function resolveImagesDir(
220 paths: Iterable<string>,

Callers 1

resolveImagesDirFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected