image_and_segmentation_cutout() returns incorrect segment ids when it includes the optional argument scale_to_bounds=True. I think the unit64 are not correctly converting to int64 somewhere.
An example workflow here intends to find synapses of interest, then download the imagery and segmentation around them.
from caveclient import CAVEclient
import imageryclient as ic
import numpy as np
client = CAVEclient()
client = CAVEclient('minnie65_public')
client.version = 1300
input_syn_df = client.materialize.tables.synapse_target_predictions_ssa(tag="spine").query(select_columns=['ctr_pt_position', "pre_pt_root_id", "post_pt_root_id"], split_positions=True, desired_resolution=[4,4,40], limit=5)
img_client = ic.ImageryClient(client=client,timestamp=client.materialize.get_version_metadata(1300)['time_stamp'])
for index, entry in input_syn_df.iterrows():
x,y,z = entry["ctr_pt_position_x"], entry["ctr_pt_position_y"], entry["ctr_pt_position_z"]
image, segs = img_client.image_and_segmentation_cutout(
[x,y,z],
split_segmentations=True,
bbox_size=(512, 512),
scale_to_bounds=True
)
print(list(segs.keys()))
returns ids that are nowhere near the synapse of interest:
[864691133666932096 864691133666932352 864691133666932608
864691133666932864 864691134081916544 864691134081916800
864691134115780736 864691134115780992 864691134115781248
864691134784325632 864691134784325888 864691134784391680
864691134784392192 864691134784393216 864691134879175936
864691134879326976 864691134879327232 864691135465374976
864691135465375488 864691135465376000 864691135465399808
864691135465400320 864691135465400576 864691135465400832
864691135465401088 864691135465401344 864691135465401600
864691135465402112 864691135465402624 864691135465402880
864691135465403136 864691135465403648 864691135465403904
864691135465404160 864691135465404672 864691135465581824
864691135539021568 864691135540530944 864691135540539904
864691135541866496 864691135541866752 864691135800253056
864691136144659328 864691136291544064 864691136296029568
864691136296608640 864691136310291584 864691136339779072
864691136339783424]
visualized here: https://spelunker.cave-explorer.org/#!middleauth+https://global.daf-apis.com/nglstate/api/v1/4714596603527168
When removing the scale_to_bounds argument, it behaves as intended:
for index, entry in input_syn_df.iterrows():
x,y,z = entry["ctr_pt_position_x"], entry["ctr_pt_position_y"], entry["ctr_pt_position_z"]
image, segs = img_client.image_and_segmentation_cutout(
[x,y,z],
split_segmentations=True,
bbox_size=(512, 512),
)
print(list(segs.keys()))
[864691133666932035 864691133666932291 864691133666932547
864691133666932803 864691134081916592 864691134081916848
864691134115780686 864691134115780942 864691134115781198
864691134784325628 864691134784325884 864691134784391676
864691134784392188 864691134784393212 864691134879175994
864691134879327034 864691134879327290 864691135465374979
864691135465375491 864691135465376003 864691135465399811
864691135465400323 864691135465400579 864691135465400835
864691135465401091 864691135465401347 864691135465401603
864691135465402115 864691135465402627 864691135465402883
864691135465403139 864691135465403651 864691135465403907
864691135465404163 864691135465404675 864691135465581827
864691135539021555 864691135540530931 864691135540539891
864691135541866483 864691135541866739 864691135800253107
864691136144659331 864691136291544030 864691136296029581
864691136296608653 864691136310291597 864691136339779038
864691136339783390]
Visualized here: https://spelunker.cave-explorer.org/#!middleauth+https://global.daf-apis.com/nglstate/api/v1/5808924071559168
image_and_segmentation_cutout() returns incorrect segment ids when it includes the optional argument
scale_to_bounds=True. I think the unit64 are not correctly converting to int64 somewhere.An example workflow here intends to find synapses of interest, then download the imagery and segmentation around them.
returns ids that are nowhere near the synapse of interest:
visualized here: https://spelunker.cave-explorer.org/#!middleauth+https://global.daf-apis.com/nglstate/api/v1/4714596603527168
When removing the
scale_to_boundsargument, it behaves as intended:Visualized here: https://spelunker.cave-explorer.org/#!middleauth+https://global.daf-apis.com/nglstate/api/v1/5808924071559168