-
Notifications
You must be signed in to change notification settings - Fork 7
OME-Zarr parsing for sparsely recorded fields #8
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
Comments
In the case of field grids, basically we need, in case fields are sparse area in between should be comprised of regions with no information, to be able to provide correct overview estimation.
|
For gridless field acquisitions, the microscope tries to center the fields around the samples, and currently we keep also a mask so that we retrieve the fields from non-imaged areas, as seen in this example: We can possibly just adapt the current Liberali Workflow that deals with parsing the stage positions onto creation of overviews. |
High level description from @gusqgm (moved into the issue for clarity):
|
@jluethi, dataset called |
Regarding the microscope acquisition: the image above CAN have overlapping fov's... |
Hi all, here is an example of a Search First experiment where the microscope acquires a sparse regular grid: As you can see, there are 15 FOVs where 4 have not been recorded. Important: To make this image I have simply opened plane number 10 of each of the recorded fields and assembled them according to the Overview created by our luigi overview workflow. Now here comes the catch: I have added on top of the image the corresponding part of the file name associated with the FOV number, and, as you can see, we have an issue with the "...F006...", "...F007...", "...F008..." images, as they should have been shifted by 1 in order to fit the expected zig-zag naming pattern. This is an important finding, as it means that we simply cannot rely on the file naming during parsing of the microscope data, at least for all of the sparse grid imaging experiments. Rather, we need to address the microscope metadata (so this directly combines with #25 ) I am right now checking on the code for the image collection task and the overview creation task to check on details, and will write below on more details. Anyways, for now the data has been added to the sftp server, details being sent now via email to you @mfranzon . |
Here some brief information about the test data shown above: There are 3 subfolders : 220304_172545_220304_172605 The two first ones correspond to the usual output coming from the search first part of the acquisition, and should not be considered initially. This should be easy, as they have the same time-fingerprint. Please note that all folders reflect a dataset where the barcoding reader failed and a date-name was added in it, following issue fractal-analytics-platform/fractal-client#48 . I have adapted the .mlf metadata to represent the single well dataset, and this runs within Drogon, so should be parsed correctly currently. Please not that all of the other metadata are for the time being kept unchanged, and are still pointing to the full plate information. |
Thanks @gusqgm for these details. Quick question:
Are we supposed to have access to those repositories? |
If you don't have access yet, I can go through this code today or tomorrow and put together the code for a minimal parsing example, such that the above dataset is parsed correctly. I'd than hand over the example so we wrap it into a Fractal function :) But also, let's make sure you are added to the repositories so you can have access if needed in the future :) |
My to-do list is not so thin at the moment, so I'd say take your time.
Sure, thanks. |
Update from my side: Regarding the implementation of correct metadata parsing and field assignments: @jluethi and I agreed to go through the current code in the aforementioned repository so that we can already filter out the most timportant parts and perform minimal tests for consistency check. Once this is done we would pass them on to you, as @jluethi mentioned. |
Update on the parsing of metadata (from the sparse example above as well as other Yokogawa metadata) in this issue: https://github.com/fractal-analytics-platform/mwe_fractal/issues/46 |
Quick note: When we save sparse array, let's make sure we use the |
To facilitate tackling this issue:
Let's discuss 1) in #13 For 2) Still like a grid, but not all parts have content. We will need to ensure that we build an empty array of the correct size initially to be able to fill in all the positions. And we can't make assumptions based on the count of FOVs or just look at first and last (otherwise, we're not tackling part 3)). => We will need to look at the metadata table, find the top left and bottom right corner based on all the x & y position and the image sizes. |
At the moment, this happens based on the FOV-ROI indices, rather than on the x/y physical positions. In the parsing task there is a block like adata = read_zarr(f"{zarrurl}/tables/FOV_ROI_table")
fov_rois = convert_ROI_table_to_indices(adata, full_res_pxl_sizes_zyx=pxl_size)
max_x = max(roi[5] for roi in fov_rois)
max_y = max(roi[3] for roi in fov_rois)
max_z = max(roi[1] for roi in fov_rois)
[...]
canvas = da.zeros((max_z, max_y, max_x), dtype=sample.dtype, chunks=(1, chunk_size_y, chunk_size_x)) where 5,3,1 are the indices corresponding to @jluethi, do you notice anything unexpected in the way we are doing it? |
I'd be a bit cautious with using an index-based selection of the columns here. It assumes that the ordering of the AnnData ROI tables will always be the same. While our system should be consistent here, we may want to support other OME-Zarr files that contain tables with the same information, but the order of columns shouldn't be a part of that spec It's good to have Given that it handles the 2x2 case, it seems to be able to handle negative coordinates. The 2x2 case has X positions like |
…g get_ROIs_bounding_box (ref #8) to lib_regions_of_interest
As of 5c1410e, the new function Missing features:
|
Sounds good, made an issue here describing when we may need to work on the 0, 0, 0 assumption :) |
The The other 2 search first test cases appear to have some issues in the metadata parsing (#109 & #110), but that's most likely unrelated to the search first part of it. I'll need to have a brief check whether the segmentation and measurements have worked correctly on this dataset. After that, we can close this issue |
Uh oh!
There was an error while loading. Please reload this page.
Can .zarr containers contain only the data present in the fields that actually contain data within a well? This would require the parsing of the Yokogawa experiment to be able to extract (z,y,x) stage positions, assigning corresponding values to corresponding fields.
As a first step, we need to parse the x,y,width and height from the metadata file from yokogawa experiments, and one example is found in the yokogawa_image_collection_task from the Liberali Workflows repository. All metadata is saved in the so-called mlf_frame file
On the simplest case, the sparse fields would still fall onto a grid pattern, so parsing should then be able to extrapolate the size of the entire grid, and be able to place the recorded fields in the correct grid positions.
Currently Drogon creates an overview of 0's where fields were not recorded, filling up the gaps. The saved overviews also comprise of a mask overview which is used for retaining only the imaged fields for processing and avoid overfilling memory.
One interesting question here is whether OME-Zarr can actually deal with sparse field grids, meaning that the empty fields would remain empty, or would be assigned to same-sized stacks filled with 0's.
The text was updated successfully, but these errors were encountered: