Skip to content

Commit 55e41bb

Browse files
Add OME Arrow integration and read/write OME Parquet (#162)
* add ome-arrow capabilities * fix numpy warnings * export orig, mask, and composite * correct masks and outlines for export * adjust column naming * ensure we display the frames again * ensure the mask color is accurate * update demo notebook * add metadata to parquet files * linting * [pre-commit.ci lite] apply automatic fixes * increase coverage * Update test_frame.py * [pre-commit.ci lite] apply automatic fixes * test instead of dummy --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
1 parent 61cc4eb commit 55e41bb

File tree

8 files changed

+1509
-408
lines changed

8 files changed

+1509
-408
lines changed

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
run_tests:
3939
strategy:
4040
matrix:
41-
python_version: ["3.10", "3.11", "3.12", "3.13"]
41+
python_version: ["3.11", "3.12", "3.13"]
4242
os: [ubuntu-24.04, macos-14]
4343
runs-on: ${{ matrix.os }}
4444
env:

docs/src/examples/cytodataframe_at_a_glance.ipynb

Lines changed: 543 additions & 61 deletions
Large diffs are not rendered by default.

docs/src/examples/cytodataframe_at_a_glance.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
# %%time
5656
# view JUMP plate BR00117006 with images and overlaid outlines for segmentation
57-
CytoDataFrame(
57+
frame = CytoDataFrame(
5858
data=f"{jump_data_path}/BR00117006_shrunken.parquet",
5959
data_context_dir=f"{jump_data_path}/images/orig",
6060
data_outline_context_dir=f"{jump_data_path}/images/outlines",
@@ -67,6 +67,7 @@
6767
"Image_FileName_OrigRNA",
6868
]
6969
][:3]
70+
frame
7071

7172

7273
# %%time
@@ -183,6 +184,16 @@
183184
]
184185
][:5].T
185186

187+
# +
188+
# %%time
189+
# export to OME Parquet, a format which uses OME Arrow
190+
# to store OME-spec images as values within the table.
191+
frame.to_ome_parquet(file_path="example.ome.parquet")
192+
193+
# read OME Parquet file into the CytoDataFrame
194+
CytoDataFrame(data="example.ome.parquet")
195+
# -
196+
186197
# %%time
187198
# view JUMP plate BR00117006 with images, changing the bounding box
188199
# using offsets so each image has roughly the same size.
@@ -225,7 +236,7 @@
225236

226237
# %%time
227238
# view NF1 Cell Painting data with images and overlaid outlines from masks
228-
CytoDataFrame(
239+
frame = CytoDataFrame(
229240
data=f"{nf1_cellpainting_path}/Plate_2_with_image_data_shrunken.parquet",
230241
data_context_dir=f"{nf1_cellpainting_path}/Plate_2_images",
231242
data_mask_context_dir=f"{nf1_cellpainting_path}/Plate_2_masks",
@@ -238,6 +249,7 @@
238249
"Image_FileName_DAPI",
239250
]
240251
][:3]
252+
frame
241253

242254
# +
243255
# %%time
@@ -266,6 +278,15 @@
266278
"Image_FileName_DAPI",
267279
]
268280
][:3]
281+
282+
# +
283+
# %%time
284+
# export to OME Parquet, a format which uses OME Arrow
285+
# to store OME-spec images as values within the table.
286+
frame.to_ome_parquet(file_path="example.ome.parquet")
287+
288+
# read OME Parquet file into the CytoDataFrame
289+
CytoDataFrame(data="example.ome.parquet")
269290
# -
270291

271292
# %%time
@@ -308,3 +329,12 @@
308329
# show that we can use the cytodataframe again
309330
# by quick variable reference.
310331
cdf
332+
333+
# +
334+
# %%time
335+
# export to OME Parquet, a format which uses OME Arrow
336+
# to store OME-spec images as values within the table.
337+
cdf.to_ome_parquet(file_path="example.ome.parquet")
338+
339+
# read OME Parquet file into the CytoDataFrame
340+
CytoDataFrame(data="example.ome.parquet")

media/coverage-badge.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)