Skip to content

Commit

Permalink
Add fix for link generation with CloudVolume-backing (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
j6k4m8 authored Jun 4, 2024
1 parent 15073c6 commit 1a743cf
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions intern/convenience/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -1187,17 +1187,30 @@ def url(self):
"""
Get a pointer to this Channel on the BossDB page.
"""
# TODO: handle the CV case, in which case BossDB may not have the
# corresponding project page.
return f"{self.volume_provider.boss._project._base_protocol}://{self.volume_provider.boss._project._base_url}/v1/mgmt/resources/{self.collection_name}/{self.experiment_name}/{self.channel_name}"

@property
def visualize(self):
"""
Get a pointer to this Channel on the BossDB page.
"""
return "https://neuroglancer.bossdb.io/#!{'layers':{'image':{'source':'boss://__replace_me__'}}}".replace(
"__replace_me__",
f"{self.volume_provider.boss._project._base_protocol}://{self.volume_provider.boss._project._base_url}/{self.collection_name}/{self.experiment_name}/{self.channel_name}",
)
if self.volume_provider.get_vp_type() == "bossdb":
return 'https://neuroglancer.bossdb.io/#!{"layers":[{"type":"image","name":"image","source":"boss://__replace_me__"}]}'.replace(
"__replace_me__",
f"{self.volume_provider.boss._project._base_protocol}://{self.volume_provider.boss._project._base_url}/{self.collection_name}/{self.experiment_name}/{self.channel_name}",
)
elif self.volume_provider.get_vp_type() == "CloudVolumeOpenData":
return 'https://neuroglancer.bossdb.io/#!{"layers":[{"type":"image","name":"image","source":"precomputed://__replace_me__"}]}'.replace(
"__replace_me__",
f"s3://{self.volume_provider.cv_config['bucket']}/{self.volume_provider.cv_config['cloudpath']}",
)
else:
print(
"Cannot produce a neuroglancer link for data stored with "
+ self.volume_provider.get_vp_type()
)

@property
def shape(self) -> Tuple[int, int, int]:
Expand Down

0 comments on commit 1a743cf

Please sign in to comment.