Facial de-identification for Head CTs and potentially MRIs
This code is an adaptation from the idea in this nice paper published in Radiology.
This code implements a series of steps, including optional ones.
- A binarization is performed to select voxels in the range of air (-150 to -1024 HU).
- Optional: connected components can be used to remove from the mask the air bubbles in the head (sinuses/mastoid).
- Optional: mask is smoothed with gaussian filter.
- Mask is dilated.
- Mask is applied to the original DICOM as air.
- Optional: as debbuging, intermediate images can be shown (only if running in jupyter notebooks).
- Optional: The result is persisted in a new dicom file.
Just git-clone or download this repo.
Within the folder where melt.py is, run a python script/Jupyter notebook:
from melt import melt
melt("studies_folder/")
The result will be new DICOM files in a new "melt/" folder.
folder: folder where the head CT scans are located.
target_folder: name of the new folder where the facial de-identified DICOM will be stored.
sinus_mastoid_intact: option not to dilate the sinus and mastoids.
gaussian_filter: option to apply Gaussian filter in the mask.
kernel: size of the kernel to dilate.
iteration: number of dilation iterations.