Skip to content

Commit 1b83cbf

Browse files
committed
Fix
1 parent bd4ed31 commit 1b83cbf

2 files changed

Lines changed: 1 addition & 66 deletions

File tree

imc/data_models/roi.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,27 +1219,7 @@ def quantify_cell_intensity(
12191219
layers: tp.Sequence[str] = ["cell"],
12201220
**kwargs,
12211221
) -> DataFrame:
1222-
"""
1223-
Quantify intensity of each cell in each channel.
1224-
1225-
Parameters
1226-
----------
1227-
1228-
channel_include: list[str]
1229-
Channels to include in quantification.
1230-
Default is all.
1231-
channel_exclude: list[str]
1232-
Channels to exclude from quantification.
1233-
Default is non.
1234-
layers: list[str]
1235-
What mask layer to quantify. The masks must exist for the ROI. Options are:
1236-
- 'cell': Whole cell mask.
1237-
- 'nuclei': Nuclear mask.
1238-
- 'membrane': Membrane mask - this is usually not a real mask but cell mask minus a fixed value.
1239-
- 'cytoplasm': Mask of the cell cytoplasm.
1240-
- 'extracellular': Mask of the local neighborhood of the cell excluding other cells.
1241-
Default is value of ROI.mask_layer which is by default 'cell.
1242-
"""
1222+
"""Quantify intensity of each cell in each channel."""
12431223
from imc.ops.quant import quantify_cell_intensity
12441224

12451225
if channel_include is not None:

imc/utils.py

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,48 +1507,3 @@ def mask_to_labelme(
15071507
}
15081508
with open(output_file.as_posix(), "w") as fp:
15091509
json.dump(payload, fp, indent=2)
1510-
1511-
1512-
def get_channel_names_from_ome_tiff(ome_tiff_file: tp.Union[str, Path]) -> tp.List[str]:
1513-
"""
1514-
Parse channel names from OME metadata in OME-TIFF file.
1515-
Assumes hierarchy of OME metadata is OME->Image->[Description->]Pixels->Channel.
1516-
The "Name" attribute of Channel is returned.
1517-
1518-
Parameters
1519-
----------
1520-
ome_tiff_file: str | Path
1521-
Either a pathlib.Path to a file or a string with OME XML information.
1522-
1523-
Returns
1524-
-------
1525-
list[str]
1526-
A list of channel names
1527-
"""
1528-
from xml.etree import ElementTree
1529-
1530-
if isinstance(ome_tiff_file, Path):
1531-
f = tifffile.TiffFile(ome_tiff_file)
1532-
root = ElementTree.fromstring(f.ome_metadata)
1533-
else:
1534-
root = ElementTree.fromstring(ome_tiff_file)
1535-
1536-
# "OME" is the tag of the root
1537-
path_to_channels = ["Image", "Description", "Pixels"]
1538-
1539-
i = 0
1540-
t = 0
1541-
obj = root
1542-
while i < len(path_to_channels):
1543-
for c in obj:
1544-
tag = c.tag.split("}")[-1]
1545-
if tag == path_to_channels[i]:
1546-
obj = c
1547-
i += 1
1548-
t += 1
1549-
1550-
# If loop not working, most likely XML does not have the "Description" tag, so try skipping it
1551-
if (t > 200) and (i == 1):
1552-
path_to_channels = ["Image", "Pixels"]
1553-
channels = [c.attrib["Name"] for c in obj if c.tag.split("}")[-1] == "Channel"]
1554-
return channels

0 commit comments

Comments
 (0)