Hi Will,
I checked my error file and the error I saw was just a debug output from the API. The method did return None. My code then failed on the None object.
I have switched to using getParent() and that returns a dataset I can use.
Now I have an issue when I have created an image in the dataset and I would like to update the logical channels on the new image. I am setting the emission wavelengths and names so that they match the old image.
- Code: Select all
if newImg._prepareRenderingEngine():
renderingEngine = newImg._re
pixels = renderingEngine.getPixels()
for i, c in enumerate(pixels.iterateChannels()):
lc = c.getLogicalChannel()
lc.setEmissionWave(rint( ... ))
lc.setExcitationWave(rint( ... ))
lc.setName(rstring( ... ))
updateService.saveObject(lc)
This throws an error on getLogicalChannel() if the Blitz connection context is in a different group from the one that contained the original image.
The scenario is that the user is a member of many groups. An image from the non-default group is selected for processing. At the end of processing a script connects to OMERO using the python API, identifies the parent dataset from the image ID and creates the new image in the same dataset. However since the dataset is not in the same group as the default group I get an ome.conditions.SecurityViolation when trying to set properties on the logical channels. If I set the Blitz connection group to the correct group then it all works fine:
- Code: Select all
# Default group = 'Group1'
# Original image in a dataset in 'Group2'
conn = BlitzGateway( ... )
# Create image in original Dataset = Group2
# conn.getGroupFromContext().getName() != [group name of new image]
# When setting logical channels => Error
conn = BlitzGateway( ... )
conn.setGroupNameForSession('Group2')
# Create image in original Dataset = Group2
# When setting logical channels => All OK
Is there a method to find out the group name for an image? I believe that in the current OMERO an image can still only be a member of one group so this should be a single group ID.
Alex