Accessing groups data in custom registration page/template

Hello,

Is there a way to access user groups data in the registration page? I want to create a selection field based on the groups data for the registration page with all the custom attribute fields I’ve added.