Changeset 1940


Ignore:
Timestamp:
12/18/06 15:10:45 (13 years ago)
Author:
curtis
Message:

Fix bugs in multi-series parameter population causing initFile to be called
repeatedly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/FileStitcher.java

    r1938 r1940  
    377377    if (blankBytes[sno] == null) { 
    378378      int bytes = FormatReader.getBytesPerPixel(getPixelType(currentId)); 
    379       blankBytes[sno] = new byte[width[sno] * height[sno] * bytes *  
    380         (isRGB(id) ? sizeC[sno] : 1)]; 
     379      blankBytes[sno] = new byte[width[sno] * height[sno] * 
     380        bytes * (isRGB(id) ? sizeC[sno] : 1)]; 
    381381    } 
    382382    return blankBytes[sno]; 
     
    653653    String f0 = files[0]; 
    654654 
    655     int seriesCount = getSeriesCount(f0); 
     655    int seriesCount = reader.getSeriesCount(f0); 
    656656    ag = new AxisGuesser[seriesCount]; 
    657657    blankImage = new BufferedImage[seriesCount]; 
     
    665665    sizeC = new int[seriesCount]; 
    666666    sizeT = new int[seriesCount]; 
     667    boolean[] certain = new boolean[seriesCount]; 
    667668    totalSizeZ = new int[seriesCount]; 
    668669    totalSizeC = new int[seriesCount]; 
     
    674675    // analyze first file; assume each file has the same parameters 
    675676     
    676     int oldSeries = getSeries(f0); 
     677    int oldSeries = reader.getSeries(f0); 
    677678    for (int i=0; i<seriesCount; i++) { 
    678       setSeries(f0, i); 
    679679      reader.setSeries(f0, i); 
    680680      width[i] = reader.getSizeX(f0); 
     
    682682      imagesPerFile[i] = reader.getImageCount(f0); 
    683683      totalImages[i] = files.length * imagesPerFile[i]; 
    684       /* debug */ System.out.println("setting image count to " + 
    685         imagesPerFile[i] + " for series " + getSeries(f0)); 
    686684      order[i] = reader.getDimensionOrder(f0); 
    687685      sizeZ[i] = reader.getSizeZ(f0); 
    688686      sizeC[i] = reader.getSizeC(f0); 
    689687      sizeT[i] = reader.getSizeT(f0); 
    690     } 
    691     setSeries(f0, oldSeries); 
    692     boolean certain = reader.isOrderCertain(f0); 
     688      certain[i] = reader.isOrderCertain(f0); 
     689    } 
     690    reader.setSeries(f0, oldSeries); 
    693691 
    694692    // guess at dimensions corresponding to file numbering 
    695693    for (int i=0; i<seriesCount; i++) { 
    696       ag[i] = new AxisGuesser(fp, order[i], sizeZ[i], sizeT[i], sizeC[i],  
    697         certain); 
     694      ag[i] = new AxisGuesser(fp, order[i], 
     695        sizeZ[i], sizeT[i], sizeC[i], certain[i]); 
    698696    } 
    699697 
    700698    // order may need to be adjusted 
    701699    for (int i=0; i<seriesCount; i++) { 
    702       setSeries(f0, i); 
     700      setSeries(currentId, i); 
    703701      order[i] = ag[i].getAdjustedOrder(); 
    704702      swapDimensions(currentId, order[i]); 
    705703    } 
    706     setSeries(f0, oldSeries); 
     704    setSeries(currentId, oldSeries); 
    707705  } 
    708706 
Note: See TracChangeset for help on using the changeset viewer.