PennLINC / ConFixel

Companion converter software for ModelArray for converting data back and forth from the HDF5 file format.
BSD 3-Clause "New" or "Revised" License
0 stars 2 forks source link

Masks for fixel-based analysis #34

Open araikes opened 1 year ago

araikes commented 1 year ago

Hi,

Thanks for this great tool. I have a question: Is it possible to give confixel/modelarray a mask to restrict fixel-based analyses? I'd like restrict the analysis to e.g. fixels with 250 fibers or more. I can generate the mask just fine and have used it for fixelcfestats but don't have a way to pass to your functions.

Thanks

zhao-cy commented 1 year ago

Hi!

Thank you very much for using ModelArray/ConFixel! I think a way to do so is to get the indices of the fixels of interest and pass the list into element.subset argument when using ModelArray.lm() or ModelArray.gam().

Getting the indices list is a bit tricky - please make sure you save the list as a fixel file and view it, before using the list for statistical analysis. We do have example code to do so, which we used for Figure 5B in our ModelArray paper. The code aimed to get the indices of significant fixels within a voxel ROI mask, and then do further statistical analysis on those fixels.

The instructions and code are available in our ModelArray_paper github repo. You can find the instructions on how to achieve this in the description in this html built from an Rmd. The Rmd is here. The python script is here. To get the desired fixel list, we 1) first got the fixel’s indices that included in manually drawn voxel-wise mask; we then got 2) indices of all significant fixels. We then took the intersect of list 1 and list 2.

The tricky thing is that the list of indices (list 1 and/or list 2) might got "flipped" - somehow we need to map the first index to the last index in the list, and so forth. Without additional flipping, the fixels look "randomly" distributed in the brain. Therefore, it is very important to save the list of interest you got as a .mif file and view it in MRview. We've covered this step in the instruction.

Finally, you need to add 1 to the list you got (e.g., the variable fixel_id_list_intersect in Rmd), before sending the list to element.subset of ModelArray functions. This is because the in fixel_id_list_intersect, fixel ids start from 0, whereas in element.subset fixel ids start from 1.

If you have trouble getting the list of fixels you want or you have further questions, please let us know.

Thank you, Chenying

araikes commented 1 year ago

@zhao-cy, Thanks for the quick reply. That's terrific. I'll give it a look and see.

For me, I think it may be a bit simpler, because I'm already using a fixel-based file as the mask (thresholded TDI image, see instructions here: https://community.mrtrix.org/t/tractography-constrained-fixel-based-analysis/2750/2).

Do you know, can I do all of what's described in the Rmd file with the current version of the Docker/Singularity image (v 0.1.3) or would I need an updated version based the current version of the GitHub repo?

zhao-cy commented 1 year ago

Hi @araikes !

Ah that will make things a lot simpler! So you probably don't need our code anymore. You can use MRtrix function fixelcrop (see its manual here) to apply your fixel-based mask onto your participants' fixel images. Now you should get a list of fixel images that only include the fixels you want to analyze. Then provide these images into ConFixel and ModelArray.

Let me know if it sounds clear to you/if you have any questions. Thanks, Chenying

zhao-cy commented 1 year ago

Hi @araikes ! Do you have further questions on this issue? If not, I will close this it.