-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extraction of metrics in all tracts #10
Comments
Yes, we can certainly to that. I will implement it after we merge #8 |
Can we update the script to extract the metrics in all tracts ? |
sure-- i'll try my best to do it today |
how do you want the results? aggregated into a single CSV file, or one CSV file per tract? |
Thank you!
A csv file per tract would be more convenient
…________________________________
From: Julien Cohen-Adad ***@***.***>
Sent: May 1, 2024 08:40
To: sct-pipeline/spine-park ***@***.***>
Cc: Lydia Chougar, Dr ***@***.***>; Author ***@***.***>
Subject: Re: [sct-pipeline/spine-park] Extraction of metrics in all tracts (Issue #10)
how do you want the results? aggregated into a single CSV file, or one CSV file per tract?
—
Reply to this email directly, view it on GitHub<#10 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BFCFJYUBF27CZEGW7CD2ORDZADPETAVCNFSM6AAAAABEAH4QY6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBYGQYDSMRUGU>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Another consideration: some tracts are veeeeeery small (ie: less than a mm2 per axial slice). When considering tracts in isolation, metrics will be more prone to noise, hence if there is a pathology-related effect, it would possibly be non-statistically significant. Whereas when aggregating across tracts, the sensitivity to detect changes statistically will be higher. So my recommendation would be to aggregate tracts instead of studying them in isolation. Aggregation should follow hypotheses in terms of the tracts that are expected to be affected (eg: all descending tracts?) |
could you suggest which tracts to aggregate from the |
The region that I'm interested (intermedio-lateral columns) should be located in these GM areas (~16 voxels in the axial plane for each side): WE can can also look at the GM globally These could be "control regions": 30, GM left ventral horn, PAM50_atlas_30.nii.gz 34, GM left dorsal horn, PAM50_atlas_34.nii.gz If not too small |
ok great, this is very helpful. Just to clarify, the regions you listed per paragraph (eg: [32, 33] vs. [32], [33]): are you suggesting to merge them? (again, the pros in merging is the better robustness to noise) |
I think we can merge right and left (eg: 32 and 33) |
Good, so I'll produce the following extraction strategies (one extraction per bullet point):
|
we can merge 54 and 55, but I would keep 53 separately unless you think it's too small |
I'm also thinking it could be interesting to merge all ascending vs descending tracts |
could you please list the numbers to be included for the ascending vs. descending? that would save me some time 😊 |
descending: 4 5 8 9 10 11 16 17 18 19 20 21 22 23 24 25 26 27 ascending: 0 1 2 3 6 7 12 13 14 15 |
Thanks Julien! |
Great, here is the updated list:
|
Thank you! |
@Kaonashi22 can you give it a try with 9ad4422 ? |
Using the last version 9ad4422 ?, here is the output I got The columns voxels, map and std are empty... |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Just to summarize the 2 different issues:
Since this issue has been fixed, I will minimize some of the "Resolved" comments on this issue so that it is a little easier to navigate. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Ahhh, that is quite strange! It looks like for some reason, the column titles are shifted? |
Right, the display is correct after changing the separator when opening the csv file, thank you!! |
Perfect! I think we can close this issue, then? (Since @jcohenadad previously closed this issue in 9ad4422.) |
A few more questions/comments before you close the issue! -for some levels, values are equal to zero, but the maps look fine |
Yes, exactly. I imagine that this is because of parallel processing + using
Ahh, this is very strange. These seem like bugs to me?
This seems related to the problem above (vertlevels at the start and vertlevels at the interface between the chunks). I have a feeling if we solve the erroneous table entries, then the zero values will go away too. |
slice « 2 » is not located at the same physical location (ie absolute scanner coordinates) across chunks |
Is there a way to know the corresponding vertebral level for each chunk except looking at the images? |
There are different ways to do that, depending on how you are going to use the information, some programatical ways are more optimal than others. To give you an example, here is a syntax: for chunk in 1 2 3 ; do sct_extract_metric -i sub-BB277_chunk-${chunk}_DWI_moco_FA.nii.gz -l 51 -f label_sub-BB277_chunk-${chunk}_DWI_moco/atlas/ -vert 1:12 -perlevel 1 -vertfile label_sub-BB277_chunk-${chunk}_DWI_moco/template/PAM50_levels.nii.gz -o levels.csv -append 1 ; done That generates this output file: levels.csv, which lists what levels are present in a chunk, and what are the corresponding slices for each level. |
I see on the csv file that some vertebral levels are still extracted from different chunks: for example level 10 from chunks 1 and 3; chunk 1 doesn't cover this level (upper part of the cord) |
can you please share the CSV file and the data so I can reproduce/understand |
This is the csv file that you shared here:
|
I overlaid the chunks on the T2w image, and noticed that chunk 1 is not the top chunk but the middle one, which explains the overlap of vertebral levels in the CSV file (chunk number is in white): The reason is because I was working on a dataset that was created before I fixed #16. If you run this in the latest version of the code if should work fine. |
Got it, thank you! |
Implemented in ad7a4ba. I haven't run the code so please run in one subject to make sure there is no bug |
The code exited with this error: FileNotFoundError: [Errno 2] No such file or directory: '/dagher/dagher11/lydia11/SPINE_park/Test_1505/data_processed/sub-AM267/dwi/sub-AM267_chunk-1_DWI_moco/template/PAM50_levels.nii.gz' I think the actual name of the folder it's looking for is label_sub-AM267_chunk-1_DWI_moco |
Sorry about that-- it is now fixed in ecd02d1. I tested the code and it runs on my end. |
Thank you! I'm testing the new version |
Using the last version of the script, I got these results. There is a level 2 for the three chunks, but only chunk 1 has values as expected (zero for chunks 2 and 3). Is there a reason? |
Discussion opened here: #14 |
…CSV file (#4487) ## Description For data where an image is [split into multiple chunks](sct-pipeline/spine-park#10 (comment)), you may want to call the same `sct_extract_metric` command on multiple chunks spanning a range of vertlevels (e.g. `-vert 1:12`). But, not all chunks will contain all of the specified levels. For this case, there is a bug where an `agg_metric` entry will be created for the slicegroup "`()`", i.e. a group containing no slices. This will result in an empty row containing no data. This PR adds a test that reproduces the condition and fails. As soon as the empty slicegroup row is removed, the test will pass. ## Linked issues Fixes sct-pipeline/spine-park#35. --------- Co-authored-by: Mathieu Guay-Paquet <[email protected]>
Can we add a loop to extract metrics (MT, T1, diffusion) in all regions and tracts in the "info_label.txt" file?
The text was updated successfully, but these errors were encountered: