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

keep track of position label #575

Closed
ieivanov opened this issue Apr 11, 2023 · 3 comments · Fixed by #640
Closed

keep track of position label #575

ieivanov opened this issue Apr 11, 2023 · 3 comments · Fixed by #640
Labels
enhancement New feature or request

Comments

@ieivanov
Copy link
Collaborator

ieivanov commented Apr 11, 2023

One useful thing that is currently lost with a pycromanager acquisition is the position label. In my workflow, I use the HSC Site Generator to generate a position list with multiple FOVs per well, which I then import in python and pass the XYZ coordinates to pycromanager. However, I don't have a way to pass the position label. It's important to know which position index comes from which well, so currently I write a csv file to keep track of this information.

Could the position axis in the events dictionary become a string axis, just like channel, such that the position label can be used as the axis index? Could it be either an integer or string (is that how the channel axis works currently)? Is there a way to quickly iterate through the positions even if we don't know the labels ahead of time? Can we still keep track of the order in which the positions are acquires? I would think all of this should be possible on the python side.

@ieivanov ieivanov added the enhancement New feature or request label Apr 11, 2023
@henrypinkard
Copy link
Member

Could the position axis in the events dictionary become a string axis, just like channel, such that the position label can be used as the axis index? Could it be either an integer or string (is that how the channel axis works currently)?

Yes, it should be the case that any axis can take integer or string values, just not both within a single axis. So you should be able to switch and index them by label.

Is there a way to quickly iterate through the positions even if we don't know the labels ahead of time?

for value in dataset.axes['position']:

Can we still keep track of the order in which the positions are acquires?

Yes, this should possible. dataset.axes is a dict that has a list for the values of each axis. For example:

{'row': [-2, -1, 0, 1],
 'column': [-2, -1, 0, 1, 2],
 'channel': ['Brightfield', 'FITC', 'TRITC'],
 'z': [0]}

So there is an order in there. Right now these are sorted alphabetically/numerically. The dataset.as_array function needs the numerical sorting. For example, if a z stack wasn't acquired in order, you don't want it to be returned in non-spatial order. However, I think the sorting could be moved into as_array, and dataset.axes kept in acquisition order.

You'd also need to I think change this from a dict to an OrderedDict for datasets read from disk:

https://github.com/henrypinkard/NDTiffStorage/blob/0eee9476342d61c4308161c35c3a9951a91f4a63/python/ndtiff/nd_tiff_current.py#L599

(it might work as is because in my experience regular dicts behave as ordered, but the language doesnt guarantee it as far as i understand)

and similarly here for datasets that are currently being acquired:

https://github.com/henrypinkard/NDTiffStorage/blob/0eee9476342d61c4308161c35c3a9951a91f4a63/python/ndtiff/nd_tiff_current.py#L432

Then remove the sorting that occurs at

https://github.com/henrypinkard/NDTiffStorage/blob/0eee9476342d61c4308161c35c3a9951a91f4a63/python/ndtiff/nd_tiff_current.py#L432

and

https://github.com/henrypinkard/NDTiffStorage/blob/0eee9476342d61c4308161c35c3a9951a91f4a63/python/ndtiff/nd_tiff_current.py#L234

@ieivanov
Copy link
Collaborator Author

Thanks! Do I understand correctly that nothing needs to change on the Java side? This shouldn't be hard for me to do then

@henrypinkard
Copy link
Member

Yeah thats right. Cool

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

Successfully merging a pull request may close this issue.

2 participants