Skip to content

Commit

Permalink
fix index naming
Browse files Browse the repository at this point in the history
  • Loading branch information
ziw-liu committed Sep 4, 2024
1 parent 942b775 commit c677a39
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/napari_iohub/_view_tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def open_image_and_tracks(
tracks_dataset: pathlib.Path,
features_dataset: pathlib.Path,
fov_name: str,
features_type: str,
features_type: str = "features",
expand_z_for_tracking_labels: bool = True,
load_tracks_layer: bool = True,
) -> typing.List[napari.types.LayerDataTuple]:
Expand Down Expand Up @@ -83,13 +83,16 @@ def open_image_and_tracks(
image_z = image_fov["0"].slices
_logger.info(f"Expanding tracks to Z={image_z}")
labels_layer[0][0] = labels_layer[0][0].repeat(image_z, axis=1)
labels_layer[1]["features"] = pd.DataFrame(
index=features["sample"]
features_index = (
features["sample"]
.to_dataframe()
.reset_index(drop=True)
.rename(columns={"track_id": "label", "t": "frame"}),
data=features.values,
).reset_index()
.reset_index(drop=True)[["track_id", "t"]]
.rename(columns={"track_id": "label", "t": "frame"})
)
features_values = pd.DataFrame(
data=features.values, columns=[f"feature_{i}" for i in range(features.shape[1])]
).reset_index(drop=True)
labels_layer[1]["features"] = pd.concat([features_index, features_values], axis=1)
image_layers.append(labels_layer)
tracks_csv = next((tracks_dataset / fov_name.strip("/")).glob("*.csv"))
if load_tracks_layer:
Expand Down

0 comments on commit c677a39

Please sign in to comment.