Insert tomogram locations in SXT regions of interest - #860
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #860 +/- ##
==========================================
+ Coverage 54.65% 54.74% +0.09%
==========================================
Files 104 104
Lines 11160 11214 +54
Branches 1475 1481 +6
==========================================
+ Hits 6099 6139 +40
- Misses 4741 4750 +9
- Partials 320 325 +5 🚀 New features to boost your workflow:
|
| x_tiles = _get_ole_header_value( | ||
| txrm_ole, "ImageInfo/XPosition", np.float32 | ||
| ).tolist() | ||
| y_tiles = _get_ole_header_value( | ||
| txrm_ole, "ImageInfo/YPosition", np.float32 | ||
| ).tolist() | ||
| metadata["x_position"] = x_tiles[int(len(x_tiles) / 2)] | ||
| metadata["y_position"] = y_tiles[int(len(y_tiles) / 2)] |
There was a problem hiding this comment.
This could be iterated, but works as-is.
for key, old_path in (("x_position", "ImageInfo/XPosition"), ("y_position", "ImageInfo/YPosition")):
tiles = _get_ole_header_value(txrm_ole, ole_path, np.float32).tolist()
metadata[key] = tiles[int(len(tiles) / 2)]
| x_location_centered = ( | ||
| (tilt_series_info.x_stage_position - matching_roi.x_stage_position) | ||
| / matching_roi.pixel_size | ||
| / 1e6 |
There was a problem hiding this comment.
Given that on the client side, you have been converting the pixel size to metres, is the /1e6 still needed here?
What are the units of the ..._stage_position and pixel_size attributes at this point?
There was a problem hiding this comment.
1e6 is needed as the stage position is microns and the pixel size is metres
tieneupin
left a comment
There was a problem hiding this comment.
Looks fine overall, but some comments to help other devs with keeping track of units throughout the workflow would be very helpful.
Read the stage locations of the tilt series in SXT and send these as part of the recipe so they can be displayed on pato. Will need a recipe change for the insertion.
The actual ROI to match the tomogram to is unknown (although it would be possible to read from file names sometimes), so I have written this to read all ROIs for the grid and match the tomogram to the one with the closest stage position.
There are complications around the pixel sizes and coordinate systems used. This changes the atlas pixel size inserted into ispyb to be that of the thumbnail, which is consistent with the other workflows.