Question came up on Neurostars about detecting already defaced images: https://neurostars.org/t/is-it-an-issue-to-run-pydeface-twice/16866
The general problem is difficult, but we could make people's lives easier by marking images as defaced in the descrip header field (at least for NIfTI images):
defaced = nb.load(..., mmap=False)
descrip = f"pydeface {__version__}".encode()
if defaced.header["descrip"]:
descrip += b"; " + defaced.header["descrip"]
defaced.header[descrip] = descrip[:80]
defaced.to_filename(...)
Question came up on Neurostars about detecting already defaced images: https://neurostars.org/t/is-it-an-issue-to-run-pydeface-twice/16866
The general problem is difficult, but we could make people's lives easier by marking images as defaced in the
descripheader field (at least for NIfTI images):