Changeset 2710


Ignore:
Timestamp:
05/01/07 10:27:44 (13 years ago)
Author:
melissa
Message:

Bugfixes.

Location:
trunk/loci/formats/in
Files:
3 edited

Legend:

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

    r2701 r2710  
    116116    tiff[series][no].setId((String) files[series].get(no)); 
    117117    byte[] b = tiff[series][no].openBytes(0); 
    118     b = ImageTools.splitChannels(b, core.sizeC[series], false, 
     118     
     119    int c = b.length / (core.sizeX[series] * core.sizeY[series] *  
     120      FormatTools.getBytesPerPixel(core.pixelType[series]));  
     121     
     122    b = ImageTools.splitChannels(b, c, false, 
    119123      isInterleaved())[channelIndices[ndx]]; 
    120124    tiff[series][no].close(); 
     
    135139 
    136140    int ndx = no % channelIndices.length; 
    137     buf = ImageTools.splitChannels(buf, core.sizeC[series], false, 
     141    int c = buf.length / (core.sizeX[series] * core.sizeY[series] *  
     142      FormatTools.getBytesPerPixel(core.pixelType[series]));  
     143    buf = ImageTools.splitChannels(buf, c, false, 
    138144      isInterleaved())[channelIndices[ndx]]; 
    139145    return buf; 
  • trunk/loci/formats/in/ND2Reader.java

    r2701 r2710  
    447447    if (core.sizeC[0] == 2) core.sizeC[0] = 1; 
    448448 
     449    if (core.sizeZ[0] == 0) core.sizeZ[0] = 1; 
     450    if (core.sizeT[0] == 0) core.sizeT[0] = 1; 
     451 
    449452    core.currentOrder[0] = "XY"; 
    450453    long deltaT = ts.size() > 1 ? 
  • trunk/loci/formats/in/NRRDReader.java

    r2701 r2710  
    3434 
    3535  // -- Fields -- 
     36 
     37  /** Helper reader. */ 
     38  private ImageReader helper; 
    3639 
    3740  /** Name of data file, if the current extension is 'nhdr'. */ 
     
    9396      else throw new FormatException("Unsupported encoding: " + encoding); 
    9497    } 
    95     return null; 
     98    return helper.openBytes(no, buf); 
    9699  } 
    97100 
     
    116119  } 
    117120 
     121  /* @see loci.formats.IFormatReader#close() */ 
     122  public void close() throws IOException { 
     123    super.close(); 
     124    if (helper != null) helper.close(); 
     125  } 
     126 
    118127  // -- Internal FormatReader API methods -- 
    119128 
     
    122131    super.initFile(id); 
    123132    in = new RandomAccessStream(id); 
     133    helper = new ImageReader(); 
    124134 
    125135    boolean finished = false; 
     
    172182            int size = Integer.parseInt(t); 
    173183 
    174             if (numDimensions >= 3 && i == 0 && size > 1) core.sizeC[0] = size; 
     184            if (numDimensions >= 3 && i == 0 && size > 1 && size <= 4) { 
     185              core.sizeC[0] = size; 
     186            }  
    175187            else if (i == 0 || (core.sizeC[0] > 1 && i == 1)) { 
    176188              core.sizeX[0] = size; 
     
    197209        else if (key.equals("max")) max = v; 
    198210      } 
    199       if (line.length() == 0 && dataFile == null) finished = true; 
    200       if (dataFile != null && in.getFilePointer() == in.length()) { 
     211       
     212      if ((line.length() == 0 && dataFile == null) || line == null) { 
    201213        finished = true; 
     214      }  
     215      if (dataFile != null && (in.length() - in.getFilePointer() < 2)) { 
     216        finished = true; 
    202217      } 
    203218    } 
    204219 
    205220    if (dataFile == null) offset = in.getFilePointer(); 
    206     else throw new FormatException("Separate headers not supported."); 
     221    else helper.setId(dataFile); 
    207222 
    208223    core.rgb[0] = core.sizeC[0] > 1; 
Note: See TracChangeset for help on using the changeset viewer.