-
Notifications
You must be signed in to change notification settings - Fork 12
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
Fix parallel buffered slice writer bug #922
Changes from 8 commits
9204b09
2bb3883
54d3477
3fe785e
7c6f46d
44dd88c
52cc6b6
5fe1387
1863194
3bbcd06
a6366c1
f230aed
e3336f7
1f4f773
9122256
cf643d1
b21b997
54acf99
ea7dc34
3256aa0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -192,6 +192,7 @@ def write( | |
self, | ||
data: np.ndarray, | ||
offset: Optional[Vec3IntLike] = None, # deprecated, relative, in current mag | ||
update_bbox: bool = True, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe in this context it is rather something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, did you test what happens if there is a write outside of the existing box? does it just work? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
*, | ||
relative_offset: Optional[Vec3IntLike] = None, # in mag1 | ||
absolute_offset: Optional[Vec3IntLike] = None, # in mag1 | ||
|
@@ -243,9 +244,10 @@ def write( | |
abs_mag1_offset=absolute_offset, | ||
current_mag_size=Vec3Int(data.shape[-3:]), | ||
) | ||
assert self.bounding_box.contains_bbox( | ||
mag1_bbox | ||
), f"The bounding box to write {mag1_bbox} is larger than the view's bounding box {self.bounding_box}" | ||
if update_bbox: | ||
assert self.bounding_box.contains_bbox( | ||
mag1_bbox | ||
), f"The bounding box to write {mag1_bbox} is larger than the view's bounding box {self.bounding_box}" | ||
|
||
if len(data.shape) == 4 and data.shape[0] == 1: | ||
data = data[0] # remove channel dimension for single-channel data | ||
|
@@ -633,6 +635,7 @@ def get_buffered_slice_writer( | |
offset: Optional[Vec3IntLike] = None, | ||
buffer_size: int = 32, | ||
dimension: int = 2, # z | ||
update_bbox: bool = False, | ||
*, | ||
relative_offset: Optional[Vec3IntLike] = None, # in mag1 | ||
absolute_offset: Optional[Vec3IntLike] = None, # in mag1 | ||
|
@@ -674,6 +677,7 @@ def get_buffered_slice_writer( | |
return BufferedSliceWriter( | ||
view=self, | ||
offset=offset, | ||
update_bbox=update_bbox, | ||
buffer_size=buffer_size, | ||
dimension=dimension, | ||
relative_offset=relative_offset, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d say the default should be
True
, and there could be a comment explaining what it does and to encourage setting it to false IF parallel access is intended.