Changeset 3909


Ignore:
Timestamp:
04/10/08 11:35:34 (12 years ago)
Author:
melissa
Message:

Finally fixed the remaining plane size detection bugs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/in/SlidebookReader.java

    r3874 r3909  
    312312      if (n == 'i') { 
    313313        iCount++; 
    314         in.skipBytes(81); 
     314        in.skipBytes(78); 
    315315        int start = 0; 
    316316        for (int j=start; j<pixelOffsets.size(); j++) { 
     
    322322            in.getFilePointer() < end) 
    323323          { 
    324             if ((in.getFilePointer() % 2) == 1) { 
    325               in.seek(in.getFilePointer() - 1); 
    326             } 
    327             if (core.sizeY[j - start] == 0) { 
     324            if (core.sizeX[j - start] == 0) { 
     325              core.sizeX[j - start] = in.readShort(); 
    328326              core.sizeY[j - start] = in.readShort(); 
    329               if (core.sizeY[j - start] < 256 && core.sizeY[j - start] != 128) { 
    330                 in.seek(in.getFilePointer() - 3); 
    331                 core.sizeY[j - start] = in.readShort(); 
    332               } 
    333               else if ((core.sizeY[j - start] % 8) != 0) { 
    334                 in.skipBytes(2); 
    335                 core.sizeY[j - start] = in.readShort(); 
    336               } 
    337               int div = (int) Math.pow(2, in.readShort() & 1); 
    338               if (div < core.sizeY[j - start]) { 
    339                 core.sizeY[j - start] /= div; 
    340               } 
     327              int checkX = in.readShort(); 
     328              int checkY = in.readShort(); 
     329              int div = in.readShort(); 
     330              //if (checkX >= 128 && div == 1) div = 2; 
     331              core.sizeX[j - start] /= div; 
     332              div = in.readShort(); 
     333              //if (checkY>= 128 && div == 1) div = 2; 
     334              core.sizeY[j - start] /= div; 
    341335            } 
    342336            if (prevSeries != j - start) { 
     
    386380    for (int i=0; i<core.sizeX.length; i++) { 
    387381      long pixels = ((Long) pixelLengths.get(i)).longValue() / 2; 
    388       core.sizeT[i] = 1; 
     382      boolean x = true; 
     383      while (core.sizeX[i] * core.sizeY[i] * core.sizeC[i] * core.sizeZ[i] > 
     384        pixels) 
     385      { 
     386        if (x) core.sizeX[i] /= 2; 
     387        else core.sizeY[i] /= 2; 
     388        x = !x; 
     389      } 
    389390      if (core.sizeZ[i] == 0) core.sizeZ[i] = 1; 
     391      core.sizeT[i] = (int) (pixels / 
     392        (core.sizeX[i] * core.sizeY[i] * core.sizeZ[i] * core.sizeC[i])); 
     393      if (core.sizeT[i] == 0) core.sizeT[i] = 1; 
    390394      core.imageCount[i] = core.sizeZ[i] * core.sizeT[i] * core.sizeC[i]; 
    391       core.sizeX[i] = (int) (pixels / (core.imageCount[i] * core.sizeY[i])); 
    392       if ((core.sizeX[i] % 2) == 1) core.sizeX[i]--; 
    393395      core.pixelType[i] = FormatTools.UINT16; 
    394396      core.currentOrder[i] = "XYZTC"; 
Note: See TracChangeset for help on using the changeset viewer.