Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add warning for placeholder mips #571

Merged
merged 1 commit into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cloudvolume/datasource/precomputed/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ def __init__(
else:
self.provenance = self._cast_provenance(provenance)

def check_for_placeholder_scale(self, mip:int):
key = self.key(mip).lower()
return 'placeholder' in key

@classmethod
def create_info(cls,
num_channels, layer_type, data_type, encoding,
Expand Down
6 changes: 5 additions & 1 deletion cloudvolume/frontends/precomputed.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from ..cacheservice import CacheService
from .. import exceptions
from ..lib import (
colorize, red, mkdir,
colorize, yellow, red, mkdir,
Vec, Bbox, jsonify, BboxLikeType,
)

Expand Down Expand Up @@ -55,6 +55,10 @@ def __init__(self,
self.mip = mip
self.pid = os.getpid()

is_placeholder = self.meta.check_for_placeholder_scale(self.mip)
if is_placeholder:
print(yellow("Warning: The currently selected mip level is marked as a placeholder and likely has no associated image data."))

@property
def autocrop(self):
return self.image.autocrop
Expand Down