This is a very interesting question.

Many philosophies in the world state that all living beings, especially Humans, have souls that contain their bodies' personalities, memories, thought processes, etc. At the same time, however, even the tiniest of alterations in people's brains can dramatically alter who they are. A single gene can control what sex they prefer to mate with or what profession they would like to choose when they are older, and the wrong hormone balance in the mother's womb could cause the baby to be physically born of one gender, but grow up to mentally believe they are another.
Would this mean that our brains are physical manifestations of our own souls, and that cutting off or changing certain pieces of it would be like cutting off one of our bodies' limbs, or transforming them to things totally different? Or, alternatively, would it mean that our brain is akin to a translation point, where signals between the mind, body, and soul can be corrupted, and the wrong "words" so to speak can be sent and received? If the latter, what kind of a translation problem could be present? Is it the
soul believing it's the physical gender, with the brain mistranslating it to the
mind as the opposite gender? Or is everything here caused by something completely different? There are so many countless possibilities, that trying to comprehend all of them with our current level of knowledge is like attempting to visualize the true face of the Divine. We can only make guesses, and with each guess try to make sense out of it and prove it is true.
In the end...this is probably something better left to a more transhumanist age, where our physical bodies can be as easily altered as any of our desktop computers. In that kind of a time period, we would probably have a good grasp on what really makes up the Human consciousness. At the moment, though, we only have ourselves and our own little quests to complete, before we can truly know which of these is the right answer.