• 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 5683

Show
Ignore:
Timestamp:
10/13/08 16:29:16 (7 weeks ago)
Author:
jburel
Message:

Set size of the cache

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

  • RenderingControl.java (modified) (1 diff)
  • RenderingControlProxy.java (modified) (8 diffs)

Legend:

Unmodified
Added
Removed
  • trunk/SRC/org/openmicroscopy/shoola/env/rnd/RenderingControl.java

    r5657 r5683  
    3333 
    3434//Application-internal dependencies 
    35 import omero.model.Pixels; 
    3635import omero.romio.PlaneDef; 
    3736import org.openmicroscopy.shoola.env.data.DSOutOfServiceException; 
    3837import org.openmicroscopy.shoola.env.data.model.ChannelMetadata; 
    39  
    4038import pojos.PixelsData; 
    4139 
  • trunk/SRC/org/openmicroscopy/shoola/env/rnd/RenderingControlProxy.java

    r5682 r5683  
    120120    private int                                         cacheSize; 
    121121     
     122    /** The size of the image. */ 
     123    private int                                         imageSize; 
     124     
    122125    /** 
    123126     * Helper method to handle exceptions thrown by the connection library. 
    … …  
    198201    private void invalidateCache() 
    199202    { 
    200         if (cacheID >= 0){ 
     203        if (cacheID >= 0) 
    201204                 context.getCacheService().clearCache(cacheID); 
    202         } 
    203205    } 
    204206     
    … …  
    235237        } 
    236238        */ 
    237         if (pDef.slice == omero.romio.XY.value)  
     239        if (pDef.slice == omero.romio.XY.value) { 
    238240                cacheID = context.getCacheService().createCache( 
    239                                                         CacheService.IN_MEMORY); 
     241                                        CacheService.IN_MEMORY, cacheSize/imageSize); 
     242        } 
     243                 
    240244    } 
    241245   
    … …  
    396400                         
    397401                        byte[] values = servant.renderCompressed(pDef); 
     402                        imageSize = values.length; 
    398403                        initializeCache(pDef); 
    399404                        cache(pDef, values); 
    … …  
    441446                    break; 
    442447            } 
     448            imageSize = 3*buf.length; 
    443449            initializeCache(pDef); 
    444450            img = Factory.createImage(buf, 32, sizeX1, sizeX2); 
    … …  
    551557            models = servant.getAvailableModels(); 
    552558            cacheID = -1; 
    553              
     559            imageSize = 1; 
    554560            this.compression = compression; 
    555561            if (rndDef == null) { 
    … …  
    689695         * Resets the size of the cache. 
    690696         *  
    691          * @param size The size of the cache. 
     697         * @param size The size, in bytes, of the cache. 
    692698         */ 
    693699        void setCacheSize(int size) 
    694700        { 
    695                 context.getCacheService().setCacheSize(cacheID, size); 
     701                if (imageSize == 0) imageSize = 1; 
     702                context.getCacheService().setCacheSize(cacheID, size/imageSize); 
    696703        } 
    697704         
    … …  
    14601467        { 
    14611468                List<Integer> active = new ArrayList<Integer>(); 
    1462                 for (int i = 0; i < getPixelsDimensionsC(); i++) { 
     1469                for (int i = 0; i < getPixelsDimensionsC(); i++)  
    14631470                        if (isActive(i)) active.add(new Integer(i)); 
    1464                 } 
    14651471                return active; 
    14661472        } 

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/