Changeset 4159


Ignore:
Timestamp:
07/02/08 14:43:27 (12 years ago)
Author:
melissa
Message:

Fixed .tim file parsing bug.

File:
1 edited

Legend:

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

    r4158 r4159  
    445445      while (t.hasMoreTokens() && tNum<hashKeys.length) { 
    446446        String token = t.nextToken(); 
     447        if (token.equals("um")) tNum = 5; 
    447448        while ((tNum == 1 || tNum == 2) && !token.trim().equals("0")) { 
    448449          tNum++; 
     
    455456        addMeta(hashKeys[tNum], token); 
    456457        if (hashKeys[tNum].equals("Image Width")) { 
    457           core.sizeX[0] = Integer.parseInt(token); 
     458          try { 
     459            core.sizeX[0] = Integer.parseInt(token); 
     460          } 
     461          catch (NumberFormatException e) { 
     462            if (debug) LogTools.trace(e); 
     463          } 
    458464        } 
    459465        else if (hashKeys[tNum].equals("Image Length")) { 
    460           core.sizeY[0] = Integer.parseInt(token); 
     466          try { 
     467            core.sizeY[0] = Integer.parseInt(token); 
     468          } 
     469          catch (NumberFormatException e) { 
     470            if (debug) LogTools.trace(e); 
     471          } 
    461472        } 
    462473        else if (hashKeys[tNum].equals("Number of slices")) { 
    463           core.sizeZ[0] = Integer.parseInt(token); 
     474          try { 
     475            core.sizeZ[0] = Integer.parseInt(token); 
     476          } 
     477          catch (NumberFormatException e) { 
     478            if (debug) LogTools.trace(e); 
     479          } 
    464480        } 
    465481        else if (hashKeys[tNum].equals("Experiment details:")) details = token; 
     
    715731    // parse details to get number of wavelengths and timepoints 
    716732 
    717     core.sizeC[0] = 1; 
    718     core.sizeT[0] = 1; 
    719     core.sizeZ[0] = 1; 
    720  
    721733    if (details != null) { 
    722734      t = new StringTokenizer(details); 
     
    763775    } 
    764776 
     777    if (core.sizeZ[0] <= 0) core.sizeZ[0] = 1; 
     778    if (core.sizeC[0] <= 0) core.sizeC[0] = 1; 
     779 
    765780    if (core.sizeT[0] <= 0) { 
    766781      core.sizeT[0] = core.imageCount[0] / (core.sizeZ[0] * core.sizeC[0]); 
    767782    } 
    768783    else { 
    769       core.imageCount[0] = (isTiff ? tiff[0].getEffectiveSizeC() : 
    770         core.sizeC[0]) * core.sizeZ[0] * core.sizeT[0]; 
     784      core.imageCount[0] = core.sizeC[0] * core.sizeZ[0] * core.sizeT[0]; 
     785      if (core.imageCount[0] > files.length) { 
     786        core.imageCount[0] = files.length; 
     787        core.sizeT[0] = core.imageCount[0] / (core.sizeZ[0] * core.sizeC[0]); 
     788      } 
    771789    } 
    772790 
Note: See TracChangeset for help on using the changeset viewer.