kwneuro.masks module

kwneuro.masks.brain_extract_batch(cases)

Run brain extraction on a batch of cases. HD-BET does not run in parallel, but it does have some initialization time so it helps to run cases in batches.

Parameters:

cases (list[tuple[Dwi, Path]]) – A list of pairs each consisting of an input Dwi and desired output path for the mask.

Return type:

list[NiftiVolumeResource]

Returns a list of computed brain masks that is in correspondence with the list of input cases.

kwneuro.masks.brain_extract_single(dwi, output_path)

Run brain extraction on a single case.

HD-BET has significant initialization time, so it is not advised to run this function in a loop; see brain_extract_batch.

Parameters:
  • dwi (Dwi) – Input DWI

  • output_path (Path | str) – Output path for brain mask

Return type:

NiftiVolumeResource

Returns the computed brain mask.