neurodatascience / nipoppy

Lightweight framework for neuroimaging-clinical data organization/processing
https://nipoppy.readthedocs.io/en/latest/
MIT License
10 stars 19 forks source link

Refactor container-related components of Boutiques descriptors #239

Open michellewang opened 1 month ago

michellewang commented 1 month ago
michellewang commented 1 month ago

We also decided to no longer have Nipoppy-specific default values in the descriptor files themselves -- instead they will be stored in the default/sample invocation files

michellewang commented 3 weeks ago

It turns out that this is trickier than initially thought, because Boutiques will surround the container command with quotes (for security purposes). I have opened an issue for that, let's see if they respond.

Tentative descriptor modifications (for future reference):

{
    "command-line": "[CONTAINER_WRAPPER] dcm2bids [DICOM_DIR] [PARTICIPANT] [SESSION] [CONFIG] [OUTPUT_DIR] [AUTO_EXTRACT_ENTITIES] [BIDS_VALIDATE] [FORCE_DCM2BIDS] [SKIP_DCM2NIIX] [CLOBBER] [LOG_LEVEL] [VERSION]",
    "inputs": [
        {
            "id": "container_wrapper",
            "name": "container_wrapper",
            "description": "The full container command to run the tool, for example 'apptainer run container.sif'. By default this does not add anything to the command line",
            "optional": true,
            "type": "String",
            "value-key": "[CONTAINER_WRAPPER]",
            "default-value": null
        }
    ]
}

Corresponding invocation:

{
    "container_wrapper": "[[NIPOPPY_CONTAINER_COMMAND]] [[NIPOPPY_FPATH_CONTAINER]]",
    "dicom_dir": [
        "[[NIPOPPY_DPATH_SOURCEDATA]]/[[NIPOPPY_PARTICIPANT]]/[[NIPOPPY_SESSION]]"
    ],
    "participant": "[[NIPOPPY_PARTICIPANT]]",
    "session": "[[NIPOPPY_SESSION_SHORT]]",
    "config": "[[DCM2BIDS_CONFIG_FILE]]",
    "output_dir": "[[NIPOPPY_DPATH_BIDS]]"
}

Doesn't work because whatever is in "container_wrapper" gets surrounded by single quotes :/

michellewang commented 1 week ago

After chatting with Mathieu at OHBM brainhack, we found a workaround using environment variables (e.g. replace [[NIPOPPY_CONTAINER_COMMAND]] with $NIPOPPY_CONTAINER_COMMAND and setting the environment variables before running bosh