From grace.harvie at sydney.edu.au Mon Nov 9 06:34:14 2026 From: grace.harvie at sydney.edu.au (Grace Harvie) Date: Mon, 9 Nov 2026 05:34:14 +0000 Subject: [FieldTrip] SPM error when segmenting NIHPD volumes Message-ID: Hi all, I'm trying to create a BEM conduction head model to use for source localisation of EEG data in eeglab. As the age range of my dataset spans from 6-16 years, I was planning on using the NIST pediatric atlases (NIHPD). However, I keep encountering an error when trying to segment the volume:     *- SPM12: spm_affreg ---------------------------------------------     There is not enough overlap in the images     to obtain a solution.     Please check that your header information is OK.     The Check Reg utility will show you the initial     alignment between the images, which must be     within about 4cm and about 15 degrees in order     for SPM to find the optimal solution.     ----------------------------------------- 12:51:29 - 09/11/2026 Error using spm_affreg>error_message (line 465) insufficient image overlap Error in spm_affreg (line 172) if length(msk)<32, error_message; end ^^^^^^^^^^^^^ Error in spm_normalise (line 176) [M,scal] = spm_affreg(VG1, VF1, aflags, M); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error in ft_convert_coordsys (line 295) params = spm_normalise(V2,V1,[],[],[],flags); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error in ft_volumesegment (line 301) mri = ft_convert_coordsys(mri, 'acpc'); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error in BEMModelCreator (line 122) t1.(currAgeRange).segmented = ft_volumesegment(cfg, t1.(currAgeRange).resliced); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I encounter this error with all four of the NIHPD volumes I'm trying to create templates from (4.5-8.5y, 7-11y, 10-14y and 13-18.5y). I've stepped through all the functions called by ft_volumesegment() which throw errors, and the problem seems to be that, spm_affreg(), around the 40th iteration, updates the cost function for multiple variables, one of which is updated to NaN (ss1, ln 195-203). I also installed SPM12 so that I could check the header information, but I couldn't figure out how to view this in Check Reg. As for image ovelap, I'm only working on a single volume, so I'm not sure this is an alignment issue. This is the first time I've worked with any MRI data and I'm not sure how to proceed (or even if this question is better directed at the SPM mailing list). Any help or advice on how to resolve this so that segmentation of these volumes would be greatly appreciated. The script I'm working from is based on the FieldTrip tutorial (https://www.fieldtriptoolbox.org/tutorial/source/headmodel_eeg_bem/) can be found here: https://github.com/graematterneuro/NIHPD-BEM-Model/blob/main/BEMModelCreator.m Many thanks, Grace Harvie PhD Candidate, Faculty of Medicine and Health, University of Sydney Research Assistant, Brain Dynamics Centre, Westmead Institute For Medical Research ________________________________ 176 Hawkesbury Road | PO Box 412 | Westmead NSW 2145 Australia grace.harvie at sydney.edu.au | M +61 493 817 559 westmeadinstitute.org.au | Follow us on Facebook | Watch us on YouTube This email is private and confidential to the intended recipient. If you are not the intended recipient, please do not copy it, circulate it or take any action in reliance on it. Kindly notify me that it has been misdirected and then delete it. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From janmathijs.schoffelen at donders.ru.nl Mon Nov 9 10:56:30 2026 From: janmathijs.schoffelen at donders.ru.nl (Schoffelen, J.M. (Jan Mathijs)) Date: Mon, 9 Nov 2026 09:56:30 +0000 Subject: [FieldTrip] SPM error when segmenting NIHPD volumes In-Reply-To: References: Message-ID: <2A1D6434-B2ED-4E3D-BD58-9B41F3A24C57@donders.ru.nl> Dear Grace, Don’t quote me on this, since I have never worked with children’s anatomical MRIs before, but I can imagine that the error that you get is caused by the fact that SPM tries to segment a child-sized brain based on a template (a.k.a. tissue probability maps) of adult brains. It could be that the algorithmic heuristics used in SPM don’t converge to a solution, and hence throw an error. As such - indeed - I think your question might be better suited for the SPM mailing list, or otherwise consult the web. Not inhibited by any knowledge I came across this paper: https://doi.org/10.1016/j.neuroimage.2008.02.056, which might serve as a point of departure. There might be more recent stuff as well. Best wishes, Jan-Mathijs On 9 Nov 2026, at 06:34, Grace Harvie via fieldtrip wrote: Hi all, I'm trying to create a BEM conduction head model to use for source localisation of EEG data in eeglab. As the age range of my dataset spans from 6-16 years, I was planning on using the NIST pediatric atlases (NIHPD). However, I keep encountering an error when trying to segment the volume:     *- SPM12: spm_affreg ---------------------------------------------     There is not enough overlap in the images     to obtain a solution.     Please check that your header information is OK.     The Check Reg utility will show you the initial     alignment between the images, which must be     within about 4cm and about 15 degrees in order     for SPM to find the optimal solution.     ----------------------------------------- 12:51:29 - 09/11/2026 Error using spm_affreg>error_message (line 465) insufficient image overlap Error in spm_affreg (line 172) if length(msk)<32, error_message; end ^^^^^^^^^^^^^ Error in spm_normalise (line 176) [M,scal] = spm_affreg(VG1, VF1, aflags, M); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error in ft_convert_coordsys (line 295) params = spm_normalise(V2,V1,[],[],[],flags); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error in ft_volumesegment (line 301) mri = ft_convert_coordsys(mri, 'acpc'); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error in BEMModelCreator (line 122) t1.(currAgeRange).segmented = ft_volumesegment(cfg, t1.(currAgeRange).resliced); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I encounter this error with all four of the NIHPD volumes I'm trying to create templates from (4.5-8.5y, 7-11y, 10-14y and 13-18.5y). I've stepped through all the functions called by ft_volumesegment() which throw errors, and the problem seems to be that, spm_affreg(), around the 40th iteration, updates the cost function for multiple variables, one of which is updated to NaN (ss1, ln 195-203). I also installed SPM12 so that I could check the header information, but I couldn't figure out how to view this in Check Reg. As for image ovelap, I'm only working on a single volume, so I'm not sure this is an alignment issue. This is the first time I've worked with any MRI data and I'm not sure how to proceed (or even if this question is better directed at the SPM mailing list). Any help or advice on how to resolve this so that segmentation of these volumes would be greatly appreciated. The script I'm working from is based on the FieldTrip tutorial (https://www.fieldtriptoolbox.org/tutorial/source/headmodel_eeg_bem/) can be found here: https://github.com/graematterneuro/NIHPD-BEM-Model/blob/main/BEMModelCreator.m Many thanks, Grace Harvie PhD Candidate, Faculty of Medicine and Health, University of Sydney Research Assistant, Brain Dynamics Centre, Westmead Institute For Medical Research ________________________________ 176 Hawkesbury Road | PO Box 412 | Westmead NSW 2145 Australia grace.harvie at sydney.edu.au | M +61 493 817 559 westmeadinstitute.org.au | Follow us on Facebook | Watch us on YouTube This email is private and confidential to the intended recipient. If you are not the intended recipient, please do not copy it, circulate it or take any action in reliance on it. Kindly notify me that it has been misdirected and then delete it. Thank you. _______________________________________________ fieldtrip mailing list https://mailman.science.ru.nl/mailman/listinfo/fieldtrip https://doi.org/10.1371/journal.pcbi.1002202 -------------- next part -------------- An HTML attachment was scrubbed... URL: From grace.harvie at sydney.edu.au Mon Nov 9 23:17:36 2026 From: grace.harvie at sydney.edu.au (Grace Harvie) Date: Mon, 9 Nov 2026 22:17:36 +0000 Subject: [FieldTrip] SPM error when segmenting NIHPD volumes In-Reply-To: References: Message-ID: Hi Jan-Marthijs, Thanks for the insight. I did briefly wonder whether the fact that the scans were paediatric might be causing problems. I will follow up on the SPM mailing list and take a closer look at the Template-O-Matic toolbox from the paper you linked to. Many thanks, Grace Harvie PhD Candidate, Faculty of Medicine and Health, University of Sydney Research Assistant, Brain Dynamics Centre, Westmead Institute For Medical Research ________________________________ 176 Hawkesbury Road | PO Box 412 | Westmead NSW 2145 Australia grace.harvie at sydney.edu.au | M +61 493 817 559 westmeadinstitute.org.au | Follow us on Facebook | Watch us on YouTube This email is private and confidential to the intended recipient. If you are not the intended recipient, please do not copy it, circulate it or take any action in reliance on it. Kindly notify me that it has been misdirected and then delete it. Thank you. ________________________________ From:"Schoffelen, J.M. (Jan Mathijs)" Sent: Monday, 9 November 2026 10:00 PM To: fieldtrip at science.ru.nl Subject: Re: [FieldTrip] SPM error when segmenting NIHPD volumes Dear Grace, Don’t quote me on this, since I have never worked with children’s anatomical MRIs before, but I can imagine that the error that you get is caused by the fact that SPM tries to segment a child-sized brain based on a template (a.k.a. tissue probability maps) of adult brains. It could be that the algorithmic heuristics used in SPM don’t converge to a solution, and hence throw an error. As such - indeed - I think your question might be better suited for the SPM mailing list, or otherwise consult the web. Not inhibited by any knowledge I came across this paper: https://doi.org/10.1016/j.neuroimage.2008.02.056, which might serve as a point of departure. There might be more recent stuff as well. Best wishes, Jan-Mathijs On 9 Nov 2026, at 06:34, Grace Harvie via fieldtrip wrote: Hi all, I'm trying to create a BEM conduction head model to use for source localisation of EEG data in eeglab. As the age range of my dataset spans from 6-16 years, I was planning on using the NIST pediatric atlases (NIHPD). However, I keep encountering an error when trying to segment the volume:     *- SPM12: spm_affreg ---------------------------------------------     There is not enough overlap in the images     to obtain a solution.     Please check that your header information is OK.     The Check Reg utility will show you the initial     alignment between the images, which must be     within about 4cm and about 15 degrees in order     for SPM to find the optimal solution.     ----------------------------------------- 12:51:29 - 09/11/2026 Error using spm_affreg>error_message (line 465) insufficient image overlap Error in spm_affreg (line 172) if length(msk)<32, error_message; end ^^^^^^^^^^^^^ Error in spm_normalise (line 176) [M,scal] = spm_affreg(VG1, VF1, aflags, M); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error in ft_convert_coordsys (line 295) params = spm_normalise(V2,V1,[],[],[],flags); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error in ft_volumesegment (line 301) mri = ft_convert_coordsys(mri, 'acpc'); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error in BEMModelCreator (line 122) t1.(currAgeRange).segmented = ft_volumesegment(cfg, t1.(currAgeRange).resliced); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I encounter this error with all four of the NIHPD volumes I'm trying to create templates from (4.5-8.5y, 7-11y, 10-14y and 13-18.5y). I've stepped through all the functions called by ft_volumesegment() which throw errors, and the problem seems to be that, spm_affreg(), around the 40th iteration, updates the cost function for multiple variables, one of which is updated to NaN (ss1, ln 195-203). I also installed SPM12 so that I could check the header information, but I couldn't figure out how to view this in Check Reg. As for image ovelap, I'm only working on a single volume, so I'm not sure this is an alignment issue. This is the first time I've worked with any MRI data and I'm not sure how to proceed (or even if this question is better directed at the SPM mailing list). Any help or advice on how to resolve this so that segmentation of these volumes would be greatly appreciated. The script I'm working from is based on the FieldTrip tutorial (https://www.fieldtriptoolbox.org/tutorial/source/headmodel_eeg_bem/) can be found here: https://github.com/graematterneuro/NIHPD-BEM-Model/blob/main/BEMModelCreator.m Many thanks, Grace Harvie PhD Candidate, Faculty of Medicine and Health, University of Sydney Research Assistant, Brain Dynamics Centre, Westmead Institute For Medical Research ________________________________ 176 Hawkesbury Road | PO Box 412 | Westmead NSW 2145 Australia grace.harvie at sydney.edu.au | M +61 493 817 559 westmeadinstitute.org.au | Follow us on Facebook | Watch us on YouTube This email is private and confidential to the intended recipient. If you are not the intended recipient, please do not copy it, circulate it or take any action in reliance on it. Kindly notify me that it has been misdirected and then delete it. Thank you. _______________________________________________ fieldtrip mailing list https://mailman.science.ru.nl/mailman/listinfo/fieldtrip https://doi.org/10.1371/journal.pcbi.1002202 -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ Subject: Digest Footer _______________________________________________ fieldtrip mailing list https://mailman.science.ru.nl/mailman/listinfo/fieldtrip _______________________________________________ fieldtrip mailing list https://mailman.science.ru.nl/mailman/listinfo/fieldtrip https://doi.org/10.1371/journal.pcbi.1002202 ------------------------------ End of fieldtrip Digest, Vol 192, Issue 1 ***************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: