From 8a4179055e66bdf684d23561f72060ee80e25a52 Mon Sep 17 00:00:00 2001 From: TcFigSCD Date: Thu, 12 Mar 2026 16:54:51 +0100 Subject: [PATCH 1/2] Added new module for image conversion --- modules/local/utility/image_converter/main.nf | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 modules/local/utility/image_converter/main.nf diff --git a/modules/local/utility/image_converter/main.nf b/modules/local/utility/image_converter/main.nf new file mode 100644 index 00000000..e831bb1c --- /dev/null +++ b/modules/local/utility/image_converter/main.nf @@ -0,0 +1,45 @@ +process IMAGE_COVERTER{ + + tag "IMAGE_COVERTER" + + publishDir "${params.outdir}/images", mode: 'copy' + + container "docker://labsyspharm/bftools:latest" + + memory = '50.GB' + cpus = 10 + + input: + path (omi_tif_image) + val (extension) + + output: + path ("bfconvert_output"), emit: converted_images + path ("versions.yml"), emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + + def args = task.ext.args ?: '' + + """ + # Increase heap memory used by JVM inside the container to avoid OutOfMemoryError + # Should be set according to the amount of memonry allocated to the module + export BF_MAX_MEM=50g + + # Create output directory for bfconvert results + mkdir bfconvert_output + + # Run bfconvert with the specified parameters + bfconvert \\ + $args \\ + ${omi_tif_image} bfconvert_output/output_series_%s_Z%z.${extension} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + bftools: \$(echo \$(bfconvert -version 2>&1) | sed 's/^.*Version: //; s/ Build.*\$//') + END_VERSIONS + """ +} \ No newline at end of file From ed35f16014296817b8da9a5403cf842dbf79ba58 Mon Sep 17 00:00:00 2001 From: TcFigSCD Date: Fri, 13 Mar 2026 11:26:32 +0100 Subject: [PATCH 2/2] Added stub to module --- modules/local/utility/image_converter/main.nf | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/local/utility/image_converter/main.nf b/modules/local/utility/image_converter/main.nf index e831bb1c..380ff5a7 100644 --- a/modules/local/utility/image_converter/main.nf +++ b/modules/local/utility/image_converter/main.nf @@ -21,9 +21,7 @@ process IMAGE_COVERTER{ task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' - """ # Increase heap memory used by JVM inside the container to avoid OutOfMemoryError # Should be set according to the amount of memonry allocated to the module @@ -33,6 +31,7 @@ process IMAGE_COVERTER{ mkdir bfconvert_output # Run bfconvert with the specified parameters + # The command for now only works by converting the .ome.tiff image into several .png files. bfconvert \\ $args \\ ${omi_tif_image} bfconvert_output/output_series_%s_Z%z.${extension} @@ -42,4 +41,15 @@ process IMAGE_COVERTER{ bftools: \$(echo \$(bfconvert -version 2>&1) | sed 's/^.*Version: //; s/ Build.*\$//') END_VERSIONS """ + + stub: + """ + mkdir bfconvert_output + touch bfconvert_output/output_series_0_Z0.${extension} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + bftools: \$(echo \$(bfconvert -version 2>&1) | sed 's/^.*Version: //; s/ Build.*\$//') + END_VERSIONS + """ } \ No newline at end of file