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

Refactoring to allow adding multiple Assets (dynamic tiff sequences) #718

Merged
merged 9 commits into from
Apr 18, 2024

Conversation

genematx
Copy link
Contributor

@genematx genematx commented Apr 11, 2024

This PR:
(1) implements minor cosmetic refactoring in adapter.py; specifically, it separates the asset creation functionality into the _put_asset method, which is called when a new data source/ node is created and when an existing data source is updated. This allows to add new assets to an exisiting data source. (Possibly more refactoring needed to improve the speed).

(2) expands the TiffSequenceAdapter class to accept tiff files with more than 2 dimensions (e.g. color images) and also to allow implicit slicing extension to arbitrary number of adjacent dimensions with Ellipsis.

@genematx genematx requested a review from danielballan April 11, 2024 21:34
@genematx genematx changed the title Refactor adapter.py to allow for multiple Assets Refactor adapter.py to allow adding multiple Assets Apr 11, 2024
@genematx genematx marked this pull request as ready for review April 15, 2024 12:26
@genematx genematx changed the title Refactor adapter.py to allow adding multiple Assets Refactoring to allow adding multiple Assets (dynamic tiff sequences) Apr 15, 2024
data_sources=None,
):
@property
def insert(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have factored out this bit into its own method because it's reused a couple of times throughout the class. Maybe call _insert?

arr = tifffile.TiffSequence(
self._seq.files[slice_start : slice.stop : slice_step] # noqa: E203
).asarray()
# NOTE: may need to force np.array type if arr is a scalar
Copy link
Contributor Author

Choose a reason for hiding this comment

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

force to be arrays

"""

if slice is None:
if (slice is None) or (slice is Ellipsis):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove None

@danielballan danielballan merged commit 0753fe5 into bluesky:main Apr 18, 2024
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants