AFQ.tasks.structural#

Attributes#

Functions#

configure_ncpus_nthreads([numba_n_threads, low_memory])

Configure the number of threads to use for Numba,

onnx_kwargs(low_mem[, onnx_execution_provider, ...])

The execution provider to use for onnx models

synthseg_model(t1_masked, citations, onnx_kwargs)

full path to the synthseg2 model segmentations

mx_model(t1_file, t1w_brain_mask, citations, onnx_kwargs)

full path to the multi-axial model for brain extraction

t1w_brain_mask(t1_file, citations, onnx_kwargs[, ...])

full path to a nifti file containing brain mask from T1w image

t1_masked(t1_file, t1w_brain_mask)

full path to a nifti file containing the T1w masked

t1_subcortex(t1_masked, citations, onnx_kwargs)

full path to a nifti file containing segmentation of

get_structural_plan(kwargs)

Module Contents#

AFQ.tasks.structural.logger[source]#
AFQ.tasks.structural.configure_ncpus_nthreads(numba_n_threads=None, low_memory=False)[source]#

Configure the number of threads to use for Numba, and whether to use low-memory versions of algorithms where available

Parameters:
numba_n_threadsint, optional

The number of threads to use for Numba and DIPY tracking. If None, uses the number of available CPUs minus one. Default: None

low_memorybool, optional

Whether to use low-memory versions of algorithms where available. Default: False

AFQ.tasks.structural.onnx_kwargs(low_mem, onnx_execution_provider='CPUExecutionProvider', onnx_inter_threads=1)[source]#

The execution provider to use for onnx models

Parameters:
onnx_execution_providerstr, optional

The execution provider to use for onnx models. By default this is set to CPUExecutionProvider which should work on all systems. If you have a compatible GPU and the appropriate onnxruntime installed you can set this to “CUDAExecutionProvider” or “OpenVINOExecutionProvider” for potentially faster inference. Default: “CPUExecutionProvider”

onnx_inter_threadsint, optional

The number of inter threads to use for onnx models. Increasing will increase memory usage significantly. Default: 1

AFQ.tasks.structural.synthseg_model(t1_masked, citations, onnx_kwargs)[source]#

full path to the synthseg2 model segmentations

References

[1] Billot, Benjamin, et al. “Robust machine learning segmentation

for large-scale analysis of heterogeneous clinical brain MRI datasets.” Proceedings of the National Academy of Sciences 120.9 (2023): e2216399120.

[2] Billot, Benjamin, et al. “SynthSeg: Segmentation of brain MRI scans

of any contrast and resolution without retraining.” Medical image analysis 86 (2023): 102789.

AFQ.tasks.structural.mx_model(t1_file, t1w_brain_mask, citations, onnx_kwargs)[source]#

full path to the multi-axial model for brain extraction outputs

References

[1] Birnbaum, Andrew M., et al. “Full-head segmentation of MRI

with abnormal brain anatomy: model and data release.” Journal of Medical Imaging 12.5 (2025): 054001-054001.

AFQ.tasks.structural.t1w_brain_mask(t1_file, citations, onnx_kwargs, brain_mask_definition=None)[source]#

full path to a nifti file containing brain mask from T1w image

Parameters:
brain_mask_definitioninstance from AFQ.definitions.image, optional

This will be used to create the brain mask, which gets applied before registration to a template. If you want no brain mask to be applied, use FullImage. If None, use Brainchop Mindgrab model. Default: None

References

[1] Masoud, M., Hu, F., & Plis, S. (2023). Brainchop: In-browser MRI

volumetric segmentation and rendering. Journal of Open Source Software, 8(83), 5098. https://doi.org/10.21105/joss.05098

AFQ.tasks.structural.t1_masked(t1_file, t1w_brain_mask)[source]#

full path to a nifti file containing the T1w masked

AFQ.tasks.structural.t1_subcortex(t1_masked, citations, onnx_kwargs)[source]#

full path to a nifti file containing segmentation of subcortical structures from T1w image using Brainchop

References

[1] Masoud, M., Hu, F., & Plis, S. (2023). Brainchop: In-browser MRI

volumetric segmentation and rendering. Journal of Open Source Software, 8(83), 5098. https://doi.org/10.21105/joss.05098

AFQ.tasks.structural.get_structural_plan(kwargs)[source]#