Skip to content

Commit 817c7bf

Browse files
committed
Added option to change the acquisition directory prefix, was defaulted to cell_
1 parent 7de3ccb commit 817c7bf

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

src/navigate/config/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ def verify_experiment_config(manager, configuration):
367367
"celltype": "MV3",
368368
"label": "GFP",
369369
"file_type": "TIFF",
370+
"prefix":"Cell_",
370371
"date": time.strftime("%Y-%m-%d"),
371372
"solvent": "BABB",
372373
}

src/navigate/tools/file_functions.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def create_save_path(saving_settings):
6464
tissue_string = saving_settings["tissue"]
6565
cell_type_string = saving_settings["celltype"]
6666
label_string = saving_settings["label"]
67+
prefix_string = saving_settings["prefix"]
6768
date_string = str(datetime.now().date())
6869

6970
# Make sure that there are no spaces in the variables
@@ -85,15 +86,18 @@ def create_save_path(saving_settings):
8586
os.makedirs(save_directory, exist_ok=True)
8687
# Determine Number of Cells in Directory
8788
# Cell1/Position1/1_CH00_000000.tif
89+
prefix_num = len(prefix_string)
8890
cell_directories = list(
89-
filter(lambda v: v[:5] == "Cell_", os.listdir(save_directory))
91+
# filter(lambda v: v[:5] == "Cell_", os.listdir(save_directory))
92+
filter(lambda v: v[:prefix_num] == prefix_string, os.listdir(save_directory))
9093
)
9194
if len(cell_directories) != 0:
9295
cell_directories.sort()
93-
cell_index = int(cell_directories[-1][5:]) + 1
96+
cell_index = int(cell_directories[-1][prefix_num:]) + 1
9497
else:
9598
cell_index = 1
96-
cell_string = "Cell_" + str(cell_index).zfill(3)
99+
# cell_string = "Cell_" + str(cell_index).zfill(3)
100+
cell_string = prefix_string + str(cell_index).zfill(3)
97101

98102
save_directory = os.path.join(save_directory, cell_string)
99103
os.makedirs(save_directory, exist_ok=True)

src/navigate/view/popups/acquire_popup.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ def __init__(self, root, *args, **kwargs):
9999
"tissue",
100100
"celltype",
101101
"label",
102+
"prefix",
102103
"solvent",
103104
"file_type",
104105
"misc",
@@ -110,6 +111,7 @@ def __init__(self, root, *args, **kwargs):
110111
"Tissue Type",
111112
"Cell Type",
112113
"Label",
114+
"Prefix",
113115
"Solvent",
114116
"File Type",
115117
"Notes",
@@ -163,15 +165,16 @@ def __init__(self, root, *args, **kwargs):
163165
self.inputs["user"].widget.grid(padx=(53, 0))
164166
self.inputs["tissue"].widget.grid(padx=(16, 0))
165167
self.inputs["celltype"].widget.grid(padx=(28, 0))
168+
self.inputs["prefix"].widget.grid(padx=(46,0))
166169
self.inputs["label"].widget.grid(padx=(48, 0))
167-
self.inputs["misc"].widget.grid(padx=(24, 0))
170+
self.inputs["misc"].widget.grid(padx=(40, 0))
168171

169172
# Done and Cancel Buttons
170173
self.buttons["Cancel"] = ttk.Button(content_frame, text="Cancel Acquisition")
171-
self.buttons["Cancel"].grid(row=9, column=0, padx=5, sticky=tk.NSEW)
174+
self.buttons["Cancel"].grid(row=10, column=0, padx=5, sticky=tk.NSEW)
172175

173176
self.buttons["Done"] = ttk.Button(content_frame, text="Acquire Data")
174-
self.buttons["Done"].grid(row=9, column=1, padx=5, sticky=tk.NSEW)
177+
self.buttons["Done"].grid(row=10, column=1, padx=5, sticky=tk.NSEW)
175178

176179
def get_variables(self):
177180
"""Get the variables of the popup

0 commit comments

Comments
 (0)