Changeset 6273


Ignore:
Timestamp:
05/11/10 14:07:04 (10 years ago)
Author:
curtis
Message:

Progress on Bio-Formats Importer refactoring:

  • Fix problem with dimension swapping test.
  • Change merge option to use number of channels per plane.
Location:
trunk/components/loci-plugins
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/loci-plugins/src/loci/plugins/BF.java

    r6271 r6273  
    7171    ImportProcess process = new ImportProcess(options); 
    7272    new ImporterPrompter(process);//TEMP 
    73     if (!process.process()) return null; 
     73    if (!process.execute()) return null; 
    7474    ImagePlusReader reader = new ImagePlusReader(process); 
    7575    return reader.openImagePlus(); 
  • trunk/components/loci-plugins/src/loci/plugins/colorize/MergeDialog.java

    r6265 r6273  
    7777   
    7878  protected boolean harvestResults(GenericDialog gd) { 
    79     options.setMergeOption(mergeOptions[gd.getNextChoiceIndex()]); 
     79    options.setMergeOption("" + (gd.getNextChoiceIndex() + 2)); 
    8080    return true; 
    8181  } 
  • trunk/components/loci-plugins/src/loci/plugins/in/ImportProcess.java

    r6271 r6273  
    152152   * @return true if the process completed successfully. 
    153153   */ 
    154   public boolean process() throws FormatException, IOException { 
     154  public boolean execute() throws FormatException, IOException { 
    155155    notifyListeners(ImportStep.READER); 
    156156    if (cancel) return false; 
     
    270270  /** Performed following ImportStep.DIM_ORDER notification. */ 
    271271  private void initializeDimOrder() { 
    272     String dimOrder = options.getInputOrder(); 
    273     if (dimOrder != null) dimensionSwapper.swapDimensions(dimOrder); 
     272    int seriesCount = getSeriesCount(); 
     273    for (int s=0; s<seriesCount; s++) { 
     274      reader.setSeries(s); 
     275      String dimOrder = options.getInputOrder(s); 
     276      if (dimOrder != null) dimensionSwapper.swapDimensions(dimOrder); 
     277    } 
    274278  } 
    275279 
  • trunk/components/loci-plugins/src/loci/plugins/in/Importer.java

    r6271 r6273  
    122122    new ImporterPrompter(process); 
    123123    // execute the preparation process 
    124     process.process(); 
     124    process.execute(); 
    125125    if (process.wasCanceled()) plugin.canceled = true; 
    126126  } 
  • trunk/components/loci-plugins/src/loci/plugins/in/ImporterOptions.java

    r6265 r6273  
    114114 
    115115  // swap options 
    116   private String inputOrder; 
     116  private List<String> inputOrder = new ArrayList<String>(); 
    117117 
    118118  // range options 
     
    366366 
    367367  // swap options 
    368   public String getInputOrder() { return inputOrder; } 
    369   public void setInputOrder(String dimOrder) { inputOrder = dimOrder; } 
     368  public String getInputOrder(int s) { return get(inputOrder, s, null); } 
     369  public void setInputOrder(int s, String value) { 
     370    set(inputOrder, s, value, null); 
     371  } 
    370372 
    371373  // range options 
  • trunk/components/loci-plugins/src/loci/plugins/in/SwapDialog.java

    r6271 r6273  
    107107      } 
    108108 
    109       // CTR FIXME - need separate input order for each series... 
    110       options.setInputOrder(sb.toString()); 
     109      options.setInputOrder(s, sb.toString()); 
    111110    } 
    112111    return true; 
  • trunk/components/loci-plugins/src/loci/plugins/in/importer-options.txt

    r5729 r6273  
    154154[mergeOption] 
    155155type = string 
    156 label = Merging options 
     156label = Merging channels per plane 
    157157default = Do not merge 
    158158 
  • trunk/components/loci-plugins/test/loci/plugins/in/ImporterTest.java

    r6271 r6273  
    115115  private int tIndex(ImageProcessor proc) { return proc.get(40,0); }  // t 
    116116   
     117  @SuppressWarnings("unused") 
    117118  private void printVals(ImageProcessor proc) 
    118119  { 
     
    321322      options.setId(path); 
    322323      options.setSwapDimensions(true); 
    323       options.setInputOrder(swappedOrder); 
     324      options.setInputOrder(0, swappedOrder); 
    324325      imps = BF.openImagePlus(options); 
    325326    } 
     
    334335    assertEquals(1,imps.length); 
    335336 
    336     ImageStack st = imps[0].getStack(); 
     337    ImagePlus imp = imps[0]; 
     338    ImageStack st = imp.getStack(); 
    337339    int numSlices = st.getSize(); 
    338340    assertEquals(z*c*t,numSlices); 
    339341 
    340     int maxZ = -1; 
    341     int maxT = -1; 
    342     int tmp; 
    343     for (int i = 0; i < numSlices; i++) 
    344     { 
    345       ImageProcessor proc = st.getProcessor(i+1); 
    346       printVals(proc); 
    347       tmp = zIndex(proc)+1; 
    348       if (maxZ < tmp) maxZ = tmp; 
    349       tmp = tIndex(proc)+1; 
    350       if (maxT < tmp) maxT = tmp; 
    351     } 
    352     assertEquals(z,maxT); 
    353     assertEquals(t,maxZ); 
     342    int actualZ = getSizeZ(imp); 
     343    int actualT = getSizeT(imp); 
     344    assertEquals(z,actualT); 
     345    assertEquals(t,actualZ); 
     346 
     347    // TODO - Verify that actual order is correct, rather than just lengths. 
     348    // Can use zIndex and tIndex methods for this. 
    354349  } 
    355350 
Note: See TracChangeset for help on using the changeset viewer.