Inside the display_gallery function in pp-inc.php are the three queries performed which grab images to display. In the WHERE clause for these, you would add your own custom query like:
WHERE cat IN (505,510,512)
which would modify the query to grab images from only those categories.
Please do not PM me for support or sales questions. Thank you for your understanding.