Fix ccppcheck performance warnings for the BRAINSStandAlone

Please review and merge.