|
33 | 33 | from ..constants.measurement import C_PATH_NAME
|
34 | 34 | from ..constants.measurement import C_SERIES
|
35 | 35 | from ..constants.measurement import C_URL
|
| 36 | +from ..constants.measurement import DB_TEMP |
36 | 37 | from ..constants.measurement import EXPERIMENT
|
37 | 38 | from ..constants.measurement import GROUP_INDEX
|
38 | 39 | from ..constants.measurement import GROUP_NUMBER
|
| 40 | +from ..constants.measurement import GROUP_LENGTH |
39 | 41 | from ..constants.measurement import IMAGE
|
40 | 42 | from ..constants.measurement import IMAGE_NUMBER
|
41 | 43 | from ..constants.measurement import K_CASE_SENSITIVE
|
@@ -364,6 +366,15 @@ def set_group_index(self, group_index):
|
364 | 366 |
|
365 | 367 | group_index = property(get_group_index, set_group_index)
|
366 | 368 |
|
| 369 | + def get_group_length(self): |
| 370 | + """The group length of the current image group""" |
| 371 | + return self.get_current_image_measurement(GROUP_LENGTH) |
| 372 | + |
| 373 | + def set_group_length(self, group_length): |
| 374 | + self.add_image_measurement(GROUP_LENGTH, group_length) |
| 375 | + |
| 376 | + group_length = property(get_group_length, set_group_length) |
| 377 | + |
367 | 378 | def get_groupings(self, features):
|
368 | 379 | """Return groupings of image sets based on feature values
|
369 | 380 |
|
@@ -741,7 +752,7 @@ def clear(self):
|
741 | 752 | def get_object_names(self):
|
742 | 753 | """The list of object names (including Image) that have measurements
|
743 | 754 | """
|
744 |
| - return [x for x in self.hdf5_dict.top_level_names() if x != RELATIONSHIP] |
| 755 | + return [x for x in self.hdf5_dict.top_level_names() if x not in (DB_TEMP, RELATIONSHIP)] |
745 | 756 |
|
746 | 757 | object_names = property(get_object_names)
|
747 | 758 |
|
@@ -1295,6 +1306,7 @@ def write_image_sets(self, fd_or_file, start=None, stop=None):
|
1295 | 1306 | to_save = [
|
1296 | 1307 | GROUP_NUMBER,
|
1297 | 1308 | GROUP_INDEX,
|
| 1309 | + GROUP_LENGTH |
1298 | 1310 | ]
|
1299 | 1311 | to_save_prefixes = [
|
1300 | 1312 | C_URL,
|
@@ -1733,11 +1745,20 @@ def set_grouping_tags(self, grouping_tags):
|
1733 | 1745 | data = json.dumps(grouping_tags)
|
1734 | 1746 | self.add_experiment_measurement(M_GROUPING_TAGS, data)
|
1735 | 1747 |
|
1736 |
| - def get_grouping_tags(self): |
| 1748 | + def get_grouping_tags_or_metadata(self): |
1737 | 1749 | """Get the metadata tags that were used to group the image set
|
1738 | 1750 |
|
1739 | 1751 | """
|
1740 | 1752 | if not self.has_feature(EXPERIMENT, M_GROUPING_TAGS,):
|
1741 | 1753 | return self.get_metadata_tags()
|
1742 | 1754 |
|
1743 | 1755 | return json.loads(self.get_experiment_measurement(M_GROUPING_TAGS))
|
| 1756 | + |
| 1757 | + def get_grouping_tags_only(self): |
| 1758 | + """Get the metadata tags that were used to group the image set, |
| 1759 | + and only those, not metadata instead |
| 1760 | + """ |
| 1761 | + if not self.has_feature(EXPERIMENT, M_GROUPING_TAGS,): |
| 1762 | + return [] |
| 1763 | + |
| 1764 | + return json.loads(self.get_experiment_measurement(M_GROUPING_TAGS)) |
0 commit comments