| 12345678910111213141516 |
- # /// script
- # requires-python = ">=3.11"
- # dependencies = [
- # "antspyx==0.6.1",
- # ]
- # ///
- import ants
- image_ants = ants.image_read("Rat1_sub-01_T2w.nii.gz")
- image_n4 = ants.n4_bias_field_correction(image_ants)
- bias_field = ants.n4_bias_field_correction(image_ants, return_bias_field=True)
- ants.image_write(image_n4, "Rat1_sub-01_T2w_corrected.nii.gz")
- ants.image_write(bias_field, "Rat1_sub-01_T2w_bias-field.nii.gz")
|