示例#1
0
 def __init__(self, src: Union[str, PathLike], **kwargs):
     super().__init__(_BIDSPathBase(src), **kwargs)
     nifti_img, sidecar = (nib.load(self), _fetch_sidecar(self)) \
         if IsNifti(self) else ('', '')
     suffix, extension = _find_suffix(self), _find_extension(self)
     self.__set_from_dict__(
         dict(parent=__dispatch__(dirname(self)),
              parents=__parents__(src),
              nifti_img=nifti_img,
              suffix=suffix,
              extension=extension,
              sidecar=sidecar))
示例#2
0
 def __init__(self, src: Union[str, PathLike], **kwargs):
     try:
         assert src in map(str, self.contents)
     except AssertionError:
         pass
     super().__init__(_BIDSPath(src), **kwargs)
     nifti_img = nib.load(
         self) if IsNifti(self) and self in self.contents else ''
     sidecar = '' if not self.exists() else _fetch_sidecar(self)
     suffix, extension = _find_suffix(self), _find_extension(self)
     self.__set_from_dict__(
         dict(nifti_img=nifti_img,
              suffix=suffix,
              extension=extension,
              sidecar=sidecar))
def is_anat_vfa_mt(src) -> bool:
    return all((is_anat(src), _find_suffix(src) in ('MPM', 'MTS')))
def is_anat_multi_inv(src) -> bool:
    return all((is_anat(src), _find_suffix(src) == 'IRT1'))
def is_anat_multi_flip(src) -> bool:
    return all((is_anat(src), _find_suffix(src) == 'VFA'))
def is_anat_multi_echo(src) -> bool:
    return all((is_anat(src), _find_suffix(src) in ('MESE', 'MEGRE')))
def is_anat_mtr(src) -> bool:
    return all((is_anat(src), _find_suffix(src) == 'MTR'))
def is_anat_mp2rage(src) -> bool:
    return all((is_anat(src), _find_suffix(src) == 'MP2RAGE'))
def is_anat_defacemask(src) -> bool:
    return all((is_anat(src), _find_suffix(src) == 'defacemask'))
def is_anat_nonparametric(src) -> bool:
    return all((is_anat(src), _find_suffix(src)
                in NONPARAMETRIC_ANAT_SUFFIXES))