Skip to content

Commit 7ba1e0e

Browse files
authored
Merge pull request #87 from sebi06/work_in_progress
Work in progress 0.8.0 - merge to main
2 parents 90d2bfa + 41c9c59 commit 7ba1e0e

File tree

6 files changed

+27
-4
lines changed

6 files changed

+27
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,4 @@ data/nuc_small_green.czi
182182
data/nuc_small.czi
183183
data/Tumor_HE_Orig_small_disp.czi
184184
data/Tumor_HE_RGB_disp.czi
185+
.pylintrc

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = czitools
3-
version = 0.7.6
3+
version = 0.8.0
44
author = Sebastian Rhode
55
author_email = sebrhode@gmail.com
66
url = https://github.com/sebi06/czitools

src/czitools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# __init__.py
22
# version of the czitools package
3-
__version__ = "0.7.6"
3+
__version__ = "0.8.0"

src/czitools/_tests/test_channelinfo.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@
1010

1111

1212
@pytest.mark.parametrize(
13-
"czifile, clims, colors, gamma, names, dyes, ch_disp, is_rgb, is_consistent, pxtypes",
13+
"czifile, clims, colors, gamma, names, dyes, dyes_short, ch_disp, is_rgb, is_consistent, pxtypes",
1414
[
1515
(
1616
"Tumor_HE_Orig_small.czi",
1717
[[0.0, 0.5]],
1818
["#80808000"],
1919
[0.85],
2020
["CH1"],
21+
["TL Brightfield"],
2122
["Brigh"],
2223
{
2324
0: pyczi.ChannelDisplaySettingsDataClass(
@@ -38,6 +39,7 @@
3839
["#FFFF7E00", "#FF00FF33"],
3940
[0.7999999999999998, 0.7999999999999998],
4041
["LED555", "LED470"],
42+
["LED555", "LED470"],
4143
["AF555", "AF488"],
4244
{
4345
0: pyczi.ChannelDisplaySettingsDataClass(
@@ -65,6 +67,7 @@
6567
["#80808000"],
6668
[0.85],
6769
["CH1"],
70+
["C1"],
6871
["Dye-CH1"],
6972
{
7073
0: pyczi.ChannelDisplaySettingsDataClass(
@@ -89,6 +92,7 @@
8992
[0.7999999999999998, 0.7999999999999998],
9093
["AF568", "AF488"],
9194
["AF568", "AF488"],
95+
["AF568", "AF488"],
9296
{
9397
0: pyczi.ChannelDisplaySettingsDataClass(
9498
True,
@@ -118,6 +122,7 @@ def test_channelinfo(
118122
gamma: List[float],
119123
names: List[str],
120124
dyes: List[str],
125+
dyes_short: List[str],
121126
ch_disp: Dict[int, pyczi.ChannelDisplaySettingsDataClass],
122127
is_rgb: Dict[int, bool],
123128
is_consistent: bool,
@@ -132,6 +137,7 @@ def test_channelinfo(
132137
assert czi_channels.gamma == gamma
133138
assert czi_channels.names == names
134139
assert czi_channels.dyes == dyes
140+
assert czi_channels.dyes_short == dyes_short
135141
assert czi_channels.czi_disp_settings == ch_disp
136142
assert czi_channels.isRGB == is_rgb
137143
assert czi_channels.consistent_pixeltypes == is_consistent

src/czitools/metadata_tools/channel.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class CziChannelInfo:
2727
czisource (Union[str, os.PathLike[str], Box]): The source of the CZI image data.
2828
names (List[str]): List of channel names.
2929
dyes (List[str]): List of dye names.
30+
dyes_short (List[str]): List of short dye names.
31+
channel_descriptions (List[str]): List of channel descriptions.
3032
colors (List[str]): List of channel colors.
3133
clims (List[List[float]]): List of channel intensity limits.
3234
gamma (List[float]): List of gamma values for each channel.
@@ -48,6 +50,8 @@ class CziChannelInfo:
4850
czisource: Union[str, os.PathLike[str], Box]
4951
names: List[str] = field(init=False, default_factory=lambda: [])
5052
dyes: List[str] = field(init=False, default_factory=lambda: [])
53+
dyes_short: List[str] = field(init=False, default_factory=lambda: [])
54+
channel_descriptions: List[str] = field(init=False, default_factory=lambda: [])
5155
colors: List[str] = field(init=False, default_factory=lambda: [])
5256
clims: List[List[float]] = field(init=False, default_factory=lambda: [])
5357
gamma: List[float] = field(init=False, default_factory=lambda: [])
@@ -131,8 +135,18 @@ def _get_channel_info(self, display: Box):
131135
if display is not None:
132136
(
133137
self.dyes.append("Dye-CH1")
138+
if display.Name is None
139+
else self.dyes.append(display.Name)
140+
)
141+
(
142+
self.dyes_short.append("Dye-CH1")
143+
if display.ShortName is None
144+
else self.dyes_short.append(display.ShortName)
145+
)
146+
(
147+
self.channel_descriptions.append("")
134148
if display.ShortName is None
135-
else self.dyes.append(display.ShortName)
149+
else self.channel_descriptions.append(display.Description)
136150
)
137151
(
138152
self.colors.append("#80808000")

src/czitools/metadata_tools/czi_metadata.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,10 @@ def create_md_dict_red(
425425
"ScaleRatio_XYZ": metadata.scale.ratio,
426426
"ChannelNames": metadata.channelinfo.names,
427427
"ChannelDyes": metadata.channelinfo.dyes,
428+
"ChannelDyesShort": metadata.channelinfo.dyes_short,
428429
"ChannelColors": metadata.channelinfo.colors,
429430
"WellArrayNames": metadata.sample.well_array_names,
431+
"ChannelDescriptions": metadata.channelinfo.channel_descriptions,
430432
"WellIndicies": metadata.sample.well_indices,
431433
"WellPositionNames": metadata.sample.well_position_names,
432434
"WellRowID": metadata.sample.well_rowID,

0 commit comments

Comments
 (0)