Changeset 228 for trunk/loci/visbio/view


Ignore:
Timestamp:
03/15/05 18:06:42 (15 years ago)
Author:
curtis
Message:

Data cache works pretty well now.

Location:
trunk/loci/visbio/view
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/visbio/view/StackLink.java

    r224 r228  
    5454  /** Data reference for volume rendered cube. */ 
    5555  protected DataReferenceImpl volumeRef; 
    56  
    57   /** Collapsed volume at current dimensional position. */ 
    58   protected FlatField collapse; 
    5956 
    6057  /** Whether volume rendering is currently enabled. */ 
     
    314311 
    315312    // check whether dimensional position has changed 
     313    DataCache cache = handler.getCache(); 
    316314    if (!thumbs) { 
    317315      if (cachedPos != null && cachedPos.length == pos.length) { 
     
    321319            for (int s=0; s<len; s++) { 
    322320              if (stackAxis >= 0) cachedPos[stackAxis] = s; 
    323               handler.getCache().dump(trans, cachedPos); 
     321              cache.dump(trans, cachedPos, null); 
    324322            } 
     323            // also dump old collapsed image stack 
     324            cache.dump(trans, cachedPos, "collapse"); 
    325325            break; 
    326326          } 
     
    329329      cachedPos = pos; 
    330330    } 
     331 
     332    // retrieve collapsed image stack from data cache 
     333    FlatField collapse = (FlatField) cache.getData(trans, pos, "collapse", 3); 
    331334 
    332335    // compute image data at each slice 
     
    355358      } 
    356359    } 
    357     if (thumbs) { 
    358       setData(DUMMY, volumeRef, false); 
    359       collapse = null; 
    360     } 
     360    if (stackAxis >= 0) pos[stackAxis] = 0; 
     361 
     362    if (thumbs) setData(DUMMY, volumeRef, false); 
    361363    else { 
    362364      if (volume) { 
     
    369371        try { 
    370372          if (collapse == null) { 
    371             // convert slices to proper type 
     373            // use image transform's recommended MathType 
    372374            for (int i=0; i<len; i++) { 
    373375              slices[i] = VisUtil.switchType((FlatField) slices[i], imageType); 
    374376            } 
    375377            // compile slices into a single volume and collapse 
    376             FieldImpl field = VisUtil.makeField(slices, zType, -1, 1); 
    377             collapse = VisUtil.collapse(field); 
     378            collapse = VisUtil.collapse( 
     379              VisUtil.makeField(slices, zType, -1, 1)); 
     380            cache.putData(trans, pos, "collapse", collapse); 
    378381          } 
    379382          // resample volume 
  • trunk/loci/visbio/view/TransformLink.java

    r224 r228  
    415415      if (!ObjectUtil.arraysEqual(pos, cachedPos)) { 
    416416        // for now, simply dump old full-resolution data 
    417         handler.getCache().dump(trans, cachedPos); 
     417        handler.getCache().dump(trans, cachedPos, null); 
    418418      } 
    419419      cachedPos = pos; 
Note: See TracChangeset for help on using the changeset viewer.