More than 80% of adult male prisoners in Scotland have a history of significant head injury, a study has found