The aim of this project is to execute an automatic masking of fetal brain images using deep learning.
It takes as an input the path of a target directory and executes the masking of all .nii files. The output will be an extra .nii file for each one of them, ending with the exact same name ending with "_mask.nii".
- Python3
- pip
For an easy use of the tool is highly recommended to create a virtual environment and install the dependencies found in the requirements.txt file.
Access to your terminal and type the following:
$ pip install virtualenv virtualenvwrapper
Then create a directory for the virtual environments:
$ mkdir ~/python-envs
Now you'll add to your .bashrc file these two lines:
$ export WORKON_HOME=~python-envs
$ source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
(If this path to virtualenvwrapper.sh doesn't work, try with:)
$ /usr/share/virtualenvwrapper/virtualenvwrapper.sh
Now you're ready to source your .bashrc and create a Python3 environment:
$ source .bashrc
$ mkvirtualenv --python=python3 python_env
$ workon python_env
(Note that "python_env" is a suggested name, you can replace it with any desired name for your environment)
And finally when you're done working you can deactivate the environment with:
$ deactivate
Once you're in your own environment access to the desired location and type the following commands:
$ git clone https://github.com/chrisorozco1097/masking_tool
$ cd masking_tool
Now install the requirements
$ pip install -r requirements.txt
And finally execute the tool:
$ python brain_mask.py --target_dir path_to_your_directory
If you don't specify a directory the tool will target the .nii files found in the local directory.
You will have to activate the environment every time you want to run the tool.