Home > Blockchain >  How to overlay 2 nifti files?
How to overlay 2 nifti files?

Time:10-12

Im a beginner in the nifti world, and have to overlay 2 niftis (one segmented white matter and one segmented gray matter images) together. I tried with FSLeyes but I cant save them to a nifti.

If somebody has dealed with same issue, and can help would be nice, thanks

CodePudding user response:

If I understand you correctly, one way is to use a nifti viewer, like FSLeyes, to load both images and then adjust the transparency of each image until you can see both images together. I think you would need to take a screenshot from here or something hacky.

Another way to overlay two nifti files is to use a nifti conversion tool, like 3dcalc in AFNI, to merge the two images together. You would need to load both images into the tool and then specify how to merge the images, such as adding the values together or multiplying the values.

CodePudding user response:

FSLeyes has good documentation, you can read how to load all your images from the command line. If your two segmentations are called seg1.nii.gz and seg2.nii.gz, according to the URL above you could show them with

fsleyes -sortho -std1mm seg1.nii.gz -cm red-yellow seg2.nii.gz -cm blue-lightblue

That will show them in different colours on a high-res standard-space anatomical background.

Viewing the images won't save them together as a new file. If both segmentations are binary then you could put them in one volume, with:

fslmaths seg1 -sub seg2 seg12

Then seg12.nii.gz would show the part of seg1 as positive (white in FSLeyes) and the part of seg2 as negative (black in FSLeyes) on a grey background.

If you need advice on this it's easier to ask in the FSL mailing list, where you can ask much more FSL-specific questions.

  • Related