• Views
  • Iteration Report
  • My Iteration Report
  •  
OMERO.clients
  • Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • ← Previous Changeset
  • Next Changeset →

Changeset 5621

Show
Ignore:
Timestamp:
09/19/08 18:18:25 (2 months ago)
Author:
jburel
Message:

Clean up code

Location:
trunk/SRC/org/openmicroscopy/shoola
Files:
2 modified

  • agents/metadata/browser/Browser.java (modified) (1 diff)
  • env/rnd/RenderingControlProxy.java (modified) (10 diffs)

Legend:

Unmodified
Added
Removed
  • trunk/SRC/org/openmicroscopy/shoola/agents/metadata/browser/Browser.java

    r5620 r5621  
    3232 
    3333//Application-internal dependencies 
    34 import org.openmicroscopy.shoola.env.data.util.StructuredDataResults; 
    3534import org.openmicroscopy.shoola.util.ui.component.ObservableComponent; 
    3635 
  • trunk/SRC/org/openmicroscopy/shoola/env/rnd/RenderingControlProxy.java

    r5619 r5621  
    5151import omeis.providers.re.RenderingEngine; 
    5252import omeis.providers.re.data.PlaneDef; 
    53  
    5453import org.openmicroscopy.shoola.env.cache.CacheService; 
    5554import org.openmicroscopy.shoola.env.config.Registry; 
    … …  
    207206    private void eraseCache() 
    208207    { 
    209         /* 
    210         if (xyCache == null) return; 
    211         invalidateCache(); 
    212         xyCache = null; 
    213         CachingService.eraseXYCache(pixs.getId());  
    214         */ 
    215208        invalidateCache(); 
    216209        context.getCacheService().removeCache(cacheID); 
    … …  
    271264    } 
    272265     
     266        /** 
     267         * Returns if <code>true</code> if one of the channels is of the specified 
     268         * color, <code>false</code> otherwise. 
     269         *  
     270         * @param red   The red component in the range [0, 255] in the default sRGB 
     271         *                              space. 
     272         * @param green The green component in the range [0, 255] in the default  
     273         *                              sRGB space. 
     274         * @param blue  The blue component in the range [0, 255] in the default sRGB 
     275         *                              space. 
     276         * @return See above. 
     277         */ 
     278        private boolean isRightColor(int red, int green, int blue) 
     279        { 
     280                for (int i = 0; i < getPixelsDimensionsC(); i++) { 
     281                        if (isActive(i)) { 
     282                                if (isRightChannelColor(i, red, green, blue)) 
     283                                        return true; 
     284                        } 
     285                } 
     286                return false; 
     287        } 
     288         
     289        /** 
     290         * Returns if <code>true</code> if the channel is of the specified 
     291         * color, <code>false</code> otherwise. 
     292         *  
     293         * @param index The index of the channel. 
     294         * @param red   The red component in the range [0, 255] in the default sRGB 
     295         *                              space. 
     296         * @param green The green component in the range [0, 255] in the default  
     297         *                              sRGB space. 
     298         * @param blue  The blue component in the range [0, 255] in the default sRGB 
     299         *                              space. 
     300         * @return See above. 
     301         */ 
     302        private boolean isRightChannelColor(int index, int red, int green, int blue) 
     303        { 
     304                int[] rgba = rndDef.getChannel(index).getRGBA(); 
     305                return (rgba[0] == red && rgba[1] == green && rgba[2] == blue); 
     306        } 
     307         
    273308    /** Initializes the cached rendering settings to speed up process. */ 
    274309    private void initialize() 
    … …  
    10641099     * @see RenderingControl#hasActiveChannelBlue() 
    10651100     */ 
    1066         public boolean hasActiveChannelBlue() 
    1067         { 
    1068                 int[] rgba; 
    1069                 for (int i = 0; i < getPixelsDimensionsC(); i++) { 
    1070                         if (isActive(i)) { 
    1071                                 rgba = rndDef.getChannel(i).getRGBA(); 
    1072                                 if (rgba[0] == 0 && rgba[1] == 0 && rgba[2] == 255) 
    1073                                         return true; 
    1074                         } 
    1075                 } 
    1076                 return false; 
    1077         } 
     1101        public boolean hasActiveChannelBlue() { return isRightColor(0, 0, 255); } 
    10781102 
    10791103        /**  
    … …  
    10811105     * @see RenderingControl#hasActiveChannelGreen() 
    10821106     */ 
    1083         public boolean hasActiveChannelGreen() 
    1084         { 
    1085                 int[] rgba; 
    1086                 for (int i = 0; i < getPixelsDimensionsC(); i++) { 
    1087                         if (isActive(i)) { 
    1088                                 rgba = rndDef.getChannel(i).getRGBA(); 
    1089                                 if (rgba[0] == 0 && rgba[1] == 255 && rgba[2] == 0) 
    1090                                         return true; 
    1091                         } 
    1092                 } 
    1093                 return false; 
    1094         } 
    1095  
     1107        public boolean hasActiveChannelGreen() { return isRightColor(0, 255, 0); } 
     1108         
    10961109        /**  
    10971110     * Implemented as specified by {@link RenderingControl}.  
    10981111     * @see RenderingControl#hasActiveChannelRed() 
    10991112     */ 
    1100         public boolean hasActiveChannelRed() 
    1101         { 
    1102                 int[] rgba; 
    1103                 for (int i = 0; i < getPixelsDimensionsC(); i++) { 
    1104                         if (isActive(i)) { 
    1105                                 rgba = rndDef.getChannel(i).getRGBA(); 
    1106                                 if (rgba[0] == 255 && rgba[1] == 0 && rgba[2] == 0) 
    1107                                         return true; 
    1108                         } 
    1109                 } 
    1110                 return false; 
    1111         } 
     1113        public boolean hasActiveChannelRed() { return isRightColor(255, 0, 0); } 
    11121114         
    11131115        /**  
    … …  
    11181120        { 
    11191121                if (index < 0 || index > getPixelsDimensionsC()) return false; 
    1120                 int[] rgba = rndDef.getChannel(index).getRGBA(); 
    1121                 return (rgba[0] == 255 && rgba[1] == 0 && rgba[2] == 0); 
     1122                return isRightChannelColor(index, 255, 0, 0); 
    11221123        } 
    11231124         
    … …  
    11291130        { 
    11301131                if (index < 0 || index > getPixelsDimensionsC()) return false; 
    1131                 int[] rgba = rndDef.getChannel(index).getRGBA(); 
    1132                 return (rgba[0] == 0 && rgba[1] == 0 && rgba[2] == 255); 
     1132                return isRightChannelColor(index, 0, 0, 255); 
    11331133        } 
    11341134         
    … …  
    11401140        { 
    11411141                if (index < 0 || index > getPixelsDimensionsC()) return false; 
    1142                 int[] rgba = rndDef.getChannel(index).getRGBA(); 
    1143                 return (rgba[0] == 0 && rgba[1] == 255 && rgba[2] == 0); 
     1142                return isRightChannelColor(index, 0, 255, 0); 
    11441143        } 
    11451144 
    … …  
    12381237        { 
    12391238                if (pixels == null) return false; 
     1239                DataServicesFactory.isSessionAlive(context); 
    12401240                if (getPixelsDimensionsC() != pixels.getSizeC().intValue()) 
    12411241                        return false; 
    … …  
    13451345                        setActive(j.next(), true); 
    13461346                BufferedImage img; 
    1347                  
    1348                  
    1349                  
     1347 
    13501348        if (isCompressed())  
    13511349                img = renderProjectedCompressed(startZ, endZ, stepping, type); 

Download in other formats:

  • Unified Diff
  • Zip Archive

Trac Powered

Powered by Trac 0.11
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/