Changeset 6282


Ignore:
Timestamp:
05/11/10 17:07:01 (10 years ago)
Author:
bdezonia
Message:

Fixed swapdims test to handle all pixel formats.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/loci-plugins/test/loci/plugins/in/ImporterTest.java

    r6281 r6282  
    1010import static org.junit.Assert.fail;  
    1111 
     12import java.io.IOException; 
     13import java.lang.reflect.Field; 
     14 
    1215import ij.ImagePlus; 
    1316import ij.ImageStack; 
    14 import ij.process.FloatProcessor; 
    1517import ij.process.ImageProcessor; 
    16  
    17 import java.io.IOException; 
    18 import java.lang.reflect.Field; 
    1918 
    2019import loci.common.Location; 
     
    117116 
    118117  /** Series number of the given image processor. */ 
    119   private int sIndex(ImageProcessor proc) { return getPixel(proc, 0, 0);  } 
     118  private int sIndex(ImageProcessor proc) { return (int) proc.getPixelValue(0, 0);  } 
    120119 
    121120  /** Image number of the given image processor. */ 
    122   private int iIndex(ImageProcessor proc) { return getPixel(proc, 10, 0); } 
     121  private int iIndex(ImageProcessor proc) { return (int) proc.getPixelValue(10, 0); } 
    123122 
    124123  /** Slice number of the given image processor. */ 
    125   private int zIndex(ImageProcessor proc) { return getPixel(proc, 20, 0); } 
     124  private int zIndex(ImageProcessor proc) { return (int) proc.getPixelValue(20, 0); } 
    126125 
    127126  /** Channel number of the given image processor. */ 
    128   private int cIndex(ImageProcessor proc) { return getPixel(proc, 30, 0); } 
     127  private int cIndex(ImageProcessor proc) { return (int) proc.getPixelValue(30, 0); } 
    129128 
    130129  /** Frame number of the given image processor. */ 
    131   private int tIndex(ImageProcessor proc) { return getPixel(proc, 40, 0); } 
    132  
    133   private int getPixel(ImageProcessor proc, int x, int y) { 
    134     // NB: FloatProcessor returns the raw int bits when get(int, int) is 
    135     // called; to get actual value, we must call getf(int, int) and cast. 
    136     if (proc instanceof FloatProcessor) { 
    137       return (int) ((FloatProcessor) proc).getf(x, y); 
    138     } 
    139     return proc.get(x, y); 
    140   } 
    141    
     130  private int tIndex(ImageProcessor proc) { return (int) proc.getPixelValue(40, 0); } 
     131 
    142132  @SuppressWarnings("unused") 
    143133  private void printVals(ImageProcessor proc) 
     
    709699    datasetSwapDimsTest(FormatTools.UINT16, 82, 47, 5, 2); 
    710700    datasetSwapDimsTest(FormatTools.UINT32, 82, 47, 5, 2); 
    711     //128:datasetSwapDimsTest(FormatTools.INT8, 44, 109, 1, 4); 
    712     //32768:datasetSwapDimsTest(FormatTools.INT16, 44, 109, 2, 1); 
     701    datasetSwapDimsTest(FormatTools.INT8, 44, 109, 1, 4); 
     702    datasetSwapDimsTest(FormatTools.INT16, 44, 109, 2, 1); 
    713703    datasetSwapDimsTest(FormatTools.INT32, 44, 109, 4, 3); 
    714704    datasetSwapDimsTest(FormatTools.UINT8, 82, 47, 3, 2); 
Note: See TracChangeset for help on using the changeset viewer.