Why don't you make it explicit what visits (and by extension, images) belongs to which visit group?
Patients -- > Visits --> Images, with a visitGroup FK (or just a visitGroup text field) to distinguish the visits.
If you add a VisitGroups table and a PatientInVisitgroup join table, you could also use a script to create three entries for a new patient; then use these records as a guide/template to create new visits and have them automatically tagged/IDd with the correct group, see the respective image count on the fly, and e.g. mark a visit group as concluded.
I added the visit group text field to distinguish the visits and it worked.
Thank you very much for your repsonse and it is very helpful!