|
12 | 12 | from PartSegCore.algorithm_describe_base import ROIExtractionProfile |
13 | 13 | from PartSegCore.analysis import ProjectTuple, SegmentationPipeline, SegmentationPipelineElement |
14 | 14 | from PartSegCore.analysis.measurement_base import AreaType, MeasurementEntry, PerComponent |
15 | | -from PartSegCore.analysis.measurement_calculation import ComponentsNumber, MeasurementProfile, Volume |
| 15 | +from PartSegCore.analysis.measurement_calculation import ( |
| 16 | + ColocalizationMeasurement, |
| 17 | + ComponentsNumber, |
| 18 | + MeasurementProfile, |
| 19 | + Volume, |
| 20 | +) |
16 | 21 | from PartSegCore.image_operations import RadiusType |
17 | 22 | from PartSegCore.mask.io_functions import MaskProjectTuple |
18 | 23 | from PartSegCore.mask_create import MaskProperty |
@@ -69,15 +74,15 @@ def image2d(tmp_path): |
69 | 74 |
|
70 | 75 | @pytest.fixture() |
71 | 76 | def stack_image(): |
72 | | - data = np.zeros([20, 40, 40], dtype=np.uint8) |
| 77 | + data = np.zeros([20, 40, 40, 2], dtype=np.uint8) |
73 | 78 | for x, y in itertools.product([0, 20], repeat=2): |
74 | 79 | data[1:-1, x + 2 : x + 18, y + 2 : y + 18] = 100 |
75 | 80 | for x, y in itertools.product([0, 20], repeat=2): |
76 | 81 | data[3:-3, x + 4 : x + 16, y + 4 : y + 16] = 120 |
77 | 82 | for x, y in itertools.product([0, 20], repeat=2): |
78 | 83 | data[5:-5, x + 6 : x + 14, y + 6 : y + 14] = 140 |
79 | 84 |
|
80 | | - return MaskProjectTuple("test_path", Image(data, (2, 1, 1), axes_order="ZYX", file_path="test_path")) |
| 85 | + return MaskProjectTuple("test_path", Image(data, (2, 1, 1), axes_order="ZYXC", file_path="test_path")) |
81 | 86 |
|
82 | 87 |
|
83 | 88 | @pytest.fixture() |
@@ -201,8 +206,18 @@ def measurement_profiles(): |
201 | 206 | calculation_tree=Volume.get_starting_leaf().replace_(area=AreaType.Mask, per_component=PerComponent.No), |
202 | 207 | ), |
203 | 208 | ] |
204 | | - return MeasurementProfile(name="statistic1", chosen_fields=statistics), MeasurementProfile( |
205 | | - name="statistic2", chosen_fields=statistics + statistics2 |
| 209 | + statistics3 = [ |
| 210 | + MeasurementEntry( |
| 211 | + name="Colocalisation", |
| 212 | + calculation_tree=ColocalizationMeasurement.get_starting_leaf().replace_( |
| 213 | + per_component=PerComponent.No, area=AreaType.ROI |
| 214 | + ), |
| 215 | + ), |
| 216 | + ] |
| 217 | + return ( |
| 218 | + MeasurementProfile(name="statistic1", chosen_fields=statistics), |
| 219 | + MeasurementProfile(name="statistic2", chosen_fields=statistics + statistics2), |
| 220 | + MeasurementProfile(name="statistic3", chosen_fields=statistics + statistics2 + statistics3), |
206 | 221 | ) |
207 | 222 |
|
208 | 223 |
|
|
0 commit comments