Example #1
0
    def _addImage(self,
                  img: nib.Nifti1Image,
                  path: str,
                  updateLayout: bool = True) -> None:
        """
        Replace the image in the dataset at the provided path, creating the path
        if it does not exist.

        Args:
            img: The image to add to the archive
            path: Relative path in archive at which to add image
            updateLayout: Update the underlying layout object upon conclusion of
                the image addition.
        """
        bids_write_to_file(path,
                           img.to_bytes(),
                           content_mode='binary',
                           root=self.rootPath,
                           conflicts='overwrite')

        if updateLayout:
            self._updateLayout()