micapipe_anonymize
This function anonymizes the anatomical images from the BIDS directory for data sharing. Three different methods are available for defacing/refacing. This tool uses a custom template and a set of ROIs specifically developed to identify the face and skull.
The full head template was created using the T1w images (resolution of 0.8x0.8x0.8mm) of 60 randomly selected healthy individuals from the MICA-MICs dataset (MICs60_T1_0.8mm.nii.gz). An inter-subject non-linear registration was performed without any mask, then the template was built using the mean of the normalized images. Three masks were generated: an ROI that covers the face, a brain mask, and a brain and neck mask.
Unlike other algorithms, micapipe_anonymize
supports different anatomical modalities, and has shown good performance across datasets and modalities.
Identify the T1w image for registration (run-1 in case of multiple acquisitions)
Affine registration from the T1w image to the face atlas
Anonymize images according to selected method(s):
Deface: Apply the affine transformation to the face mask and crop the native T1w by applying the mask
Reface: Apply the affine transformation to the brain-neck mask, use its inverse to crop the native T1w face, and replace with the atlas face.
Warpface: Create a non-linear warpfield from the T1w native face to the refaced atlas and apply the warpfield to the face.
An affine registration from each anatomical acquisition (e.g. quantitative T1, T2w…) to the main T1w is calculated. Then, the atlas face, the face mask and the warp field are registered to the native anatomical volume and applied.
The basic usage of micapipe_anonymize
requires the same inputs as mica-pipe
:
$ micapipe_anonymize -sub <subject_id> -out <outputDirectory> -bids <BIDS-directory> -method <options>
Options |
Description |
---|---|
|
Corresponds to subject ID. Even if your data is in BIDS, we exclude the |
|
Output directory path. Inside this directory the pipeline will create a new folder for each processed subject, containing the anonymized outputs. |
|
Path to rawdata BIDS directory. |
method |
Specify one or more methods to anonymize the structural images: |
This tool can also handle a number of optional arguments:
Optional argument |
Description |
---|---|
|
This optional flag allows the user to specify a session name (e.g. 01, 02, pre, post…). If omitted, all processing will be managed as a single session. |
|
Dilation of the refaced mask (default is 6, set higher if the brain gets cropped during processing) |
|
If reface-warped yields poor results, try running with this flag. This option to run a ROBUST registration, at the expense of more computation time |
|
Include this flag to keep (i.e. not delete) the temporary directory at script completion. |
|
Number of threads to use during processing (Default is 6) |
Example:
Suppose you have a BIDS directory called dataset
alongside an empty directory called dataset_anonymized
. Under the dataset
directory, we see a number of anatomical images from subject 01 sub-01
, session 01 ses-01
. In this case, the participant completed three types of structural acquisitions: T1w, FLAIR and T2map.
dataset/sub-01/ses-01/anat/
├── sub-01_ses-01_FLAIR.json
├── sub-01_ses-01_FLAIR.nii.gz
├── sub-01_ses-01_T1w.json
├── sub-01_ses-01_T1w.nii.gz
├── sub-01_ses-01_T2map.json
└── sub-01_ses-01_T2map.nii.gz
dataset_anonymized
We can run micapipe_anonymize
(all methods) on these acquisitions using the following command:
1micapipe_anonymize -sub 01 -ses 01 -out dataset_anonymized -bids dataset
2-all
Directories created by this script will be contained in
<out>/<sub>
. In our example, the output directory would then consist ofdataset_anonymized/sub-01/
. Each output file contains a string that identifies it with the method used to anonymize it.
dataset/sub-01/ses-01/anat/
├── sub-01_ses-01_FLAIR.json
├── sub-01_ses-01_FLAIR.nii.gz
├── sub-01_ses-01_T1w.json
├── sub-01_ses-01_T1w.nii.gz
├── sub-01_ses-01_T2map.json
└── sub-01_ses-01_T2map.nii.gz
dataset_anonymized/sub-01/
├── sub-01_ses-01_FLAIR_defaced.nii.gz
├── sub-01_ses-01_FLAIR_refaced.nii.gz
├── sub-01_ses-01_FLAIR_warpfaced.nii.gz
├── sub-01_ses-01_T1w_defaced.nii.gz
├── sub-01_ses-01_T1w_refaced.nii.gz
├── sub-01_ses-01_T1w_warpfaced.nii.gz
├── sub-01_ses-01_T2map_defaced.nii.gz
├── sub-01_ses-01_T2map_refaced.nii.gz
└── sub-01_ses-01_T2map_warpfaced.nii.gz