List all projects in group


I’d like to get a list of all projects in a group in a Fiji script (jython).

After establish the gateway the groups the user is a member is listed and the sector context is set to one of those

groups = user.getGroups()
group = group[ichoice]      # select a group to list 
ctx = SecurityContext( group.getId() )

After this the browseFacilty is used to list the projects:

from omero.gateway.facility import BrowseFacility
browse = gateway.getFacility(BrowseFacility)

users_projects = browse.getProjects(ctx)               # just the logged in users projects
u308_projects  = browse.getProjects(ctx, Long(308))    # just userID=308 projects

It seems the way to get the list all projects is the iterate over the user Ids. However I can’t seem to get information of the members of the group. The GroupData returns None for the experimenter information

group.getExperiments() # = None
groupgetMembersOnly()  # = None

Is there another way to list all projects in a group or is there something I need to do with the SecutoryContext inorder to list group members?



Hi Chris,

yes, you’d have to iterate over all users. Unfortunately the list returned from user.getGroups() is shallow and only contains the groups the user is a member of, but lacks the information about the members of these groups. But you can load a fully initialized list of groups via the BrowseFacility too: If you replace the line groups = user.getGroups() with groups = browse.getAvailableGroups(ctx, user) then you’ll be able to iterate over the group members with group.getExperimenters().


Hi Dominik,

thanks for the info - was beginning to think the Java collection was not getting transferred to python or something.

I found a way to get the projects, do you think this is a legitimate use of the API or some weird corner case?

from omero.sys import ParametersI
params = ParametersI()
projects = browse.getHierarchy( ctx, ProjectData, [], params )	



You are right, I forgot about the ‘getHierarchy’ method, sorry. It’s absolutely ok to use it. In fact that’s actually the recommended way to do it, because it will properly load/initialize the child objects (Datasets, etc.) too.
Kind Regards,

1 Like