Changeset 7428


Ignore:
Timestamp:
12/16/10 15:48:02 (9 years ago)
Author:
melissa
Message:
  • Added setValidBitsPerPixel(int) to IFormatWriter.
  • Updated ICSWriter to correctly save physical sizes and valid bits per pixel. Closes #611.
Location:
trunk/components
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/FormatWriter.java

    r7225 r7428  
    6969  protected boolean interleaved; 
    7070 
     71  /** The number of valid bits per pixel. */ 
     72  protected int validBits; 
     73 
    7174  /** Current series. */ 
    7275  protected int series; 
     
    157160  public boolean isInterleaved() { 
    158161    return interleaved; 
     162  } 
     163 
     164  /* @see IFormatWriter#setValidBitsPerPixel(int) */ 
     165  public void setValidBitsPerPixel(int bits) { 
     166    validBits = bits; 
    159167  } 
    160168 
  • trunk/components/bio-formats/src/loci/formats/IFormatWriter.java

    r6881 r7428  
    102102  void setInterleaved(boolean interleaved); 
    103103 
     104  /** Sets the number of valid bits per pixel. */ 
     105  void setValidBitsPerPixel(int bits); 
     106 
    104107  /** Gets whether or not the channels in an image are interleaved. */ 
    105108  boolean isInterleaved(); 
  • trunk/components/bio-formats/src/loci/formats/ImageWriter.java

    r6881 r7428  
    233233  } 
    234234 
     235  /* @see IFormatWriter#setValidBitsPerPixel(int) */ 
     236  public void setValidBitsPerPixel(int bits) { 
     237    for (IFormatWriter writer : writers) { 
     238      writer.setValidBitsPerPixel(bits); 
     239    } 
     240  } 
     241 
    235242  /* @see IFormatWriter#canDoStacks() */ 
    236243  public boolean canDoStacks() { 
  • trunk/components/bio-formats/src/loci/formats/WriterWrapper.java

    r6881 r7428  
    183183  } 
    184184 
     185  public void setValidBitsPerPixel(int bits) { 
     186    writer.setValidBitsPerPixel(bits); 
     187  } 
     188 
    185189  public boolean canDoStacks() { 
    186190    return writer.canDoStacks(); 
  • trunk/components/bio-formats/src/loci/formats/in/ICSReader.java

    r7055 r7428  
    441441          } 
    442442        } 
     443        else if (k.equalsIgnoreCase("layout significant_bits")) { 
     444          core[0].bitsPerPixel = Integer.parseInt(v); 
     445        } 
    443446        else if (k.equalsIgnoreCase("representation byte_order")) { 
    444447          byteOrder = v; 
  • trunk/components/bio-formats/src/loci/formats/out/ICSWriter.java

    r7225 r7428  
    141141      dimensionLength = (int) (out.getFilePointer() - dimensionOffset); 
    142142 
     143      if (validBits != 0) { 
     144        out.writeBytes("layout\tsignificant_bits\t" + validBits + "\n"); 
     145      } 
     146 
    143147      boolean signed = FormatTools.isSigned(pixelType); 
    144148      boolean littleEndian = 
     
    161165 
    162166      out.writeBytes("\nparameter\tscale\t1.000000\t"); 
    163       String order = meta.getPixelsDimensionOrder(series).toString(); 
     167      String order = meta.getPixelsDimensionOrder(series).getValue(); 
    164168      StringBuffer units = new StringBuffer(); 
    165169      for (int i=0; i<order.length(); i++) { 
    166170        char dim = order.charAt(i); 
    167171        Number value = 1.0; 
    168         if (dim == 'x') { 
     172        if (dim == 'X') { 
    169173          value = meta.getPixelsPhysicalSizeX(0); 
    170174          units.append("micrometers\t"); 
    171175        } 
    172         else if (dim == 'y') { 
     176        else if (dim == 'Y') { 
    173177          value = meta.getPixelsPhysicalSizeY(0); 
    174178          units.append("micrometers\t"); 
    175179        } 
    176         else if (dim == 'z') { 
     180        else if (dim == 'Z') { 
    177181          value = meta.getPixelsPhysicalSizeZ(0); 
    178182          units.append("micrometers\t"); 
    179183        } 
    180         else if (dim == 't') { 
     184        else if (dim == 'T') { 
    181185          value = meta.getPixelsTimeIncrement(0); 
    182186          units.append("seconds\t"); 
  • trunk/components/bio-formats/src/loci/formats/tools/ImageConverter.java

    r7402 r7428  
    257257      writer.setSeries(q); 
    258258      writer.setInterleaved(reader.isInterleaved()); 
     259      writer.setValidBitsPerPixel(reader.getBitsPerPixel()); 
    259260      int numImages = writer.canDoStacks() ? reader.getImageCount() : 1; 
    260261      total += numImages; 
  • trunk/components/loci-plugins/src/loci/plugins/out/Exporter.java

    r7149 r7428  
    354354      w.setMetadataRetrieve(store); 
    355355 
     356      String imageInfo = imp.getProperty("Info").toString(); 
     357      if (imageInfo != null) { 
     358        String[] lines = imageInfo.split("\n"); 
     359        for (String line : lines) { 
     360          int eq = line.lastIndexOf("="); 
     361          if (eq > 0) { 
     362            String key = line.substring(0, eq).trim(); 
     363            String value = line.substring(eq + 1).trim(); 
     364 
     365            if (key.endsWith("BitsPerPixel")) { 
     366              w.setValidBitsPerPixel(Integer.parseInt(value)); 
     367              break; 
     368            } 
     369          } 
     370        } 
     371      } 
     372 
    356373      w.setId(outfile); 
    357374 
Note: See TracChangeset for help on using the changeset viewer.