Hi AFNI gurus,
I am having some questions with the outputs of @SSwarper. I am reanalyzing some older data with manually drawn masks. I figured I can refine the manual segmentation running @SSwarper with the -mask_ss and -init_skullstr_off options. In the QC_anatSS.subject.jpg image how closely should the overlay fill and follow the brain? The warped images seem to look good but seeing this makes me wonder a bit. Any help would be greatly appreciated.
Most people use the T1w (and @SSwarper) for alignment to the EPI, to be able to identity parts there anatomically (e.g., using FreeSurfer parcellation), as well as for being an intermediate helper to align the EPI to a standard space template (for both group analysis and another set of identifications, with atlases). The “skullstripping” part helps these procedures, but the main goal is to have good alignment. The EPI is typically a much coarser spatial resolution than the T1w volume, too.
Having a bit of brainmask being plus/minus on the edge of a T1w volume is probably expected—no alignment is perfect. However, this looks like fine parts of just the outer edge—I suspect that the alignment that warps the anatomical to standard space is really quite good overall, esp. when we consider the coarser EPI that we really care about landing in standard space (again, typically). I think the EPI will still end up basically where it should go, to a high degree. Note also with alignment that every brain is quirky—some regions are known to have different numbers of sulci and gyri across a population—so there will always be some “misalignment” between a subject and a template.
So, how good is “good enough” skullstripping depends on what you want to do with it. If it needs to be really perfect for some reason, we can try modifying SSwarper parameters, but I suspect there will always be some variation around the borders. Again, this level of detail missing in a small region makes me think that things would be good overall for EPI analysis. If you are doing something else with this data, then that might be different.
Thanks for the response and the insight. I’ll start a few more runs of @SSwarper on a subset of images, playing with the parameters, to see If I can better the default output.
I did have a follow up question, I do believe that the attached image shouldn’t pass QC. I have been fiddling around with the blur options, but not having any luck on this subject. Are there options to relax the stripping when a mask is used and -init_skullstr_off used?
What is the @SSwarper command you are using here? It sounds like you already have a manually-masked dataset, so you just need to create a nonlinear warp?
I suppose you are right and it just might be me being too strict about the dura. My hope was that running @SSwarper would better refine the old masked image. If I am being too strict then yes I would only need the nonlinear warp to the template.
@SSwarper -input sub-002_ses-2_brain.nii.gz -base MNI152_2009_template_SSW.nii.gz -mask_ss sub-002_ses-2_mask.nii.gz -subid sub-002_ses-2 -odir ./templatewarp -init_skullstr_off
Dura is a pain. If I had my way, no human brain would have any. Well, OK, that might have health consequences, so maybe not that—back to the drawing board…
If the goal of this is alignment of EPIs, which typically have much lower resolution, this level of mis-detail seems like it should be OK. The actual, individual human brain can be squished and squashed a bit differently than templates (often an amalgamation of subjects) assume or allow. It makes it tricky to get every part of the brain 100% right when adjusting parameters (i.e., getting these parts pulled a bit more tightly over the template might produce a problem somewhere else).
But, that being said, if you have some extra+unwanted free time, then these are a couple of things I could think of to try by adding options to your @SSwarper call (though, again, they really might not be necessary):
- adjust the final round’s cost function to LPA (default is PCL):
- try running the NL alignment to a higher level of refinement:
This sets the “-minpatch …” value for 3dQwarp (which is the actual program called under the hood by @SSwarper). The default is ‘11’, which sets the size scale of the final patch refinement. Setting it to, say, 8 or 9 might produce a bit of change. The minimal value is 5. NB: lowering this value will slooooooooow the program down.
Of the 2 options above, I would try the first one (-cost_nl_final lpa) first. That might increase processing time a wee bit, but probably not meaningfully. Asking for much more detailed patch refinement will noticeably extend processing time.
As with all nonlinear alignment program usage in AFNI, I hope you are leveraging any multiple CPU usage (because they are inherently parallelized with OpenMP):
afni_system_check.py -check_all | grep "number of CPUs:"
… and check how many AFNI will use at that moment:
Thanks so much, I am amazed by how well @SSwarper works for most of my images. For the small subset of images that don’t pass QC I just wanted to confirm that my plan of action would be acceptable by you guys.
Since the refined anatSS image is pretty good even when it cuts out some bits, I could make the minor edits to the mask from that image and create an new skull stripped image I can then pass into proc.py
It is fine to refine the skullstripping and make a new “anatSS_tweaked” volume, and use that for “-anat_cp …”. That volume will be used for affine EPI-anatomical registration. Since the tweaks to the masking are mainly to be made in a couple small places at the edges, I don’t think there will be a big differences between using anatSS or anatSS_tweaked there. And the warping itself will be done by the anatQQ*WARP file, so that will be unchanged by this; note also the warp fields are diffeomorphic, meaning invertible, and hence quite smooth—so given that the level of skullstripping from the warp is just slightly off at a couple small places at the edge, I doubt using the refined anatSS_tweaked to generate a new nonlinear warp would matter that much anyways, esp. over the distance scales of EPI voxels (2-3 or more mm).
So, I guess in the end your plan of action sounds fine, but just a lot of work for something that I am not sure will have much benefit, given the fine level of detail to be tweaked.
I guess I would try using the “-cost_nl_final lpa” in re-running the SSwarper first, and see if that does anything—that might take time, but it is computer time (not human time) and would adjust both the anatSS and anatQQ* simultaneously (but again, probably just to very small degree, in the end).