You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
.T/transpose corrupts rendering for whole-FOV CytoDataFrames using render_whole_image (no bounding box / compartment center) #226
Calling .T (or .transpose()) on a CytoDataFrame built from image-level (whole-FOV) data (i.e., no bounding box columns and no compartment-center columns, using display_options={"render_whole_image": True}), produces a broken render: the output is neither transposed nor does it show the embedded image. It falls back to a plain untransposed table of raw filenames.
Without .T, the same object renders correctly with real embedded images and a correct table.
Minimal reproduction
importpandasaspdfromcytodataframeimportCytoDataFramedf=pd.DataFrame({
"FileName_OrigDNA": ["imgA.tiff", "imgB.tiff"],
"PathName_OrigDNA": ["/path/to/images", "/path/to/images"],
"SomeMetric": [-2.5, -2.7],
})
cdf=CytoDataFrame(df, display_options={"render_whole_image": True})
cdf.head(2) # renders correctly: real embedded imagescdf.head(2).T# broken: no images, and NOT actually transposed in the rendered HTML
Expected behavior
cdf.head(2).T should render a transposed table with the image still embedded in the FileName_OrigDNA row.
Actual behavior
The rendered HTML is untransposed (same orientation as before .T) and shows raw filename text instead of the image.
Root cause
In _generate_jupyter_dataframe_html (src/cytodataframe/frame.py), around the "Re-add image path columns" block:
But the image-path re-join's else branch joins against self (still in its transposed shape — columns are row-ids, index is the original column labels) instead of the already-corrected data. Since neither bounding_box_externally_joined nor compartment_center_externally_joined is True for whole-FOV data (there's no bounding box or compartment center at all), this else branch is exactly the one taken. So the un-transpose fix from earlier is discarded, and the join is performed on completely mismatched indices, silently producing no usable PathName_* values. Because this corrupted data is used going forward, the later if self._custom_attrs["is_transposed"]: data = data.transpose() retranspose-for-display step also ends up applied to the wrong object, which is why the final table isn't transposed either.
Suggested fix
In that branch, join against data (the transpose-corrected copy) rather than self whenever is_transposed is True, e.g.:
Activity
d33bs commentedon Aug 28, 2026
Thanks @jenna-tomkinson, a fix is ready for review in #227