Skip to content

Commit

Permalink
feat: add warning for placeholder mips
Browse files Browse the repository at this point in the history
  • Loading branch information
william-silversmith committed Nov 22, 2022
1 parent 4ecb4f7 commit 76c134d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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

1 comment on commit 76c134d

@fcollman
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Please sign in to comment.