Changeset 7148


Ignore:
Timestamp:
11/01/10 17:05:55 (9 years ago)
Author:
melissa
Message:

A few fixes for writing planes non-sequentially.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2/components/bio-formats/src/loci/formats/out/OMETiffWriter.java

    r7145 r7148  
    7676 
    7777  private ArrayList<Integer> seriesMap; 
    78   private boolean wroteLast; 
    7978  private String[][] imageLocations; 
    80   private int totalPlanes = 0; 
    8179  private OMEXMLMetadata omeMeta; 
    8280  private OMEXMLService service; 
     
    9492  public void close() throws IOException { 
    9593    try { 
    96       if (currentId != null && wroteLast) { 
     94      if (currentId != null) { 
    9795        setupServiceAndMetadata(); 
    9896 
     
    108106        for (String[] s : imageLocations) { 
    109107          for (String f : s) { 
    110             if (!files.contains(f)) { 
     108            if (!files.contains(f) && f != null) { 
    111109              files.add(f); 
    112110 
     
    134132    finally { 
    135133      super.close(); 
    136       if (wroteLast) { 
    137         seriesMap = null; 
    138         imageLocations = null; 
    139         wroteLast = false; 
    140         totalPlanes = 0; 
    141         omeMeta = null; 
    142         service = null; 
    143         ifdCounts.clear(); 
    144       } 
     134      seriesMap = null; 
     135      imageLocations = null; 
     136      omeMeta = null; 
     137      service = null; 
     138      ifdCounts.clear(); 
    145139    } 
    146140  } 
     
    161155    super.saveBytes(no, buf, x, y, w, h); 
    162156 
    163     int index = totalPlanes; 
     157    int index = no; 
    164158    int currentSeries = series; 
    165159    for (int s=0; s<currentSeries; s++) { 
     
    170164 
    171165    imageLocations[series][index] = currentId; 
    172     totalPlanes++; 
    173  
    174     wroteLast = series == r.getImageCount() - 1 && index == planeCount() - 1; 
    175166  } 
    176167 
     
    302293      } 
    303294 
    304       String filename = 
    305         new Location(imageLocations[series][planeIndex]).getName(); 
     295      String filename = imageLocations[series][planeIndex]; 
     296      if (filename == null) filename = currentId; 
     297      filename = new Location(filename).getName(); 
    306298 
    307299      Integer ifdIndex = ifdCounts.get(filename); 
  • trunk/components/bio-formats/src/loci/formats/out/OMETiffWriter.java

    r7147 r7148  
    7676 
    7777  private ArrayList<Integer> seriesMap; 
    78   private boolean wroteLast; 
    7978  private String[][] imageLocations; 
    80   private int totalPlanes = 0; 
    8179  private OMEXMLMetadata omeMeta; 
    8280  private OMEXMLService service; 
     
    9492  public void close() throws IOException { 
    9593    try { 
    96       if (currentId != null && wroteLast) { 
     94      if (currentId != null) { 
    9795        setupServiceAndMetadata(); 
    9896 
     
    108106        for (String[] s : imageLocations) { 
    109107          for (String f : s) { 
    110             if (!files.contains(f)) { 
     108            if (!files.contains(f) && f != null) { 
    111109              files.add(f); 
    112110 
     
    134132    finally { 
    135133      super.close(); 
    136       if (wroteLast) { 
    137         seriesMap = null; 
    138         imageLocations = null; 
    139         wroteLast = false; 
    140         totalPlanes = 0; 
    141         omeMeta = null; 
    142         service = null; 
    143         ifdCounts.clear(); 
    144       } 
     134      seriesMap = null; 
     135      imageLocations = null; 
     136      omeMeta = null; 
     137      service = null; 
     138      ifdCounts.clear(); 
    145139    } 
    146140  } 
     
    161155    super.saveBytes(no, buf, x, y, w, h); 
    162156 
    163     int index = totalPlanes; 
     157    int index = no; 
    164158    int currentSeries = series; 
    165159    for (int s=0; s<currentSeries; s++) { 
     
    170164 
    171165    imageLocations[series][index] = currentId; 
    172     totalPlanes++; 
    173  
    174     wroteLast = series == r.getImageCount() - 1 && index == planeCount() - 1; 
    175166  } 
    176167 
     
    302293      } 
    303294 
    304       String filename = 
    305         new Location(imageLocations[series][planeIndex]).getName(); 
     295      String filename = imageLocations[series][planeIndex]; 
     296      if (filename == null) filename = currentId; 
     297      filename = new Location(filename).getName(); 
    306298 
    307299      Integer ifdIndex = ifdCounts.get(filename); 
Note: See TracChangeset for help on using the changeset viewer.