layerfMRI / LAYNII

Stand alone fMRI software suite for layer-fMRI analyses.
BSD 3-Clause "New" or "Revised" License
85 stars 25 forks source link

LN2_LAYERS output all zeros when inputting a rim file that only has 0s and 3s #40

Closed jiaen-liu closed 3 years ago

jiaen-liu commented 3 years ago

Hello

I have a data set of gray matter mask. The output of LN2_LAYERS are all zeros. I attached the dataset here mp2rage_brain_GM.nii.gz The command is LN2_LAYERS -rim data_set_name -nr_layers 10 -equivol

Thanks

Jiaen

ofgulban commented 3 years ago

Dear @jiaen-liu ,

Thanks for reaching and already attaching your input. It makes it easy to check.

It seems that your input only has the gray matter labeled. This information is not enough to perform layering. The algorithm needs to know which border is the "inner gray matter border" and which border is the "outer gray matter border". LN2_LAYERS help menu specifies this:

    -rim          : Specify input dataset. Use 1 to code outer gray
                    matter surface (facing mostly CSF), 2 to code inner
                    gray matter surface (facing mostly white matter),
                    and 3 to code pure gray matter voxels.
                    note that values 1 and 2 will not be included in the
                    layerification, this is in contrast to the programs
                    LN_GROW_LAYERS and LN_LEAKY LAYERS 

Therefore, I do not know which software you are using to get your sgementations, but in order to use LN2_LAYERS, you need to have the inner and outer gray matter borders. If you give some details with regards to how you are getting your segmentation, I might be able to advice further.

ofgulban commented 3 years ago

You can have a look at sc_rim.nii.gz and Ding2016_occip_rim.nii.gz in our test_data folder as examples of the right types of segmentation inputs to LN2_LAYERS.

jiaen-liu commented 3 years ago

Hi Faruk

I originally checked sc_rim.nii.gz. I didn't notice there are thin layers of value 2 and 1 along the grey matter. I just masked the output of FAST to get the grey matter mask. What software do you prefer to prepare the input of laynii? If still using FAST, what intermediate output will best fit laynii? Thanks a lot!

On Thu, Jul 1, 2021 at 10:47 AM Omer Faruk Gulban @.***> wrote:

Dear @jiaen-liu https://github.com/jiaen-liu ,

Thanks for reaching and already attaching your input. It makes thins easy to check.

It seems that your input only has the gray matter labeled. This information is not enough to perform layering. The algorithm needs to know which border is the "inner gray matter border" and which border is the "outer gray matter border". LN2_LAYERS help menu specifies this:

-rim          : Specify input dataset. Use 1 to code outer gray
                matter surface (facing mostly CSF), 2 to code inner
                gray matter surface (facing mostly white matter),
                and 3 to code pure gray matter voxels.
                note that values 1 and 2 will not be included in the
                layerification, this is in contrast to the programs
                LN_GROW_LAYERS and LN_LEAKY LAYERS

Therefore, I do not know which software you are using to get your sgementations, but in order to use LN2_LAYERS, you need to have the inner and outer gray matter borders. If you give some details with regards to how you are getting your segmentation, I might be able to advice further.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/layerfMRI/LAYNII/issues/40#issuecomment-872354773, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ3W3QFGG5PSYXKTZPGE5VDTVSEY5ANCNFSM47U54J5Q .

ofgulban commented 3 years ago

Any program that gives at least white matter and gray matter segmentation is "theoretically" ok to use (you can code everything that is not white or gray matter as the "outer gray matter border"). Personally, I use ITKSNAP the most but bear in mind that I also process a lot of different living or dead human or animal images with different contrasts. I do a lot of manual corrections and other advanced tricks too (e.g. segmentator).

I think you can use LN2_RIMIFY program to convert the FSL FAST output to the "rim" format LayNii likes. Also note that you do not need to have thin layers of values 1 and 2 along the grey matter. It is fine to not have thin layers with 1 & 2 (see Ding2016_occip_rim.nii.gz example nifti).

jiaen-liu commented 3 years ago

I will give it a try. It makes much sense to me. To make it work better, should I do any processing such as smoothing of the segmentation before LN2_LAYERS? I noticed there are some isolated voxels after FAST. Is there a recommended protocol of preprocessing to run laynii? Thanks

ofgulban commented 3 years ago

I think a satisfactory answer would require a big discussion and also would be strongly dependent on which type of segmentation algorithm is being used. Ideally the tissue labels should be as accurate and precise as possible. So anything that would bring you closer to this goal is fine (e.g. smoothing + re-binning, or connected clusters thresholding to get rid of the singular mislabeled voxels). As @layerfMRI and I are acquiring and analyzing a lot of different types of images at varying resolutions and SNR with LayNii, I cannot give you a simple answer for a recommended preprocessing, other than stating the obvious (as accurate and precise as possible tissue labels).

However, when I was looking at your gray matter segmentation, I have realized that you have brainstem and cerebellum included. A relatively easy improvement would be masking out the cerebellum and brainstem, then running FSL FAST. This way the cerebellar white/gray matter and subcortical gray matter would not affect your cortical gray matter intensity ranges when FAST is figuring out tissue intensity ranges.

In addition, I think you would benefit the most from a complete pipeline/software that is optimized for whole brain MP2RAGE, given your images are high enough SNR. I suggest the following paper that proposes an optimized pipeline for MP2RAGE at 7T segmentation:

Though, in my experience, even such optimized pipelines can fail at specific locations, depending on the subjects morphology, imaging quality etc.

jiaen-liu commented 3 years ago

Thanks! I just started using these tools.These are all very helpful information.

On Fri, Jul 2, 2021 at 5:45 AM Omer Faruk Gulban @.***> wrote:

I think a satisfactory answer would require a big discussion and also stongly dependent on which type of segmentation algorithm is being used. Ideally the tissue labels should be as accurate and precise as possible. So anything that would bring you closer to this goal is fine (e.g. smoothing + re-binning, or connected clusters thresholding to get rid of the singular mislabeled voxels). As we are acquiring and analyzing a lot of different types of images at varying resolutions and SNR, I cannot give you a simple answer for a recommended preprocessing, other than stating the obvious (as accurate and precise as possible tissue labels).

However, when I was looking at your gray matter segmentation, I have realized that you have brainstem and cerebellum included. A relatively easy improvement would be masking out the cerebellum and brainstem, then running FSL FAST. This way the cerebellar white/gray matter and subcortical gray matter would not affect your cortical gray matter intensity ranges when FAST is figuring out tissue segmenations.

In addition, I think you would benefit the most from a complete pipeline/software that is optimized for MP2RAGE, given your images are high enough SNR. I suggest the following paper that proposes an optimized pipeline for MP2RAGE at 7T segmentation: Bazin, P.-L., Weiss, M., Dinse, J., Schäfer, A., Trampel, R., & Turner, R. (2014). A computational framework for ultra-high resolution cortical segmentation at 7Tesla. NeuroImage, 93 Pt 2, 201–209. https://doi.org/10.1016/j.neuroimage.2013.03.077

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/layerfMRI/LAYNII/issues/40#issuecomment-872904557, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ3W3QEEA2G2VBKW4MHQPILTVWKGJANCNFSM47U54J5Q .