I've never actually tried the Lesion Segmentation Toolbox, but if it gives a mask of ones and zeros where lesion has a value of one, then all you need to do is invert this to generate a mask.  You can do this with ImCalc, entering 1-i1 as the expression to evaluate.

For tissue segmentation, I would generally suggest switching to SPM12.  Masking would be done by setting the problem voxels in the image to a value of zero so that they are ignored during the segmentation.

Best regards,
-John


On 14 November 2014 22:20, C. Roman <[log in to unmask]> wrote:
Dear SPM8 Experts,

I am currently running into the following error: "NaN's cannot be converted to logicals" when trying to run segmentation in SPM8 using a masking image. I am working with MS data, so I need to account for lesions in the segmentation process. I have binary lesion maps from SPM's Lesion Segmentation Toolbox, which give lesions a value of 1 and everything else a value of 0. Initially, I used this lesion map as a masking image, but got very odd results (see attached). As a result, I thought that it might be necessary to create an "inverted" mask (lesions = 0, brain = 1). To do this, I pulled a general mask from FSL, used a deformation field to move the mask into the patient's native space, subtracted the LST binary lesion mask from the overall brain mask using fslmaths, and then converted the mask to a SPM compatible file using MRIcron. I checked this mask in SPM8's "Display" function and the mask appears to be in the appropriate space with lesions values=0 and brain=1. When I try to run the segmentation with this "inverted" mask as a masking image, however, I get the aforementioned error.

1. Is there any way to fix this?
2. Is it possible to make an "inverted" mask like this in SPM8 to see if it might be more compatible?

Any help that you might be able to provide would be greatly appreciated.

Thank you,
Cristina