Skip to content

Module initialization

This tutorial series explains how to contribute a module to nf-neuro. For the exercise, you will recreate an already available module, DENOISING_NLMEANS, so you can refer to its implementation if needed. The purpose of this module is denoising anatomical MRI images, like T1w and T2w images, using the Non-Local Means (NLM) algorithm. We’ll use the implementation available in scilpy, via the script scil_denoising_nlmeans.py.

[Skip if working in the devcontainer] If not done already, clone the nf-neuro repository locally and navigate to it :

Terminal window
git clone https://github.com/scilus/nf-neuro.git
cd nf-neuro

Create a new branch for your module. To help you and maintainers track changes, use the convention module/<category>_<tool> to name your branch (we’ll use : module/denoising_nlmeans) :

Terminal window
git checkout -b module/denoising_nlmeans

Open a terminal (with access to the nf-core command). Use cd to move to the location of the nf-neuro repository and generate the module’s skeleton :

Terminal window
nf-core modules create

Answer the prompts using the information below :

  1. Name of tool/subtool : denoising/nlmeans
    • This is the <category>/<tool> of the module you plan creating
  2. Bioconda package : select no.
    • There are no offical neuroconda package distributor yet, so we don’t support it, but you are welcome to investiguate !
    • Nextflow integrates conda, refer to the nf-core documentation for more information on the matter.
  3. Github author : your Github handle (prefixed with @), or @scilus if you prefer no accreditation.
  4. Resource label : for denoising/nlmeans, select process_medium, since it can parallelize computations
    • Resource allocation with labels can vary depending on infrastructure and availability.
    • All labels below get allocated around 4Gb of RAM. For CPU, a rule of thumb is :
      • process_single : 1 CPU core
      • process_low : 2 CPU cores
      • process_medium : 4 CPU cores
      • process_high : 6 CPU cores
  5. Meta map : select yes.

Alternatively, you can use the following command to supply nearly all information :

Terminal window
nf-core modules create --author @scilus --label process_medium --meta denoising/nlmeans

You will still have to interact with the bioconda prompt, still select no.

The command will generate your new module template in the ./modules/nf-neuro/denoising/nlmeans directory. Navigate to it and familiarize yourself with the various files generated. After that, switch to the next section of the tutorial and proceed to edit the main.nf file.