A (dirty) fix to this issue is to shell into the singularity image and change the code as follows:
convert existing image to a sandbox singularity build --sandbox --fakeroot fmriprep fmriprep-22.0.2.simg
shell into it singularity shell --fakeroot --writable fmriprep
make edits (any editor can be used) cd /opt/conda/lib/python3.9/site-packages/niworkflows/interfaces
vim freesurfer.py
inside the function refine_aseg(aseg, ball_size=4):
, add the following after Line 483: bmask = aseg.copy()
bmask[bmask == 24] = 0 # CSF
bmask[bmask == 165] = 0 # Skull
bmask[bmask == 258] = 0 # Head-ExtraCerebral
bmask[bmask == 259] = 0 # Eye-Fluid
the line after should be bmask[bmask > 0] = 1
singularity build --fakeroot fmriprep-22.0.2-samseg.simg fmriprep
IN NO EVENT SHALL THE AUTHORS, THE CONTRIBUTORS, THE DISTRIBUTORS, THE MASSACHUSETTS GENERAL HOSPITAL (“AUTHORS”) BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE OR PACKAGE (“SOFTWARE”), EVEN IF THE AUTHORS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. FOR RESEARCH PURPOSE ONLY. THIS SOFTWARE IS PROVIDED ON A “AS IS” BASIS AND THE AUTHORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
Please follow this link (will open a new page) and fill out the form. An e-mail will be sent to you with a personal download link.