Thank you Iain for this great explanation!!
Jon
Hi John,
I'm guessing that by removing the thalamus, you just mean to set thalamus pixels to a value of "0" in your T1.nii image?
If that's the case just try to think of it as a simple maths command. Both images are just matrices of numbers. One image is a brain, and the other image marks out where the thalamus is in that first image. I'm assuming your thalamus image is a binary mask (i.e. 1's for the thalamus and 0's for everything else). If you were to multiply your images together at the moment you'd therefore be left with an image of only the thalamus with everything else having been set to 0.
Clearly you want the inverse of this situation though (set the thalamus to "0" in the original image), and one way of doing that is therefore to use an inverse mask of the thalamus ("1"s for non-thalamus locations and "0"s for thalamus locations).
There may be a more efficient command buried in the various fslutils, but the following method will get you what you want. Note that I'm assuming here that you're starting out with a binary mask of the thalamus as I've described in the first paragraph:
Subtract 1 from your thalamus mask - fslmaths MASK.nii.gz -sub 1 TEMP.nii.gz
Multiply the result by itself - fslmaths TEMP.nii.gz -mul TEMP.nii.gz INVERTED_MASK.nii.gz
(It's possible to combine these into one command and not be left with the "TEMP" image but I printed it as two to show the working more clearly, so to speak).
Whereas your mask image started with 1's for the thalamus and 0's for everything else, INVERTED_MASK will have 0's for the thalamus and 1's for everything else. If you now multiply your T1 image by the INVERTED_MASK image ("fslmaths T1.nii -mul INVERTED_MASK.nii.gz T1_WITH_NO_THALAMUS.nii.gz") the resulting image will be the same as the T1.nii image but with the thalamus pixels set to "0".
All the best,
Iain
On 15 June 2017 at 18:12, John anderson <[log in to unmask]> wrote:
Dear experts,
I have image and mask and I want to subtract the mask from the image. Meaning I want to get image free os specific anatomical region. For example. I have image T1.nii for the brain and mask for the thalamus. How can I remove the thalamus from the T1 image to get T1 image free of the thalamus.
Thanks you for any help
Jon
|