[docs]classPediatric(SubjectMNI):"""MNI pediatric atlases. See `the MNI website <http://nist.mni.mcgill.ca/pediatric-atlases-4-5-18-5y/>`_ for more information. .. image:: http://nist.mni.mcgill.ca/wp-content/uploads/2016/04/nihpd_asym_all_sm.jpg :alt: Pediatric MNI template Arguments: years: Tuple of 2 ages. Possible values are: ``(4.5, 18.5)``, ``(4.5, 8.5)``, ``(7, 11)``, ``(7.5, 13.5)``, ``(10, 14)`` and ``(13, 18.5)``. symmetric: If ``True``, the left-right symmetric templates will be used. Else, the asymmetric (natural) templates will be used. """# noqa: B950def__init__(self,years,symmetric=False):self.url_dir='http://www.bic.mni.mcgill.ca/~vfonov/nihpd/obj1/'sym_string='sym'ifsymmetricelse'asym'ifnotisinstance(years,tuple)oryearsnotinSUPPORTED_YEARS:message=f'Years must be a tuple in {SUPPORTED_YEARS}'raiseValueError(message)a,b=yearsself.file_id=f'{sym_string}_{format_age(a)}-{format_age(b)}'self.name=f'nihpd_{self.file_id}_nifti'self.filename=f'{self.name}.zip'self.url=urllib.parse.urljoin(self.url_dir,self.filename)ifnotself.download_root.is_dir():download_and_extract_archive(self.url,download_root=self.download_root,filename=self.filename,)(self.download_root/self.filename).unlink()forpathinself.download_root.glob('*.nii'):compress(path)path.unlink()try:subject_dict=self.get_subject_dict('.nii.gz')exceptFileNotFoundError:# for backward compatibilitysubject_dict=self.get_subject_dict('.nii')super().__init__(subject_dict)defget_subject_dict(self,extension):root=self.download_rootsubject_dict={'t1':ScalarImage(root/f'nihpd_{self.file_id}_t1w{extension}'),'t2':ScalarImage(root/f'nihpd_{self.file_id}_t2w{extension}'),'pd':ScalarImage(root/f'nihpd_{self.file_id}_pdw{extension}'),'mask':LabelMap(root/f'nihpd_{self.file_id}_mask{extension}'),}returnsubject_dict