It seems to me that a rapist has at least one distinguishing feature that can be psychologically tested, a lack of empathy. If you simply classify a lack of empathy a dangerous sociopathic mental illness that requires quarantine, then the rapist can be legally confined until he is not a risk to the public.
Find the cure for Fundementia!