This script was design to erase all outputs, including .log files of a previously run module. You can use this function in case you encounter an error while processing a module, or if you simply want to rerun a module that you have already started or that is completed. Indeed, if the output files of a module already exist, you will not be able to rerun this module before deleting its outputs.


If you want to erase and rerun a core processing module such as post_structural or proc_structural you may need to rerun all of its dependent modules, to ensure consistency of interdependent modules!

The basic usage of micapipe_cleanup requires the same inputs as in mica-pipe.


$ micapipe -cleanup -sub <subject_id> -out <outputDirectory> -bids <BIDS-directory> -ses <session-name> -<module-to-erase>


$ micapipe_cleanup -sub <subject_id> -out <outputDirectory> -bids <BIDS-directory> -ses <session-name> -<module-to-erase>


$ docker micapipe_cleanup

The module(s) you want to erase should be specified with a flag(s) (e.g. -proc_dwi). Possible optinal arguments are listed below:

Optional arguments



Optional flag that indicates the session name (if omitted, will be managed as a SINGLE session)


Deletes volumetric processing derivatives


Deletes surface processing outputs


Deletes post structural volumetric and surface-based processing derivatives


Deletes diffusion-weighted image processing derivatives


Deletes tractography files and structural connectomes


Deletes resting-state funtional MRI processing derivatives


Deletes microstructural profile and covariance analysis derivatives


Deletes geodesic distance analysis derivatives