Skip to content

Commit b442a64

Browse files
committed
block transferToServer if a crop is happening
1 parent e3c2e0e commit b442a64

24 files changed

+1194
-9
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
*.pyc
2-
2+
btpytools.egg-info/
3+
build/
4+
dist/

.idea/misc.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

btpytools.egg-info/.gitignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

btpytools/tools.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
DOWNSAMPLED_STACK_SUB_DIR = "*_micron" # Sub-directories in DOWNSAMPLED_DIR
1818
DOWNSAMPLED_STACK_LOG_FILE = "ds_*.txt" # Wildcard for downsampled stacks
1919
UNCROPPED_WILDCARD = "./Uncropped*_DELETE_ME_DELETE_ME"
20+
CROPPED_TEMP_DIR_WILDCARD = "CROP_stitchedImages_*"
2021
RECIPE_WILDCARD = "recipe*.yml"
2122

2223
# Related to registration directories.
@@ -105,6 +106,15 @@ def has_uncropped_stitched_images(t_path=""):
105106
return file_glob_exist(t_path)
106107

107108

109+
def is_currently_cropping(t_path=""):
110+
"""Check if cropping is currently happening by looking for the temp dir
111+
that the stitchit.sampleSplitter created.
112+
Returns True if cropping right now, False otherwise.
113+
"""
114+
t_path = os.path.join(t_path, CROPPED_TEMP_DIR_WILDCARD)
115+
return file_glob_exist(t_path)
116+
117+
108118
def is_data_folder(dirToTest="", verbose=False):
109119
"""is directory "dirToTest" a BakingTray data directory?
110120
i.e. it satisfies the following criteria:

btpytools/transferToServer.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,15 @@ def main():
425425
if check_directories(source_dirs, destination_dir):
426426
sys.exit()
427427

428+
# Bail out if we find any folders at all that have not finished cropping
429+
for t_dir in source_dirs:
430+
if tools.is_currently_cropping(t_dir):
431+
print("Directory '%s' is currently being cropped. QUITTING." % t_dir)
432+
sys.exit()
433+
428434
# Remove trailing slash from data directories that don't contain data sub-directories
429435
for _ii, t_dir in enumerate(source_dirs):
436+
430437
if tools.is_data_folder(t_dir) and not tools.contains_data_folders(t_dir):
431438
# If here, tDIR is a sample folder without sub-folders. If there is a
432439
# trailing slash then we should delete it. Always.

dist/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/data/cropping_taking_place/CROP_stitchedImages_100/empty

Whitespace-only changes.

tests/data/cropping_taking_place/acqLog_SM_1099839.txt

Lines changed: 1048 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
main: {borderPixSize: 4.0, medFiltRawImage: 5.0, doTiledMerge: true, tiledMergeThresh: 1.05,
2+
defaultThreshSD: 7.0, reCalcThreshSD_threshold: 10.0, rescaleTo: 50.0}
3+
mainBin: {removeNoise: true, medFiltBW: 5.0, primaryShape: disk, primaryFiltSize: 50.0,
4+
expansionShape: square, doExpansion: true, expansionSize: 600.0}
5+
mainGetBB: {minSizeInSqMicrons: 15000.0}
6+
clipper: {doExtension: true, edgeThreshMicrons: 350.0, growROIbyMicrons: 450.0}
7+
mergeO: {mergeThresh: 1.3}
8+
stackStr: {rollingThreshold: true, nImages: 5.0}
9+
autoThresh: {skipMergeNROIThresh: 10.0, doBinaryExpansion: false, minThreshold: 2.0,
10+
maxThreshold: 12.0, allowMaxExtensionIfFewThreshLeft: true, decreaseThresholdBy: 0.9}

tests/data/cropping_taking_place/downsampled_stacks/025_micron/ds_SM_1099839_210521_171144_25_25_ch02_chan_2_red.tif

Whitespace-only changes.

0 commit comments

Comments
 (0)