Skip to content

Commit

Permalink
Robust handling of filenames with dots (.) in them (#35)
Browse files Browse the repository at this point in the history
* Robust handling of filenames with dots in them

* Minor Fixes
  • Loading branch information
ArtemSokolov authored Mar 4, 2022
1 parent e997a9c commit 1ac931f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion SingleCellDataExtraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,12 @@ def ExtractSingleCells(masks,image,channel_names,output, mask_props=None, intens
scdata_z = MaskZstack(masks_loaded,image,channel_names_loaded_checked, mask_props=mask_props, intensity_props=intensity_props)
#Write the singe cell data to a csv file using the image name

# Determine the image name by cutting off its extension
im_full_name = os.path.basename(image)
im_name = im_full_name.split('.')[0]
im_tokens = im_full_name.split(os.extsep)
if len(im_tokens) < 2: im_name = im_tokens[0]
elif im_tokens[-2] == "ome": im_name = os.extsep.join(im_tokens[0:-2])
else: im_name = os.extsep.join(im_tokens[0:-1])

# iterate through each mask and export csv with mask name as suffix
for k,v in scdata_z.items():
Expand Down

0 comments on commit 1ac931f

Please sign in to comment.