MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / getMaskLookupPaths

Function getMaskLookupPaths

src/utils/imageFileLookupPolicy.ts:145–166  ·  view source on GitHub ↗
(imageName: string)

Source from the content-addressed store, hash-verified

143}
144
145export function getMaskLookupPaths(imageName: string): string[] {
146 const normalized = normalizeImagePath(imageName);
147 const replaced = normalized.replace(/\/images\//i, '/masks/').replace(/^images\//i, 'masks/');
148 const hasImagesInPath = replaced !== normalized;
149 const stripped = normalized.replace(/^images\//i, '');
150 const maskPath = `masks/${stripped}`;
151 const filename = normalized.split('/').pop() || '';
152 const maskByFilename = `masks/${filename}`;
153 const tryPaths: string[] = [];
154
155 if (hasImagesInPath) {
156 tryPaths.push(replaced, `${replaced}.png`);
157 }
158
159 tryPaths.push(maskPath, `${maskPath}.png`);
160
161 if (maskByFilename !== maskPath) {
162 tryPaths.push(maskByFilename, `${maskByFilename}.png`);
163 }
164
165 return tryPaths;
166}
167
168export function getMaskPathVariants(imageName: string): string[] {
169 const normalized = normalizeImagePath(imageName);

Callers 2

getMaskFileFunction · 0.90

Calls 1

normalizeImagePathFunction · 0.85

Tested by

no test coverage detected