When does a person stop being a person?

Working in pathology, I see human remains daily, but it still makes me wonder at what point does a corpse transition from being a “person” to just an object? Is it when the brain stops functioning, or is there more to it? Curious what others think, especially fellow sci-fi fans who’ve probably debated this in some futuristic context!