Brain segmentation

hello I’m trying to segment the cortex using python script, is there anyone who can help me? please!