ANTsX / ANTsR

R interface to the ANTs biomedical image processing library
https://antsx.github.io/ANTsR
Apache License 2.0
127 stars 35 forks source link

Regarding the extraction of cortical thickness based on the atlas #407

Open JinDJsuper opened 4 days ago

JinDJsuper commented 4 days ago

Hello, I have been working on structural analysis of an animal and have used a lot of ANTs software. This time, I finally managed to run the antsCorticalThickness.sh script through debugging and obtained the desired cortical thickness (ct) files. However, I encountered some issues during the analysis and would like to ask for your advice:

1.I obtained the cortical thickness in individual space; do I need to register it to template space using antsApplyTransforms for analysis?

2.I can perform group analysis of cortical thickness by importing software like SPM,fsl. However, I found a concept in some articles regarding comparing differences by obtaining the average cortical thickness from the atlas (average weighted). I'm not sure how to extract the average cortical thickness of different brain regions based on the atlas.

3.I may also need to know the average cortical thickness (ct) for the whole brain, as well as how to process and display multiple ct files to show the average ct at different locations in this group of brains.

I think these questions might be related: 1.2 The first two questions are about multiple brain regions based on the atlas. 3 The third question is about the whole brain and group average.

I really hope to get some answers.

ntustison commented 4 days ago

1.I obtained the cortical thickness in individual space; do I need to register it to template space using antsApplyTransforms for analysis?

That's one way of doing it. But you'd have to use a combination of antsRegistration in conjunction with antsApplyTransforms.

2.I can perform group analysis of cortical thickness by importing software like SPM,fsl. However, I found a concept in some articles regarding comparing differences by obtaining the average cortical thickness from the atlas (average weighted). I'm not sure how to extract the average cortical thickness of different brain regions based on the atlas.

Here's how you can do that group, voxelwise analysis in ANTsR. If you want to quantify these values in different brain regions, you'd need a way to parcellate the brain. For example, in the human brain, we typically use the "Desikan-Killiany-Tourville" atlas.

JinDJsuper commented 4 days ago

Here's how you can do that group, voxelwise analysis in ANTsR. If you want to quantify these values in different brain regions, you'd need a way to parcellate the brain. For example, in the human brain, we typically use the "Desikan-Killiany-Tourville" atlas.

Thank you for your reply. I found this in a previous forum, and the result generated after incorporating it is this."I used the animal atlas provided in the literature to replace the DKT.

I know this answer relates to Python; is there a version available for ANTsR?

>>> import ants
>>> kk = ants.image_read('db68_CorticalThickness_2sub.nii.gz')  # ct_image
>>> dkt = ants.image_read('cornatlas.nii')  # atlas_image
>>> dkt_cortical_mask = ants.threshold_image(dkt,1,234,1,0)  # total  234 brain area
>>> dkt = dkt_cortical_mask * dkt
>>> kk_mask = ants.threshold_image(kk, 0, 0, 0, 1)
>>> dkt_propagated = ants.iMath(kk_mask, "PropagateLabelsThroughMask", kk_mask * dkt)
>>> kk_regional_stats = ants.label_stats(kk, dkt_propagated)
>>> print(kk_regional_stats)
with open('kk_regional_stats.txt', 'w') as f:
...     f.write(str(kk_regional_stats))

The code above is mine, and I'm not sure if this input is correct.

1727367185747

ntustison commented 4 days ago

Yes, all those commands are also available in ANTsR. Take a look at the tutorial I linked to above and scroll through some of the commands in ANTsR. If you still can't find the ANTsR equivalent, you can return and ask about specific functions.

JinDJsuper commented 4 days ago

Yes, all those commands are also available in ANTsR. Take a look at the tutorial I linked to above and scroll through some of the commands in ANTsR. If you still can't find the ANTsR equivalent, you can return and ask about specific functions.

"I'm sorry, I could only find this wiki on the ANTsXNet cortical thickness webpage that tells me how to generate results; I haven't found the ANTsR wiki yet. some webpage only has this segment:

library( ANTsR ) 
library( ANTsRNet )
t1 <- antsImageRead( getANTsXNetData( 'mprage_hippmapp3r' ) )
dkt <- desikanKillianyTourvilleLabeling( t1, doLobarParcellation = TRUE, verbose = TRUE )

I may need more personalized requirements, such as using an atlas specific to animals and converting the final results into a data format."

thanks

ntustison commented 4 days ago

You're not going to be able to use the ANTsRNet stuff as it was trained on human data.

JinDJsuper commented 4 days ago

You're not going to be able to use the ANTsRNet stuff as it was trained on human data.

Thank you for the response; I understand now. Is it still reliable if I use the commands from the later part of ANTsXNet cortical thickness with my own provided cortex and atlas to calculate cortical thickness? Does this also require training data to be suitable?

>>> import ants
>>> kk = ants.image_read('db68_CorticalThickness_2sub.nii.gz')  # ct_image
>>> dkt = ants.image_read('cornatlas.nii')  # atlas_image
>>> dkt_cortical_mask = ants.threshold_image(dkt,1,234,1,0)  # total  234 brain area
>>> dkt = dkt_cortical_mask * dkt
>>> kk_mask = ants.threshold_image(kk, 0, 0, 0, 1)
>>> dkt_propagated = ants.iMath(kk_mask, "PropagateLabelsThroughMask", kk_mask * dkt)
>>> kk_regional_stats = ants.label_stats(kk, dkt_propagated)
>>> print(kk_regional_stats)
with open('kk_regional_stats.txt', 'w') as f:
...     f.write(str(kk_regional_stats))

thanks for your reply