Skip to content

Commit 9c1ace9

Browse files
committed
Added logic to request for both bright field-fluorescent and fluorescent-only images to be created
1 parent cbf056e commit 9c1ace9

File tree

1 file changed

+36
-19
lines changed

1 file changed

+36
-19
lines changed

src/murfey/workflows/clem/register_preprocessing_results.py

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -327,27 +327,44 @@ def register_tiff_preprocessing_result(
327327
)
328328
return False
329329

330-
# Request for next stage of processing if all members are present
331-
cluster_response = submit_cluster_request(
332-
session_id=session_id,
333-
instrument_name=instrument_name,
334-
series_name=result.series_name,
335-
images=list(result.output_files.values()),
336-
metadata=result.metadata,
337-
crop_to_n_frames=processing_params.crop_to_n_frames,
338-
align_self=processing_params.align_self,
339-
flatten=processing_params.flatten,
340-
align_across=processing_params.align_across,
341-
messenger=_transport_object,
342-
)
343-
if cluster_response is False:
344-
logger.error(
345-
"Error requesting align-and-merge processing job for "
346-
f"{result.series_name!r} series"
330+
# Construct list of files to use for image alignment and merging steps
331+
image_combos_to_process = [
332+
list(result.output_files.values()) # Composite image of all channels
333+
]
334+
# Create additional job for fluorescent-only composite image if fluorescent channels are present
335+
if ("gray" in result.output_files.keys()) and len(result.output_files) > 1:
336+
image_combos_to_process.append(
337+
[
338+
file
339+
for channel, file in result.output_files.items()
340+
if channel != "gray"
341+
]
347342
)
348-
return False
343+
344+
# Request for image alignment and processing for the requested combinations
345+
for image_combo in image_combos_to_process:
346+
try:
347+
submit_cluster_request(
348+
session_id=session_id,
349+
instrument_name=instrument_name,
350+
series_name=result.series_name,
351+
images=image_combo,
352+
metadata=result.metadata,
353+
crop_to_n_frames=processing_params.crop_to_n_frames,
354+
align_self=processing_params.align_self,
355+
flatten=processing_params.flatten,
356+
align_across=processing_params.align_across,
357+
messenger=_transport_object,
358+
)
359+
except Exception:
360+
logger.error(
361+
"Error requesting image alignment and merging job for "
362+
f"{result.series_name!r} series",
363+
exc_info=True,
364+
)
365+
return False
349366
logger.info(
350-
"Successfully requested align-and-merge processing job for "
367+
"Successfully requested image alignment and merging job for "
351368
f"{result.series_name!r} series"
352369
)
353370
return True

0 commit comments

Comments
 (0)