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

Add slicing on (non-spatial) dimensions at initialization of Arrays #6

Closed
2 of 3 tasks
adjavon opened this issue Apr 16, 2024 · 3 comments
Closed
2 of 3 tasks
Labels
enhancement New feature or request

Comments

@adjavon
Copy link

adjavon commented Apr 16, 2024

Goal is to be able to do things slicing through time and/or samples

API example, given a Timelapse dataset of shape T, C, Z, Y, X:

for i in range(10): 
    slices = (i, slice(None), 64, slice(None), slice(None))
    array = open_ds(..., slices=slices) 

Additionally, we can use this momentum to:

  • Let it read numpy arrays
  • Let it read folders of images
  • Use voxel_size instead of resolution in the attributes
@adjavon adjavon added the enhancement New feature or request label Apr 16, 2024
@cmalinmayor
Copy link
Collaborator

Metadata Conventions:
Current:

  • "offset": tuple[int], must be a multiple of voxel size/resolution in each spatial dimension. Represents the offset from the origin in an external coordinate system in real world units
  • "resolution": tuple[int]. Represents the size of a voxel in real world units in each spatial dimension
    Desired:
  • "units": tuple[str | None], potentially one of a set of enumerated options with known conversion (but potentially just any string). Represents the units that the voxel_size and offset are measured in. Must be small enough that those values are integers. None values represent non-spatial dimensions (e.g. channels).
    -"voxel_size": tuple[int], replaces "resolution". Represents the size of a voxel in real world units in each spatial dimension. Non-spatial dimensions are not included.
  • "offset": Optional[tuple[int]], must be a multiple of voxel size in each dimension. Represents the offset from the origin in an external coordinate system in the real world units specified by "units". Defaults to zero in all spatial dimensions if not provided.
  • "axis_names": tuple[str], one of a set of enumerated options ("c", "t", "z", "y", "x" is a potential minimal set). Represents the order of the axes of the data that is stored, including non-spatial dimensions.

@cmalinmayor
Copy link
Collaborator

Note: We pretty much decided to wrap TensorStore to get our desired functionality (slicing without loading into memory).

@pattonw
Copy link
Contributor

pattonw commented Jan 2, 2025

I think everything in here is done now with the exception of opening folders of images. I'll make a separate issue for that.

@pattonw pattonw closed this as completed Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants