Changeset 1884


Ignore:
Timestamp:
11/30/06 11:30:53 (13 years ago)
Author:
melissa
Message:

Fixed some stuff in ZeissZVIReader - 16-bit RGB data is now detected properly, and openBytes will always return an array of the proper length.

File:
1 edited

Legend:

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

    r1806 r1884  
    55/* 
    66LOCI Bio-Formats package for reading and converting biological file formats. 
    7 Copyright (C) 2005-@year@ Melissa Linkert, Curtis Rueden, Chris Allan 
     7Copyright (C) 2005-2006 Melissa Linkert, Curtis Rueden, Chris Allan 
    88and Eric Kjellman. 
    99 
     
    279279      } 
    280280      b = null; 
     281       
     282      if (a.length != bpp * sizeX[0] * sizeY[0]) { 
     283        byte[] tmp = a; 
     284        a = new byte[bpp * sizeX[0] * sizeY[0]]; 
     285        System.arraycopy(tmp, 0, a, 0, a.length); 
     286      } 
     287 
     288      Object type = metadata.get("PixelType"); 
     289      if (type == null || type.toString().trim().equals("1")) { 
     290        byte[] tmp = a; 
     291        a = new byte[tmp.length]; 
     292        for (int i=0; i<tmp.length / 3; i++) { 
     293          a[i] = tmp[i*3]; 
     294          a[i + tmp.length / 3] = tmp[i*3 + 1]; 
     295          a[i + ((2*tmp.length) / 3)] = tmp[i*3 + 2]; 
     296        } 
     297      } 
    281298      return a; 
    282299    } 
     
    432449    store.setImage((String) metadata.get("File Name"), null, null, null); 
    433450 
    434     switch (bpp % 3) { 
    435       case 0: 
    436       case 1: 
    437         pixelType[0] = FormatReader.UINT8; 
    438         break; 
    439       case 2: 
    440         pixelType[0] = FormatReader.UINT16; 
    441         break; 
    442     } 
     451    if (bpp == 1 || bpp == 3) pixelType[0] = FormatReader.UINT8; 
     452    else if (bpp == 2 || bpp == 6) pixelType[0] = FormatReader.UINT16; 
    443453 
    444454    store.setPixels( 
Note: See TracChangeset for help on using the changeset viewer.