Skip to content
Snippets Groups Projects

Changed formatting of object classification path results

Merged Christopher Randolph Rhodes requested to merge staging into master
1 file
+ 10
3
Compare changes
  • Side-by-side
  • Inline
@@ -474,7 +474,15 @@ class RoiSet(object):
@@ -474,7 +474,15 @@ class RoiSet(object):
dfe['patch'] = self._df.apply(lambda r: _make_patch(r), axis=1)
dfe['patch'] = self._df.apply(lambda r: _make_patch(r), axis=1)
return dfe
return dfe
def run_exports(self, where, channel, prefix, params: RoiSetExportParams):
def run_exports(self, where: Path, channel, prefix, params: RoiSetExportParams) -> dict:
 
"""
 
Export various representations of ROIs, e.g. patches, annotated stacks, and object maps.
 
:param where: path of directory in which to write all export products
 
:param channel: color channel of products to export
 
:param prefix: prefix of the name of each product's file or subfolder
 
:param params: RoiSetExportParams object describing which products to export and with which parameters
 
:return: dict of Path objects describing the location of single-file export products
 
"""
record = {}
record = {}
if not self.count:
if not self.count:
return
return
@@ -506,11 +514,10 @@ class RoiSet(object):
@@ -506,11 +514,10 @@ class RoiSet(object):
if k == 'annotated_zstacks':
if k == 'annotated_zstacks':
self.export_annotated_zstack(subdir, prefix=pr, **kp)
self.export_annotated_zstack(subdir, prefix=pr, **kp)
if k == 'object_classes':
if k == 'object_classes':
# record[k] = {}
for kc, acc in self.object_class_maps.items():
for kc, acc in self.object_class_maps.items():
fp = subdir / kc / (pr + '.tif')
fp = subdir / kc / (pr + '.tif')
write_accessor_data_to_file(fp, acc)
write_accessor_data_to_file(fp, acc)
record[f'{k}_{kc}'] = fp.__str__()
record[f'{k}_{kc}'] = fp
if k == 'dataframe':
if k == 'dataframe':
dfpa = subdir / (pr + '.csv')
dfpa = subdir / (pr + '.csv')
dfpa.parent.mkdir(parents=True, exist_ok=True)
dfpa.parent.mkdir(parents=True, exist_ok=True)
Loading