# Issues with make\_scalp\_surfaces

**URL:** <https://mne.discourse.group/t/issues-with-make-scalp-surfaces/4016>\
**Category:** Support & Discussions\
**Tags:** coregistration\
**Created:** [November 23, 2021, 7:59pm UTC](https://mne.discourse.group/t/issues-with-make-scalp-surfaces/4016 "2021-11-23T19:59:57Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [November 25, 2021, 8:41am UTC](https://mne.discourse.group/t/issues-with-make-scalp-surfaces/4016/21 "2021-11-25T08:41:16Z")

</div>

Ok great! Now replace `sample` with your subject’s name, and the path after `-d` should point to the directory with your FreeSurfer subjects’ data.

---

<div class="post-metadata">

**Author:** ![ktyner](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/ktyner/32/989_2.png) [@ktyner](https://mne.discourse.group/u/ktyner)\
**Post date:** [November 29, 2021, 4:36pm UTC](https://mne.discourse.group/t/issues-with-make-scalp-surfaces/4016/22 "2021-11-29T16:36:42Z")

</div>

Greetings all,

I was able to figure out the error. There was a typo in the mkheadsurf function. The error was in the line under “check\_params:”

The line originally was: set OutputSurf = $subjid/surf/$hemi.$headsurf

However, the subjdir is not defined until return from check\_params. So I edited.

The line how I edited: set OutputSurf = $SUBJECTS\_DIR/$subjid/surf/$hemi.$headsurf

I then ran the mne make\_scalp\_surfaces function, and it worked perfect!

I am including here a screenshot of the mkheadsurf function so the edited line can be seen:

 ![Screen Shot 2021-11-29 at 10.34.53 AM](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/5/5a0f059dcca49daeb9ff2295181f98db5a05ffef.png)

Of note: these lines are not present in this script for earlier versions of FreeSurfer. I am using FreeSurfer 7.2.0

Hope this helps!

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [November 29, 2021, 4:41pm UTC](https://mne.discourse.group/t/issues-with-make-scalp-surfaces/4016/23 "2021-11-29T16:41:22Z")

</div>

Thank you for sharing your solution, @ktyner!

cc @larsoner @agramfort

---

<div class="post-metadata">

**Author:** ![larsoner](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/larsoner/32/3_2.png) [@larsoner](https://mne.discourse.group/u/larsoner)\
**Post date:** [November 29, 2021, 6:09pm UTC](https://mne.discourse.group/t/issues-with-make-scalp-surfaces/4016/24 "2021-11-29T18:09:57Z")

</div>

Can you make a PR to [GitHub - freesurfer/freesurfer: Neuroimaging analysis and visualization suite](https://github.com/freesurfer/freesurfer) to fix this bug? It seems like the right thing to do here!

---

<div class="post-metadata">

**Author:** ![Rekha](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/rekha/32/1372_2.png) [@Rekha](https://mne.discourse.group/u/Rekha)\
**Post date:** [May 10, 2022, 5:11am UTC](https://mne.discourse.group/t/issues-with-make-scalp-surfaces/4016/25 "2022-05-10T05:11:01Z")

</div>

Hi @ktyner, i am currently facing the same problem that you have mentioned in this post. How did you solve it? Did you make changes to the source itself of MNE function or did you change your code?

---

<div class="post-metadata">

**Author:** ![ktyner](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/ktyner/32/989_2.png) [@ktyner](https://mne.discourse.group/u/ktyner)\
**Post date:** [May 11, 2022, 7:49pm UTC](https://mne.discourse.group/t/issues-with-make-scalp-surfaces/4016/26 "2022-05-11T19:49:28Z")

</div>

Hi Rekha,

I did indeed solve the problem. The issue was with the mkheadsurf function. I had to change a mistake in the check\_params: section of the code. The line reading set OutputSurf needed to say:

set OutputSurf = $SUBJECTS\_DIR/$subjid/surf/$hemi.$headsurf

Once I made that change, the function worked perfectly for me! I will note that I am using FreeSurfer 7.2.0, and that error was not present in earlier versions of FreeSurfer.

Hopefully that helps you!

[Previous page](https://mne.discourse.group/t/issues-with-make-scalp-surfaces/4016.md?page=1)
