“I had some horrible experiences,” he said.

During one procedure, when Mr. Oberman had his shirt off, a male technician, seeing that he was transgender, exclaimed: “Why would you do this to yourself? It’s disgusting.”

Mr. Oberman never reported the episodes.

“I’m not proud to say I didn’t complain,” he said, adding that he wished he had done so for the sake of other patients.

But he was facing a life-threatening disease. The cancer was aggressive. He would need both breasts removed, and then chemotherapy.

“I felt guilty, able to get free surgery I didn’t want because I had cancer, and so many others want it and can’t get it,” he said.

He soon learned that mastectomies, which remove as much breast tissue as possible, differ from top surgery, which preserves enough to give the chest a male-looking contour. Because he had cancer, top surgery was not a safe option: It would leave too much breast tissue, and too much risk of recurrence. Friends who have had top surgery were stunned to find out they still had a risk of breast cancer because of the tissue left behind, he said.

Before surgery, thinking that testosterone might interfere with healing, Mr. Oberman’s doctors advised him to stop taking it for a month.

He followed their advice, but soon, he said, “I went insane. I wasn’t rational. I was lying on the floor, crying.”