Brain image segmentation into grey/white matter

Update to below question: nipype has a watershed algorithm to segment given image into white and grey matter. I am not sure though how to use this API.✓&q=WatershedSkullStrip&type=

I provide a .nii file in the in_file parameter. On calling the

‘mri_watershed -T1 transforms/talairach_with_skull.lta T1.mgz’

nothing happens. How to use this WaterShedSkullStrip() API so that a segmented image is ouput ?

Old question:
I have installed nilearn on my ubuntu 16.8 LTS. I am trying to implement some basic preprocessing steps to analyse abide datasets currently with the dparsf pipeline. I am wondering if nilearn has a way to segment the brain images into grey and white matter and compare the densities of these regions ?


In your case, you are just viewing the command that will be called. If you want to run the interface, you’ll want to use

Some more information on using Nipype’s interfaces can be found in the Nipype Tutorial. If you run into further issues, don’t hesitate to ask!

Hi @mgxd thanks so much for replying :slight_smile:
i did run the cmd but it gives me the ‘command mri_watershed not found’. Should freesurfer software be installed for this to work ?

Yes, for the most part Nipype serves as a command line wrapper for these commands, but the underlying software that does the calculations will need to be installed on the system.

1 Like

@MeenVen I would suggest having a look to


@oesteban @mgxd thanks for the suggestion. I am trying to analyse ABIDE datasets and i do not think it is available in the BIDS format. On my Ubuntu (16.04 LTS, 700 gb disk, 15 gb memory), i have already installed nilearn, nipype. freesurfer looks like >4 gb of space. Eventually my goal is to do some machine learning on the dataset. I installed CPAC but i’ve found it hard to get it configured and setup on a standalone machine.
i think fmriprep needs docker installed (openneuro processes only bids format datasets) but not sure if my ubuntu version has support for docker.
Can i do this installation on google cloud or aws ?I’d really appreciate suggestions on what combinations of software would serve the above task well.

@MeenVen, datalad folks just released ABIDE in BIDS ( You can set up neurodebian on your ubuntu and apt install datalad. After that, datalad install and datalad get are your friends.

Docker is surely available through apt for your Ubuntu. Then FMRIPREP would take very easy steps (see to run it on ABIDE.

You can also pip install fmriprep, however this way you will need to make sure that all the dependencies are met and functional (AFNI, ANTS, FreeSurfer, FSL, C3D, etc.).



that was very helpful. thanks!
I ended up using datalad and installed FSL for the segmentation. Using the Fast routine, is it possible to segment multiple images parallely? The UI seems to support just one file at a time which also takes 10-20 mins. Is there a tool for parallel segmentation of anatomical images ?
Thank you once again!

Just for a complete disclosure – all the kudos for ABIDE in BIDS should go to INDI folks who released it in BIDS – we have just “exposed” it from their S3 (fcp-indi) bucket via DataLad. If you know/have more of interesting datasets in S3 let us know – it is quite easy to provide a git-annex repo for an S3 bucket (unless need to partition it more into sub-datasets etc)

Kudos to INDI folks as well!

Datalad is now even more awesome with their data in it.

Thanks a lot! Am I right that ABIDE in BIDS means no preprocessing, just anonymized raw data?

1 Like

Unfortunately, when I run the BIDS validator tool, the dataset seems not-compliant with BIDS. Especially because the TR time is missing. I can see that there’s a resources file with the TR from different acquisition files and also it seems to be in the nifti header, so I am puzzled.

Any insights? Thanks :pray: