For compatibility with nibabel, switch from LPS to RAS. Adapt affine matrix and `space` argument in header accordingly. If no information of space is given in the header, LPS is assumed and thus converted to RAS. If information about space is given, but is not LPS, t
(self, header: dict)
| 1579 | return affine |
| 1580 | |
| 1581 | def _switch_lps_ras(self, header: dict) -> dict: |
| 1582 | """ |
| 1583 | For compatibility with nibabel, switch from LPS to RAS. Adapt affine matrix and |
| 1584 | `space` argument in header accordingly. If no information of space is given in the header, |
| 1585 | LPS is assumed and thus converted to RAS. If information about space is given, |
| 1586 | but is not LPS, the unchanged header is returned. |
| 1587 | |
| 1588 | Args: |
| 1589 | header: The image metadata as dict |
| 1590 | |
| 1591 | """ |
| 1592 | if "space" not in header or header["space"] == "left-posterior-superior": |
| 1593 | header[MetaKeys.ORIGINAL_AFFINE] = orientation_ras_lps(header[MetaKeys.ORIGINAL_AFFINE]) |
| 1594 | header[MetaKeys.SPACE] = SpaceKeys.RAS |
| 1595 | return header |
| 1596 | |
| 1597 | def _convert_f_to_c_order(self, header: dict) -> dict: |
| 1598 | """ |
no test coverage detected