Changeset 1242


Ignore:
Timestamp:
08/11/06 13:33:41 (14 years ago)
Author:
melissa
Message:
  • fixed jikes warnings
  • fixed Leica LIF bugs
  • tweaked FormatReader
Location:
trunk/loci/formats
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/FormatReader.java

    r1240 r1242  
    217217    if (rgb && !separated) { 
    218218      // adjust for RGB merging 
    219       c /= 3; 
    220       sizeC /= 3; 
     219      c = 1; 
     220      sizeC = 1; 
    221221    } 
    222222 
     
    289289    int origSizeC = sizeC; 
    290290    boolean rgb = isRGB(id); 
    291     if (rgb && !separated) sizeC /= 3; // adjust for RGB merging 
     291    if (rgb && !separated) sizeC = 1; // adjust for RGB merging 
    292292 
    293293    // get SizeT 
  • trunk/loci/formats/IFormatHandler.java

    r1240 r1242  
    3232   * Checks if the given string is a valid filename for this file format. 
    3333   */ 
    34   public boolean isThisType(String name); 
     34  boolean isThisType(String name); 
    3535 
    3636  /** Gets the name of this file format. */ 
    37   public String getFormat(); 
     37  String getFormat(); 
    3838 
    3939  /** Gets the default file suffixes for this file format. */ 
    40   public String[] getSuffixes(); 
     40  String[] getSuffixes(); 
    4141 
    4242  /** Gets file filters for this file format, for use with a JFileChooser. */ 
    43   public FileFilter[] getFileFilters(); 
     43  FileFilter[] getFileFilters(); 
    4444 
    4545  /** Gets a JFileChooser that recognizes accepted file types. */ 
    46   public JFileChooser getFileChooser(); 
     46  JFileChooser getFileChooser(); 
    4747} 
  • trunk/loci/formats/IFormatReader.java

    r1240 r1242  
    3535public interface IFormatReader extends IFormatHandler { 
    3636  /** Checks if the given block is a valid header for this file format. */ 
    37   public boolean isThisType(byte[] block); 
     37  boolean isThisType(byte[] block); 
    3838 
    3939  /** Determines the number of images in the given file. */ 
    40   public int getImageCount(String id) 
     40  int getImageCount(String id) 
    4141    throws FormatException, IOException; 
    4242 
    4343  /** Checks if the images in the file are RGB. */ 
    44   public boolean isRGB(String id) 
     44  boolean isRGB(String id) 
    4545    throws FormatException, IOException; 
    4646 
    4747  /** Get the size of the X dimension. */ 
    48   public int getSizeX(String id) throws FormatException, IOException; 
     48  int getSizeX(String id) throws FormatException, IOException; 
    4949 
    5050  /** Get the size of the Y dimension. */ 
    51   public int getSizeY(String id) throws FormatException, IOException; 
     51  int getSizeY(String id) throws FormatException, IOException; 
    5252 
    5353  /** Get the size of the Z dimension. */ 
    54   public int getSizeZ(String id) throws FormatException, IOException; 
     54  int getSizeZ(String id) throws FormatException, IOException; 
    5555 
    5656  /** Get the size of the C dimension. */ 
    57   public int getSizeC(String id) throws FormatException, IOException; 
     57  int getSizeC(String id) throws FormatException, IOException; 
    5858 
    5959  /** Get the size of the T dimension. */ 
    60   public int getSizeT(String id) throws FormatException, IOException; 
     60  int getSizeT(String id) throws FormatException, IOException; 
    6161 
    6262  /** Return true if the data is in little-endian format. */ 
    63   public boolean isLittleEndian(String id) 
     63  boolean isLittleEndian(String id) 
    6464    throws FormatException, IOException; 
    6565 
     
    6868   * within the file. 
    6969   */ 
    70   public String getDimensionOrder(String id) 
     70  String getDimensionOrder(String id) 
    7171    throws FormatException, IOException; 
    7272 
    7373  /** Obtains the specified image from the given file. */ 
    74   public BufferedImage openImage(String id, int no) 
     74  BufferedImage openImage(String id, int no) 
    7575    throws FormatException, IOException; 
    7676 
     
    7878   * Obtains the specified image from the given file as a byte array. 
    7979   */ 
    80   public byte[] openBytes(String id, int no) 
     80  byte[] openBytes(String id, int no) 
    8181    throws FormatException, IOException; 
    8282 
    8383  /** Closes the currently open file. */ 
    84   public void close() throws FormatException, IOException; 
     84  void close() throws FormatException, IOException; 
    8585 
    8686 
     
    9090   * @return Java Images containing pixel data 
    9191   */ 
    92   public BufferedImage[] openImage(String id) 
     92  BufferedImage[] openImage(String id) 
    9393    throws FormatException, IOException; 
    9494 
     
    9898   * image plane, it will be left as RGB and not split into 3 separate planes. 
    9999   */ 
    100   public void setSeparated(boolean separate); 
     100  void setSeparated(boolean separate); 
    101101 
    102102  /** Gets whether channels are being separated. */ 
    103   public boolean isSeparated(); 
     103  boolean isSeparated(); 
    104104 
    105105  /** 
     
    107107   * to the given Z, C and T coordinates. 
    108108   */ 
    109   public int getIndex(String id, int z, int c, int t) 
     109  int getIndex(String id, int z, int c, int t) 
    110110    throws FormatException, IOException; 
    111111 
     
    114114   * to the given rasterized index value. 
    115115   */ 
    116   public int[] getZCTCoords(String id, int index) 
     116  int[] getZCTCoords(String id, int index) 
    117117    throws FormatException, IOException; 
    118118 
     
    123123   * @return the value, or null if the field doesn't exist 
    124124   */ 
    125   public Object getMetadataValue(String id, String field) 
     125  Object getMetadataValue(String id, String field) 
    126126    throws FormatException, IOException; 
    127127 
     
    133133   * @return the hashtable containing all metadata from the file 
    134134   */ 
    135   public Hashtable getMetadata(String id) throws FormatException, IOException; 
     135  Hashtable getMetadata(String id) throws FormatException, IOException; 
     136   
    136137  /** 
    137138   * Sets the default metadata store for this reader. 
     
    139140   * @param store a metadata store implementation. 
    140141   */ 
    141   public void setMetadataStore(MetadataStore store); 
     142  void setMetadataStore(MetadataStore store); 
    142143 
    143144  /** 
     
    147148   * @return a metadata store implementation. 
    148149   */ 
    149   public MetadataStore getMetadataStore(String id) 
     150  MetadataStore getMetadataStore(String id) 
    150151    throws FormatException, IOException; 
    151152 
     
    161162   * unsupported type. 
    162163   */ 
    163   public Object getMetadataStoreRoot(String id) 
     164  Object getMetadataStoreRoot(String id) 
    164165    throws FormatException, IOException; 
    165166 
     
    168169   * and displaying the results in a simple display. 
    169170   */ 
    170   public boolean testRead(String[] args) throws FormatException, IOException; 
     171  boolean testRead(String[] args) throws FormatException, IOException; 
    171172} 
  • trunk/loci/formats/LociImporter.java

    r1138 r1242  
    115115    IJ.showStatus("Opening " + fileName); 
    116116    try { 
    117       FormatReader r = reader.getReader(id); 
     117      FormatReader r = (FormatReader) reader.getReader(id); 
    118118      FileStitcher fs = new FileStitcher(r); 
    119119      ChannelMerger cm = new ChannelMerger(stitchFiles ? fs : r); 
     
    159159              System.arraycopy(tmp, 0, s, 0, s.length); 
    160160            } 
     161            /* debug */ System.out.println("w*h : " + (w*h)); 
     162            /* debug */ System.out.println("pixels.length : " + s.length); 
    161163            ip = new ShortProcessor(w, h, s, null); 
    162164            if (stackS == null) stackS = new ImageStack(w, h); 
  • trunk/loci/formats/in/LIFReader.java

    r1200 r1242  
    138138    } 
    139139 
    140     if (zSum > tSum) return getImageCount(id); 
     140    if (zSum > tSum) return getImageCount(id) / (separated ? getSizeC(id) : 1); 
    141141    else return 1; 
    142142  } 
     
    152152    if (!id.equals(currentId)) initFile(id); 
    153153    int z = getSizeZ(id); 
    154     if (z == 1) return getImageCount(id); 
     154    if (z == 1) return getImageCount(id) / (separated ? getSizeC(id) : 1); 
    155155    else return 1; 
    156156  } 
     
    212212    } 
    213213 
    214     in.seek(offset + width * height * bytesPerPixel * imageNum); 
     214    in.seek(offset + width * height * bytesPerPixel * imageNum * c); 
    215215 
    216216    byte[] data = new byte[(int) (width * height * bytesPerPixel * c)]; 
     
    218218 
    219219    if (isRGB(id) && separated) { 
    220       return ImageTools.splitChannels(data, 3, false, true)[no % 3]; 
     220      return ImageTools.splitChannels(data, c, false, true)[no % c]; 
    221221    } 
    222222    else { 
     
    299299    numImages = offsets.size(); 
    300300    initMetadata(xml); 
     301    if (dims[0][4] == 2) numImages /= 2; 
    301302  } 
    302303 
Note: See TracChangeset for help on using the changeset viewer.