Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared rendering settings #2365

Merged
merged 55 commits into from May 19, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
0d47d65
Add failing test for #12145 rendering settings
joshmoore Apr 25, 2014
3d0319b
Modify all queries to try pixel.owner.id when empty
joshmoore Apr 25, 2014
748bf1b
Same type of quick fix for rendering
joshmoore Apr 25, 2014
713b01e
Add new API method: saveAsNewSettings
joshmoore Apr 28, 2014
128fb71
Implement saveAsNewSettings with internalSave()
joshmoore Apr 28, 2014
82a1b89
Add check for ownership on saveCurrentSettings
joshmoore Apr 28, 2014
1a4fc8f
Generate thumbnails during saveAs
joshmoore Apr 29, 2014
d1d1d14
Fix ThumbnailStore.thumbnailExists
joshmoore Apr 29, 2014
fffc062
Fix stackoverflow on loadAndPrepareMetadata
joshmoore Apr 30, 2014
02ad6fe
Review save settings method.
jburel Apr 29, 2014
dc4919e
Specify original object
jburel Apr 30, 2014
1e5c387
Generate thumbnail for user w/o thumbnail and w/ settings.
jburel Apr 30, 2014
4263f31
Check that settings owner equals session owner.
jburel May 1, 2014
2c5bed2
Create a new thumbnail if none associated to rnd settings.
jburel May 1, 2014
72b24c2
Re-load rendering engine after save as.
jburel May 1, 2014
60a6112
Return a copy of the settings to viewer.
jburel May 1, 2014
f0a8e6a
Reload settings.
jburel May 1, 2014
a9d7aae
Updated header.
jburel May 1, 2014
1eb2531
Blitz re.saveDefaults() saveAs if rdef not owned. See PR2365
will-moore May 1, 2014
8b26dee
Merge pull request #24 from jburel/12145-rnd-settings
joshmoore May 1, 2014
2f6d2a4
Merge pull request #25 from will-moore/12145-rnd-settings
joshmoore May 1, 2014
4e68e08
Modify saveCurrentSettings behavior to create rdefs (See #12145)
joshmoore May 2, 2014
fbb8cf6
Track explicit rdef request in RenderingBean
joshmoore May 4, 2014
01f0c08
Revert "Blitz re.saveDefaults() saveAs if rdef not owned. See PR2365"
joshmoore May 5, 2014
42e732c
Check if user is group owner or admin if Read-Only
jburel May 6, 2014
abf8e3b
Add new method to reset the default and return settings id.
jburel May 6, 2014
f7e3217
Use the new internalReset method.
jburel May 6, 2014
465738e
Fix when ownership is check in reset default.
jburel May 6, 2014
30246ac
Fix failing tests.
jburel May 6, 2014
06fc724
Add test for saveSettings in read-only group.
jburel May 6, 2014
9b6c86b
Handle Operation not supported exception.
jburel May 6, 2014
4c1a333
Add test for read-only
jburel May 6, 2014
9c9f74d
Add test for reset settings.
jburel May 7, 2014
31293c7
Merge pull request #27 from jburel/12145-rnd-settings
joshmoore May 7, 2014
2cda672
Reload Save By each time
jburel May 8, 2014
036a0b3
Allow owner of settings to regenerate thumbnails RO
jburel May 9, 2014
6613b4b
Merge pull request #28 from jburel/12145-rnd-settings
joshmoore May 12, 2014
4340d21
Do not limit to session owner and settings owner.
jburel May 12, 2014
7c70489
Add test to check if thumbnail is created.
jburel May 13, 2014
578463c
Refactor tests.
jburel May 13, 2014
805988a
Check session owner and settings owner for cached thumbnails.
jburel May 13, 2014
f98a34e
Add tests for setRenderingDef.
jburel May 13, 2014
878e70c
Add support for admin.
jburel May 13, 2014
5d18a44
Merge pull request #29 from jburel/12145-rnd-settings
joshmoore May 13, 2014
b03dc75
Modify message to match changes in settings saving workflow.
jburel May 14, 2014
639d170
Fix out of synch thumbnails.
jburel May 14, 2014
67a556f
Fix typo.
jburel May 14, 2014
7edacb4
Merge pull request #30 from jburel/12145-rnd-settings
joshmoore May 14, 2014
02d7b79
Do not specify items if renderer not loaded.
jburel May 14, 2014
a9c266b
Allow admin to view his/her settings
jburel May 14, 2014
0dbcd2d
Merge pull request #32 from jburel/12145-rnd-settings
joshmoore May 14, 2014
93eca23
Do not prepare RE with owner's setting if admin.
jburel May 16, 2014
7676229
Check if the source is visible.
jburel May 16, 2014
174eb3a
Reset rendering settings.
jburel May 17, 2014
a363cd2
Merge pull request #34 from jburel/12145-rnd-settings
joshmoore May 18, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions components/blitz/resources/omero/api/RenderingEngine.ice
Expand Up @@ -68,8 +68,10 @@ module omero {
void updateCodomainMap(omero::romio::CodomainMapContext mapCtx) throws ServerError;
void removeCodomainMap(omero::romio::CodomainMapContext mapCtx) throws ServerError;
void saveCurrentSettings() throws ServerError;
void resetDefaults() throws ServerError;
void resetDefaultsNoSave() throws ServerError;
long saveAsNewSettings() throws ServerError;
["deprecated:resetDefaults() is deprecated"] void resetDefaults() throws ServerError;
["deprecated:resetDefaultsNoSave() is deprecated"] void resetDefaultsNoSave() throws ServerError;
long resetDefaultsSettings(bool save) throws ServerError;
void setCompressionLevel(float percentage) throws ServerError;
float getCompressionLevel() throws ServerError;
bool isPixelsTypeSigned() throws ServerError;
Expand Down
13 changes: 13 additions & 0 deletions components/blitz/src/ome/services/blitz/impl/RenderingEngineI.java
Expand Up @@ -51,6 +51,8 @@
import omero.api.AMD_RenderingEngine_renderProjectedCompressed;
import omero.api.AMD_RenderingEngine_resetDefaults;
import omero.api.AMD_RenderingEngine_resetDefaultsNoSave;
import omero.api.AMD_RenderingEngine_resetDefaultsSettings;
import omero.api.AMD_RenderingEngine_saveAsNewSettings;
import omero.api.AMD_RenderingEngine_saveCurrentSettings;
import omero.api.AMD_RenderingEngine_setActive;
import omero.api.AMD_RenderingEngine_setChannelWindow;
Expand Down Expand Up @@ -376,6 +378,17 @@ public void resetDefaults_async(AMD_RenderingEngine_resetDefaults __cb,
callInvokerOnRawArgs(__cb, __current);
}

public void resetDefaultsSettings_async(AMD_RenderingEngine_resetDefaultsSettings __cb,
boolean save, Current __current) throws ServerError {
callInvokerOnRawArgs(__cb, __current);
}

public void saveAsNewSettings_async(
AMD_RenderingEngine_saveAsNewSettings __cb, Current __current)
throws ServerError {
callInvokerOnRawArgs(__cb, __current);
}

public void saveCurrentSettings_async(
AMD_RenderingEngine_saveCurrentSettings __cb, Current __current)
throws ServerError {
Expand Down
19 changes: 17 additions & 2 deletions components/common/src/omeis/providers/re/RenderingEngine.java
@@ -1,7 +1,7 @@
/*
* omeis.providers.re.RenderingEngine
*
* Copyright 2006 University of Dundee. All rights reserved.
* Copyright 2006-2014 University of Dundee. All rights reserved.
* Use is subject to license terms supplied in LICENSE.txt
*/

Expand Down Expand Up @@ -509,6 +509,12 @@ public void setQuantizationMap(int w, Family family, double coefficient,
/** Saves the current rendering settings in the database. */
public void saveCurrentSettings();

/** Saves the current rendering settings in the database
* <em>as a new {@link RenderingDef} and loads the object
* into the current {@link RenderingEngine}.
*/
public long saveAsNewSettings();

/**
* Resets the default settings i.e. the default values internal to the
* Rendering engine. The settings will be saved.
Expand All @@ -521,7 +527,16 @@ public void setQuantizationMap(int w, Family family, double coefficient,
* be saved.
*/
public void resetDefaultsNoSave();


/**
* Resets the default settings i.e. the default values internal to the
* Rendering engine. The settings will be saved.
*
* @param save Pass <code>true</code> to save the settings,
* <code>false</code> otherwise.
*/
public long resetDefaultsSettings(boolean save);

/**
* Sets the current compression level for the service. (The default is 85%)
*
Expand Down
Expand Up @@ -143,6 +143,13 @@ private void handleException(Throwable e, boolean notify)
UserNotifier un = MetadataViewerAgent.getRegistry().getUserNotifier();
if (e instanceof RenderingServiceException) {
RenderingServiceException ex = (RenderingServiceException) e;
switch (ex.getIndex()) {
case RenderingServiceException.CONNECTION:
return;
case RenderingServiceException.OPERATION_NOT_SUPPORTED:
un.notifyInfo("Image", "Operation not Supported");
return;
}
if (ex.getIndex() == RenderingServiceException.CONNECTION)
return;
}
Expand Down
Expand Up @@ -1074,9 +1074,7 @@ public void loadViewedBy(Component source, Point location)
{
Object ref = model.getRefObject();
if (ref instanceof ImageData || ref instanceof WellSampleData) {
if (model.getViewedBy() != null)
setViewedBy(model.getViewedBy(), source, location);
else model.fireViewedByLoading(source, location);
model.fireViewedByLoading(source, location);
}
}

Expand Down Expand Up @@ -1125,6 +1123,9 @@ public void saveSettings()
{
//Previewed the image.
Renderer rnd = model.getEditor().getRenderer();
if (rnd != null) {
model.fireThumbnailsLoading();
}
if (rnd != null && getRndIndex() == RND_GENERAL) {
//save settings
long imageID = -1;
Expand Down
Expand Up @@ -913,8 +913,11 @@ void setViewedBy(Map viewedBy)
}
}
}
this.viewedBy = m;
getEditor().getRenderer().loadRndSettings(true, null);
this.viewedBy = m;
Renderer rnd = getEditor().getRenderer();
if (rnd != null) {
rnd.loadRndSettings(true, null);
}
}

/**
Expand Down Expand Up @@ -944,6 +947,7 @@ else if (refObject instanceof WellSampleData)
/** Starts an asynchronous retrieval of the thumbnails. */
void fireThumbnailsLoading()
{
if (viewedBy == null) return;
ImageData image = null;
if (refObject instanceof ImageData) image = (ImageData) refObject;
else if (refObject instanceof WellSampleData)
Expand Down
Expand Up @@ -246,42 +246,45 @@ void setLocationAndSource(Component source, Point location)
*/
void viewedBy(Component source, Point location)
{
if (viewedByMenu == null) {
Map m = model.getViewedBy();
viewedByMenu = new JPopupMenu();
ViewerSorter sorter = new ViewerSorter();
List list = sorter.sort(m.keySet());
Iterator i = list.iterator();
ViewedByItem item ;
ExperimenterData exp;
while (i.hasNext()) {
exp = (ExperimenterData) i.next();
item = new ViewedByItem(exp, (RndProxyDef) m.get(exp));
item.addPropertyChangeListener(
ViewedByItem.VIEWED_BY_PROPERTY, this);
viewedByMenu.add(item);
}
if (list.size() == 0) {
thumbnailsMenuItem = new JMenuItem("Not viewed");
thumbnailsMenuItem.setToolTipText("No other users " +
"viewed the image.");
} else {
IconManager icons = IconManager.getInstance();
thumbnailsMenuItem = new JMenuItem("Show thumbnails");
thumbnailsMenuItem.setIcon(icons.getIcon(
IconManager.PREVIEW_THUMBNAILS_32));
thumbnailsMenuItem.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)
{
showViewedBy();
}
});
}

viewedByMenu.add(thumbnailsMenuItem);
if (viewedByMenu == null) {
viewedByMenu = new JPopupMenu();
}
viewedByMenu.removeAll();
Map m = model.getViewedBy();
ViewerSorter sorter = new ViewerSorter();
List list = sorter.sort(m.keySet());
Iterator i = list.iterator();
ViewedByItem item ;
ExperimenterData exp;
while (i.hasNext()) {
exp = (ExperimenterData) i.next();
item = new ViewedByItem(exp, (RndProxyDef) m.get(exp));
item.addPropertyChangeListener(
ViewedByItem.VIEWED_BY_PROPERTY, this);
viewedByMenu.add(item);
}
if (list.size() == 0) {
thumbnailsMenuItem = new JMenuItem("No settings saved");
thumbnailsMenuItem.setToolTipText("No other users " +
"saved the rendering settings.");
} else {
IconManager icons = IconManager.getInstance();
thumbnailsMenuItem = new JMenuItem("Show thumbnails");
thumbnailsMenuItem.setIcon(icons.getIcon(
IconManager.PREVIEW_THUMBNAILS_32));
thumbnailsMenuItem.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)
{
showViewedBy();
}
});
}

viewedByMenu.add(thumbnailsMenuItem);
if (source != null && source.isVisible()) {
viewedByMenu.show(source, location.x, location.y);
}
viewedByMenu.show(source, location.x, location.y);
}

/** Displays all the thumbnails. */
Expand Down Expand Up @@ -341,6 +344,7 @@ void setThumbnails(Map<Long, BufferedImage> thumbnails)
}
}
}
if (items != null) showViewedBy();
thumbnailsMenuItem.setEnabled(items.size() > 0);
model.getEditor().getRenderer().loadRndSettings(true, null);
}
Expand Down
Expand Up @@ -8387,4 +8387,28 @@ Map<Long, List<IObject>> loadLogFiles(SecurityContext ctx,
}
return new HashMap();
}

/**
* Retrieves the rendering settings for the specified pixels set.
*
* @param ctx The security context.
* @param rndID The rendering settings ID.
* @return See above.
* @throws DSOutOfServiceException If the connection is broken, or logged
* in.
* @throws DSAccessException If an error occurred while trying to
* retrieve data from OMEDS service.
*/
RenderingDef getRenderingDef(SecurityContext ctx, long rndID)
throws DSOutOfServiceException, DSAccessException
{
Connector c = getConnector(ctx, true, false);
try {
IPixelsPrx service = c.getPixelsService();
return service.loadRndSettings(rndID);
} catch (Exception e) {
handleException(e, "Cannot retrieve the rendering settings");
}
return null;
}
}
Expand Up @@ -2,10 +2,10 @@
* org.openmicroscopy.shoola.env.data.OmeroImageService
*
*------------------------------------------------------------------------------
* Copyright (C) 2006-2013 University of Dundee. All rights reserved.
* Copyright (C) 2006-2014 University of Dundee. All rights reserved.
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
Expand Down Expand Up @@ -40,7 +40,6 @@
import omero.api.ThumbnailStorePrx;
//Application-internal dependencies
import omero.constants.projection.ProjectionType;
import omero.model.RenderingDef;
import omero.romio.PlaneDef;
import org.openmicroscopy.shoola.env.data.model.ImportableFile;
import org.openmicroscopy.shoola.env.data.model.ImportableObject;
Expand Down Expand Up @@ -68,9 +67,6 @@
* @author Donald MacDonald &nbsp;&nbsp;&nbsp;&nbsp;
* <a href="mailto:donald@lifesci.dundee.ac.uk">donald@lifesci.dundee.ac.uk</a>
* @version 3.0
* <small>
* (<b>Internal version:</b> $Revision: $ $Date: $)
* </small>
* @since OME2.2
*/
public interface OmeroImageService
Expand Down Expand Up @@ -898,4 +894,17 @@ ThumbnailStorePrx createThumbnailStore(SecurityContext ctx)
Long getRenderingDef(SecurityContext ctx, long pixelsID, long userID)
throws DSOutOfServiceException, DSAccessException;

/**
* Retrieves the rendering settings for the specified pixels set.
*
* @param ctx The security context.
* @param rndID The rendering settings ID.
* @return See above.
* @throws DSOutOfServiceException If the connection is broken, or logged
* in.
* @throws DSAccessException If an error occurred while trying to
* retrieve data from OMEDS service.
*/
RndProxyDef getSettings(SecurityContext ctx, long rndID)
throws DSOutOfServiceException, DSAccessException;
}
Expand Up @@ -2,10 +2,10 @@
* org.openmicroscopy.shoola.env.data.OmeroImageServiceImpl
*
*------------------------------------------------------------------------------
* Copyright (C) 2006-2013 University of Dundee. All rights reserved.
* Copyright (C) 2006-2014 University of Dundee. All rights reserved.
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
Expand Down Expand Up @@ -122,10 +122,6 @@
* <a href="mailto:j.burel@dundee.ac.uk">j.burel@dundee.ac.uk</a>
* @author Donald MacDonald &nbsp;&nbsp;&nbsp;&nbsp;
* <a href="mailto:donald@lifesci.dundee.ac.uk">donald@lifesci.dundee.ac.uk</a>
* @version 3.0
* <small>
* (<b>Internal version:</b> $Revision: $ $Date: $)
* </small>
* @since OME3.0
*/
class OmeroImageServiceImpl
Expand Down Expand Up @@ -1906,4 +1902,17 @@ public Long getRenderingDef(SecurityContext ctx, long pixelsID,
return def.getId().getValue();
}

/**
* Implemented as specified by {@link OmeroDataService}.
* @see OmeroImageService#getRenderingDef(SecurityContext, long)
*/
public RndProxyDef getSettings(SecurityContext ctx, long rndID)
throws DSOutOfServiceException, DSAccessException
{
if (rndID < 0) return null;
RenderingDef def = gateway.getRenderingDef(ctx, rndID);
if (def == null) return null;
return PixelsServicesFactory.convert(def);
}

}
Expand Up @@ -2,10 +2,10 @@
* org.openmicroscopy.shoola.env.rnd.RenderingControlFactory
*
*------------------------------------------------------------------------------
* Copyright (C) 2006 University of Dundee. All rights reserved.
* Copyright (C) 2006-2014 University of Dundee. All rights reserved.
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
Expand Down Expand Up @@ -75,10 +75,6 @@
* <a href="mailto:j.burel@dundee.ac.uk">j.burel@dundee.ac.uk</a>
* @author Andrea Falconi &nbsp;&nbsp;&nbsp;&nbsp;
* <a href="mailto:a.falconi@dundee.ac.uk">a.falconi@dundee.ac.uk</a>
* @version 3.0
* <small>
* (<b>Internal version:</b> $Revision: $ $Date: $)
* </small>
* @since OME2.2
*/
public class PixelsServicesFactory
Expand Down Expand Up @@ -146,7 +142,7 @@ public static RndProxyDef convert(RenderingDef rndDef)
{
if (rndDef == null) return null;

RndProxyDef proxy = new RndProxyDef();
RndProxyDef proxy = new RndProxyDef(rndDef);
try {
long v = rndDef.getDetails().getUpdateEvent().getTime().getValue();
proxy.setLastModified(new Timestamp(v));
Expand Down