API details.
Hello wht
C0_imgs = create_img_dict_from_folder(load_pattern="data/PercevalHR_data/imgs/*C0.tiff")
C1_imgs = create_img_dict_from_folder(load_pattern="data/PercevalHR_data/imgs/*C1.tiff")
lab_imgs = create_img_dict_from_folder(
load_pattern="data/PercevalHR_data/segs/*.tif", label=True
)
from clonedetective.utils import plot_new_images
img_name = "a1g01"
plot_new_images(
[C0_imgs[img_name], C1_imgs[img_name], lab_imgs[img_name]],
["C0 channel", "C1 channel", "label image (segmentation)"],
interpolation="none",
)
a1g01_img = create_ratio_image(C1_imgs["a1g01"], C0_imgs["a1g01"], lab_imgs["a1g01"])
a2g01_img = create_ratio_image(C1_imgs["a2g01"], C0_imgs["a2g01"], lab_imgs["a2g01"])
plot_new_images(
[a1g01_img, a2g01_img],
["a1g01 ratio image", "a2g01 ratio image"],
img_cmap="magma",
vmax=2.5,
figure_shape=(1, 2),
figure_size=(10, 5),
colorbar=True,
colorbar_title="PercevalHR 488/405"
)
ratio_imgs = create_dict_of_ratio_images(C1_imgs, C0_imgs, lab_imgs)
ratio_imgs.keys()
df = measure_region_props_to_tidy_df(
C1_imgs, lab_imgs, properties=["label", "mean_intensity"]
)
df.head()
only_intensity_region_properties(["label", "area", "mean_intensity", "centroid"])
df = ratiometric_measure_region_props_to_tidy_df(C1_imgs, C0_imgs, lab_imgs)
df.head()
df = split_img_key_col_to_sample_id_and_replicates(
df, sample_id_colname="genotype", split_regex=r"g"
)
df.head()
df = sample_id_to_categories(
df, sample_id_colname="genotype", old_to_new_sample_ids={"a1": "ctrl", "a2": "mut"}
)
df.head()
df["genotype"].head()