Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Commit

Permalink
Merge pull request #66 from BodenmillerGroup/fix_issue57
Browse files Browse the repository at this point in the history
Fix issue57: imctools should now ignore temporary files.
  • Loading branch information
plankter authored Feb 5, 2020
2 parents 20c92f4 + 0fe128d commit 4462445
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
6 changes: 3 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
# -- Project information -----------------------------------------------------

project = 'imctools'
copyright = '2019, Vito Zanotelli'
copyright = '2020, Vito Zanotelli'
author = 'Vito Zanotelli'

# The short X.Y version
version = '1.0.4'
version = '1.0.6'
# The full version, including alpha/beta/rc tags
release = '1.0.4'
release = '1.0.6'


# -- General configuration ---------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions imctools/scripts/imc2tiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from imctools.io import txtparser
import argparse
import os
import glob
from imctools.external import temporarydirectory
import zipfile

Expand Down Expand Up @@ -93,17 +94,16 @@ def convert_imcfolders2tiff(folders, output_folder, common_filepart=None,
common_filepart = ''

for fol in folders:
for fn in os.listdir(fol):
if (common_filepart in fn) & (fn.endswith(IMC_FILENDINGS) |
for fn in glob.glob(os.path.join(fol, '*')):
if (common_filepart in os.path.basename(fn)) & (fn.endswith(IMC_FILENDINGS) |
fn.endswith(ZIP_FILENDING)):
txtname = os.path.join(fol, fn)
txtname = fn
try:
save_imc_to_tiff(txtname,
outpath=output_folder, **kwargs)
except:
failed_images.append(txtname)


if len(failed_images) > 0:
print('Failed images:\n')
print(failed_images)
Expand Down
10 changes: 6 additions & 4 deletions imctools/scripts/ome2micat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from imctools.io import ometiffparser
import argparse
import os
import glob
import shutil
import re

Expand Down Expand Up @@ -38,7 +39,7 @@ def ome2micatfolder(path_ome, basefolder, path_mask=None, dtype=None):
outfolder = os.path.join(basefolder, fn)
if not(os.path.exists(outfolder)):
os.makedirs(outfolder)
ome2singletiff(path_ome, outfolder,basename='', dtype=dtype)
ome2singletiff(path_ome, outfolder, basename='', dtype=dtype)
if path_mask is not None:
fn_mask_base = os.path.split(path_mask)[1]
fn_mask_new = os.path.join(outfolder, fn_mask_base)
Expand All @@ -57,14 +58,15 @@ def omefolder2micatfolder(fol_ome, outfolder, fol_masks=None, mask_suffix=None,
if mask_suffix is None:
mask_suffix = '_mask.tiff'

ome_files = [fn for fn in os.listdir(fol_ome) if fn.endswith('.ome.tiff')]
ome_files = [os.path.basename(fn) for fn in glob.glob(os.path.join(fol_ome, '*')) if fn.endswith('.ome.tiff')]
if fol_masks is not None:
fn_masks = [fn for fn in os.listdir(fol_masks) if fn.endswith(mask_suffix)]
fn_masks = [os.path.basename(fn) for fn in glob.glob(os.path.join(fol_masks, '*')) if fn.endswith(mask_suffix)]
else:
fn_masks = []

for fn_ome in ome_files:
basename_ome = fn_ome.rstrip('.ome.tiff')
len_suffix = len('.ome.tiff')
basename_ome = fn_ome[:-len_suffix]
cur_mask = [fn for fn in fn_masks if fn.startswith(basename_ome)]
if len(cur_mask) > 0:
path_mask = os.path.join(fol_masks, cur_mask[0])
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[build-system]
requires = ["poetry>=0.12.17"]
requires = ["poetry>=1.0.3"]
build-backend = "poetry.masonry.api"

[tool.poetry]
name = "imctools"
version = "1.0.5"
version = "1.0.6"
description = "Tools to handle IMC data"
license = "LICENSE"
authors = [
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name='imctools',
version='1.0.5',
version='1.0.6',
description='Tools to handle IMC data',
long_description=readme,
author='Vito Zanotelli',
Expand Down

0 comments on commit 4462445

Please sign in to comment.