Changeset 6471


Ignore:
Timestamp:
06/03/10 17:18:50 (10 years ago)
Author:
bdezonia
Message:

in middle of writing testColorColorizedSubcases() - incomplete

File:
1 edited

Legend:

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

    r6456 r6471  
    3232import loci.plugins.BF; 
    3333import loci.plugins.in.ImporterOptions; 
    34  
    3534 
    3635// TODO 
     
    5150//  - add some tests for combination of options 
    5251//      comboConcatSplit() - done but not passing 
    53 //      comboManyOptions 
     52//      comboManyOptions - done and passing 
    5453//      other combo tests - rely on color code working. Waiting for BF. 
    55 //  - comboCropAutoscale() - autoscale of a cropped image returning min of whole image 
     54//  - comboCropAutoscale() - done but not passing : autoscale of a cropped image returning min of whole image 
    5655 
    5756// would be nice to address before release 
     
    6059//    - memoryRecord failure (needs BF code fix) 
    6160//    - open individual files: try to come up with a way to test without a disk file as source 
    62 //    - swapped dims test needs to test cases other than from default swapping Z & T 
    6361//    - output stack order - testing of iIndex? should match imagestack number? i.e. 5th plane == 4 - doesn't look so 
    6462//    - improve, comment, and generalize code for increased coverage 
     
    9088 
    9189    //String template = "test_C%s_TP%s&sizeX=50&sizeY=20&sizeZ=7.fake"; 
    92     String template = constructFakeFilename("test_C%s_TP%s", FormatTools.INT32, 50, 20, 7, 1, 1, -1, false, -1, false); 
     90    String template = constructFakeFilename("test_C%s_TP%s", FormatTools.INT32, 50, 20, 7, 1, 1, -1, false, -1, false, -1); 
    9391                                                                        // BDZ - INT32 is desirable for the color tests 
    9492     
     
    122120  private static String constructFakeFilename(String title, 
    123121      int pixelType, int sizeX, int sizeY, int sizeZ, int sizeC, int sizeT, int numSeries, 
    124       boolean indexed, int rgb, boolean falseColor) 
     122      boolean indexed, int rgb, boolean falseColor, int lutLength) 
    125123  { 
    126124    // some tests rely on each image being large enough to get the s,i,z,t,c index pixels of a 
     
    143141    if (rgb != -1) fileName += "&rgb=" + rgb; 
    144142    if (falseColor) fileName += "&falseColor=true"; 
     143    if (lutLength > 0) fileName += "&lutLength=" + lutLength; 
    145144    fileName += ".fake"; 
    146145     
     
    354353    int rawValue = iIndex(ci.getProcessor()); 
    355354    //int rawValue = iIndex(ci.getProcessor(c+1)); 
    356     //System.out.println("zct "+z+" "+c+" "+t+" rawVal "+rawValue); 
    357355    if (indexed) 
    358       return ci.getChannelLut(c+1).getRGB(rawValue); 
     356    { 
     357      LUT lut = ci.getChannelLut(c+1); 
     358       
     359      int retVal = lut.getRGB(rawValue) & 0xffffff; 
     360       
     361      System.out.println("    zct "+z+" "+c+" "+t+" rawVal "+rawValue); 
     362      System.out.println("    A "+lut.getAlpha(rawValue)+" R "+lut.getRed(rawValue)+" G "+lut.getGreen(rawValue)+" B "+lut.getBlue(rawValue)); 
     363       
     364      return retVal; 
     365    } 
    359366    else 
    360367      return rawValue; 
     
    416423  private void defaultBehaviorTest(int pixType, int x, int y, int z, int c, int t) 
    417424  { 
    418     String path = constructFakeFilename("default", pixType, x, y, z, c, t, -1, false, -1, false); 
     425    String path = constructFakeFilename("default", pixType, x, y, z, c, t, -1, false, -1, false, -1); 
    419426    ImagePlus[] imps = null; 
    420427     
     
    441448    String chOrder = order.toString(); 
    442449     
    443     String path = constructFakeFilename("stack", pixType, x, y, z, c, t, -1, false, -1, false); 
     450    String path = constructFakeFilename("stack", pixType, x, y, z, c, t, -1, false, -1, false, -1); 
    444451     
    445452    ImagePlus[] imps = null; 
     
    496503    int c = 3; 
    497504    ChannelOrder swappedOrder = ChannelOrder.TCZ; // original order is ZCT 
    498     String path = constructFakeFilename("swapDims", pixType, x, y, z, c, t, -1, false, -1, false); 
     505    String path = constructFakeFilename("swapDims", pixType, x, y, z, c, t, -1, false, -1, false, -1); 
    499506    ImagePlus[] imps = null; 
    500507    try { 
     
    548555  private void datasetOpenAllSeriesTest(int x, int y, int z, int c, int t, int s) 
    549556  { 
    550     String path = constructFakeFilename("openAllSeries", FormatTools.UINT32, x, y, z, c, t, s, false, -1, false); 
     557    String path = constructFakeFilename("openAllSeries", FormatTools.UINT32, x, y, z, c, t, s, false, -1, false, -1); 
    551558     
    552559    // try it when false 
     
    604611    // open all series as one 
    605612     
    606     String path = constructFakeFilename("concat", pixType, x, y, z, c, t, s, false, -1, false); 
     613    String path = constructFakeFilename("concat", pixType, x, y, z, c, t, s, false, -1, false, -1); 
    607614    ImagePlus[] imps = null; 
    608615    try { 
     
    647654  { 
    648655    final int sizeZ = 2, sizeC = 3, sizeT = 4, sizeX = 51, sizeY = 16; 
    649     final String path = constructFakeFilename("autoscale",pixType, sizeX, sizeY, sizeZ, sizeC, sizeT, -1, false, -1, false); 
     656    final String path = constructFakeFilename("autoscale",pixType, sizeX, sizeY, sizeZ, sizeC, sizeT, -1, false, -1, false, -1); 
    650657     
    651658    ImagePlus[] imps = null; 
     
    719726     
    720727    String path = constructFakeFilename("colorComposite", pixType, sizeX, sizeY, sizeZ, sizeC, sizeT, numSeries, 
    721         indexed, rgb, falseColor); 
     728        indexed, rgb, falseColor, -1); 
    722729     
    723730    ImagePlus[] imps = null; 
     
    738745    } 
    739746 
     747    // TODO - notice I pass in numSeries but don't test it below : no for loop for it. 
     748     
    740749    impsCountTest(imps,1); 
    741750     
     
    764773     
    765774    // check that each image in the overall series has the correct iIndex value 
    766     for (int z = 0; z < ci.getNSlices(); z++) 
    767       for (int c = 0; c < ci.getNChannels(); c++) 
    768         for (int t = 0; t < ci.getNFrames(); t++) 
     775    for (int z = 0; z < maxZ; z++) 
     776      for (int c = 0; c < maxC; c++) 
     777        for (int t = 0; t < maxT; t++) 
    769778        { 
    770           assertEquals((maxZ*maxC*t + maxC*z + c), getIndexPixelValue(ci,z,c,t,indexed));  // CZT order 
     779          assertEquals((maxZ*maxC*t + maxC*z + c), getIndexPixelValue(ci,z,c,t,indexed));  // expected value from CZT order 
    771780        } 
    772781  } 
    773782   
     783  private void colorColorizedTest() 
     784  { 
     785    // TODO: temp first attempt: sizeC == 1 and rgb matches 
     786     
     787    int sizeX = 100, sizeY = 120, sizeZ = 1, sizeC = 1, sizeT = 1, numSeries = 1, rgb = 1; 
     788    boolean indexed = true; 
     789     
     790    String path = constructFakeFilename("colorColorized", FormatTools.UINT8, sizeX, sizeY, sizeZ, sizeC, sizeT, numSeries, indexed, rgb, false, -1); 
     791     
     792    ImagePlus[] imps = null; 
     793    ImagePlus imp = null; 
     794    CompositeImage ci = null; 
     795     
     796    try { 
     797      ImporterOptions options = new ImporterOptions(); 
     798      options.setColorMode(ImporterOptions.COLOR_MODE_COLORIZED); 
     799      options.setId(path); 
     800      imps = BF.openImagePlus(options); 
     801    } 
     802    catch (IOException e) { 
     803      fail(e.getMessage()); 
     804    } 
     805    catch (FormatException e) { 
     806      fail(e.getMessage()); 
     807    } 
     808 
     809    impsCountTest(imps,1); 
     810     
     811    imp = imps[0]; 
     812     
     813    xyzctTest(imp,sizeX,sizeY,sizeZ,sizeC,sizeT); 
     814     
     815    assertTrue(imp.isComposite()); 
     816     
     817    ci = (CompositeImage)imp; 
     818     
     819    assertFalse(ci.hasCustomLuts()); 
     820 
     821    assertEquals(CompositeImage.COLOR, ci.getMode()); 
     822     
     823    colorTests(ci,sizeC,DefaultColorOrder); 
     824 
     825    fail("unfinished"); 
     826  } 
     827   
     828  private void colorGrayscaleTest() 
     829  { 
     830    int sizeX = 100, sizeY = 120, sizeZ = 2, sizeC = 7, sizeT = 4, numSeries = 3; 
     831     
     832    String path = constructFakeFilename("colorGrayscale", FormatTools.UINT8, sizeX, sizeY, sizeZ, sizeC, sizeT, numSeries, false, -1, false, -1); 
     833     
     834    ImagePlus[] imps = null; 
     835    ImagePlus imp = null; 
     836    CompositeImage ci = null; 
     837     
     838    try { 
     839      ImporterOptions options = new ImporterOptions(); 
     840      options.setColorMode(ImporterOptions.COLOR_MODE_GRAYSCALE); 
     841      options.setId(path); 
     842      imps = BF.openImagePlus(options); 
     843    } 
     844    catch (IOException e) { 
     845      fail(e.getMessage()); 
     846    } 
     847    catch (FormatException e) { 
     848      fail(e.getMessage()); 
     849    } 
     850 
     851    impsCountTest(imps,1); 
     852     
     853    imp = imps[0]; 
     854     
     855    xyzctTest(imp,sizeX,sizeY,sizeZ,sizeC,sizeT); 
     856     
     857    assertTrue(imp.isComposite()); 
     858     
     859    ci = (CompositeImage)imp; 
     860     
     861    assertFalse(ci.hasCustomLuts()); 
     862 
     863    assertEquals(CompositeImage.GRAYSCALE, ci.getMode()); 
     864 
     865    colorTests(ci,sizeC,DefaultColorOrder); 
     866 
     867    fail("unfinished"); 
     868  } 
     869 
    774870  private void colorCustomTest(int pixType, int sizeX, int sizeY, int sizeZ, int sizeC, int sizeT, int numSeries) 
    775871  { 
     
    780876    assertTrue(numSeries*sizeC*3 <= 25);  // slider limit in IJ 
    781877     
    782     String path = constructFakeFilename("colorCustom", pixType, sizeX, sizeY, sizeZ, sizeC, sizeT, numSeries, false, -1, false); 
     878    String path = constructFakeFilename("colorCustom", pixType, sizeX, sizeY, sizeZ, sizeC, sizeT, numSeries, false, -1, false, -1); 
    783879    ImagePlus[] imps = null; 
    784880    ImagePlus imp = null; 
     
    822918      int x = 604, y = 531, z = 7, c = 1, t = 1; 
    823919       
    824       String path = constructFakeFilename("vstack", FormatTools.UINT16, x, y, z, c, t, -1, false, -1, false); 
     920      String path = constructFakeFilename("vstack", FormatTools.UINT16, x, y, z, c, t, -1, false, -1, false, -1); 
    825921       
    826922      // open stack 
     
    850946  { 
    851947    int x = 50, y = 15, z = 3, c = 1, t = 1; 
    852     String path = constructFakeFilename("memRec", FormatTools.UINT8, x, y, z, c, t, -1, false, -1, false); 
     948    String path = constructFakeFilename("memRec", FormatTools.UINT8, x, y, z, c, t, -1, false, -1, false, -1); 
    853949    ImagePlus[] imps = null; 
    854950    ImagePlus imp = null; 
     
    901997  {  
    902998    int pixType = FormatTools.UINT8, x=50, y=5, s=-1; 
    903     String path = constructFakeFilename("range", pixType, x, y, z, c, t, s, false, -1, false); 
     999    String path = constructFakeFilename("range", pixType, x, y, z, c, t, s, false, -1, false, -1); 
    9041000    ImagePlus[] imps = null; 
    9051001    try { 
     
    9541050  private void memoryCropTest(int pixType, int x, int y, int cx, int cy) 
    9551051  { 
    956     String path = constructFakeFilename("crop", pixType, x, y, 1, 1, 1, 1, false, -1, false); 
     1052    String path = constructFakeFilename("crop", pixType, x, y, 1, 1, 1, 1, false, -1, false, -1); 
    9571053     
    9581054    // open image 
     
    9821078      int originCropX, int originCropY, int sizeCrop) 
    9831079  { 
    984     final String path = constructFakeFilename("cropAutoscale",pixType, sizeX, sizeY, sizeZ, sizeC, sizeT, numSeries, false, -1, false); 
     1080    final String path = constructFakeFilename("cropAutoscale",pixType, sizeX, sizeY, sizeZ, sizeC, sizeT, numSeries, false, -1, false, -1); 
    9851081     
    9861082    // needed for this test 
     
    10351131    final int sizeX = 50, sizeY = 20, sizeZ = 5, sizeC = 3, sizeT = 7, series = 3; 
    10361132    final String path = constructFakeFilename("concatSplitZ", 
    1037       FormatTools.UINT8, 50, 20, sizeZ, sizeC, sizeT, series, false, -1, false); 
     1133      FormatTools.UINT8, 50, 20, sizeZ, sizeC, sizeT, series, false, -1, false, -1); 
    10381134 
    10391135    // open image 
     
    10671163        for (int t = 0; t < sizeT; t++) { 
    10681164          for (int c = 0; c < sizeC; c++) { 
    1069             System.out.println("index "+index); 
     1165            //System.out.println("index "+index); 
    10701166            ImageProcessor proc = st.getProcessor(s*sizeT*sizeC + index++); 
    10711167            //System.out.println("s z c t "+s+" "+z+" "+c+" "+t); 
    1072             System.out.println("z c t "+z+" "+c+" "+t); 
    1073             System.out.println("is iz ic it "+sIndex(proc)+" "+zIndex(proc)+" "+cIndex(proc)+" "+tIndex(proc)); 
     1168            //System.out.println("z c t "+z+" "+c+" "+t); 
     1169            //System.out.println("is iz ic it "+sIndex(proc)+" "+zIndex(proc)+" "+cIndex(proc)+" "+tIndex(proc)); 
    10741170            // test the values 
    10751171            assertEquals(z,zIndex(proc)); 
     
    10901186    final int sizeX = 50, sizeY = 20, sizeZ = 5, sizeC = 3, sizeT = 7, series = 3; 
    10911187    final String path = constructFakeFilename("concatSplitC", 
    1092       FormatTools.UINT8, 50, 20, sizeZ, sizeC, sizeT, series, false, -1, false); 
     1188      FormatTools.UINT8, 50, 20, sizeZ, sizeC, sizeT, series, false, -1, false, -1); 
    10931189 
    10941190    // open image 
     
    11441240    final int sizeX = 50, sizeY = 20, sizeZ = 5, sizeC = 3, sizeT = 7, series = 3; 
    11451241    final String path = constructFakeFilename("concatSplitC", 
    1146       FormatTools.UINT8, 50, 20, sizeZ, sizeC, sizeT, series, false, -1, false); 
     1242      FormatTools.UINT8, 50, 20, sizeZ, sizeC, sizeT, series, false, -1, false, -1); 
    11471243 
    11481244    // open image 
     
    13271423    int sizeX = 100, sizeY = 120, sizeZ = 2, sizeC = 7, sizeT = 4, numSeries = 3; 
    13281424     
    1329     String path = constructFakeFilename("colorDefault", FormatTools.UINT8, sizeX, sizeY, sizeZ, sizeC, sizeT, numSeries, false, -1, false); 
     1425    String path = constructFakeFilename("colorDefault", FormatTools.UINT8, sizeX, sizeY, sizeZ, sizeC, sizeT, numSeries, false, -1, false, -1); 
    13301426     
    13311427    ImagePlus[] imps = null; 
     
    13901486  } 
    13911487   
    1392   private void colorColorizedTest() 
    1393   { 
    1394     // TODO: temp first attempt: sizeC == 1 and rgb matches 
    1395      
    1396     int sizeX = 100, sizeY = 120, sizeZ = 1, sizeC = 1, sizeT = 1, numSeries = 1, rgb = 1; 
    1397     boolean indexed = true; 
    1398      
    1399     String path = constructFakeFilename("colorColorized", FormatTools.UINT8, sizeX, sizeY, sizeZ, sizeC, sizeT, numSeries, indexed, rgb, false); 
    1400      
    1401     ImagePlus[] imps = null; 
    1402     ImagePlus imp = null; 
    1403     CompositeImage ci = null; 
    1404      
    1405     try { 
    1406       ImporterOptions options = new ImporterOptions(); 
    1407       options.setColorMode(ImporterOptions.COLOR_MODE_COLORIZED); 
    1408       options.setId(path); 
    1409       imps = BF.openImagePlus(options); 
    1410     } 
    1411     catch (IOException e) { 
    1412       fail(e.getMessage()); 
    1413     } 
    1414     catch (FormatException e) { 
    1415       fail(e.getMessage()); 
    1416     } 
    1417  
    1418     impsCountTest(imps,1); 
    1419      
    1420     imp = imps[0]; 
    1421      
    1422     xyzctTest(imp,sizeX,sizeY,sizeZ,sizeC,sizeT); 
    1423      
    1424     assertTrue(imp.isComposite()); 
    1425      
    1426     ci = (CompositeImage)imp; 
    1427      
    1428     assertFalse(ci.hasCustomLuts()); 
    1429  
    1430     assertEquals(CompositeImage.COLOR, ci.getMode()); 
    1431      
    1432     colorTests(ci,sizeC,DefaultColorOrder); 
    1433  
    1434     fail("unfinished"); 
    1435   } 
    1436    
    14371488  @Test 
    14381489  public void testColorColorized() 
     
    14441495  public void testColorGrayscale() 
    14451496  { 
    1446     int sizeX = 100, sizeY = 120, sizeZ = 2, sizeC = 7, sizeT = 4, numSeries = 3; 
    1447      
    1448     String path = constructFakeFilename("colorGrayscale", FormatTools.UINT8, sizeX, sizeY, sizeZ, sizeC, sizeT, numSeries, false, -1, false); 
    1449      
    1450     ImagePlus[] imps = null; 
    1451     ImagePlus imp = null; 
    1452     CompositeImage ci = null; 
    1453      
    1454     try { 
    1455       ImporterOptions options = new ImporterOptions(); 
    1456       options.setColorMode(ImporterOptions.COLOR_MODE_GRAYSCALE); 
    1457       options.setId(path); 
    1458       imps = BF.openImagePlus(options); 
    1459     } 
    1460     catch (IOException e) { 
    1461       fail(e.getMessage()); 
    1462     } 
    1463     catch (FormatException e) { 
    1464       fail(e.getMessage()); 
    1465     } 
    1466  
    1467     impsCountTest(imps,1); 
    1468      
    1469     imp = imps[0]; 
    1470      
    1471     xyzctTest(imp,sizeX,sizeY,sizeZ,sizeC,sizeT); 
    1472      
    1473     assertTrue(imp.isComposite()); 
    1474      
    1475     ci = (CompositeImage)imp; 
    1476      
    1477     assertFalse(ci.hasCustomLuts()); 
    1478  
    1479     assertEquals(CompositeImage.GRAYSCALE, ci.getMode()); 
    1480  
    1481     colorTests(ci,sizeC,DefaultColorOrder); 
    1482  
    1483     fail("unfinished"); 
     1497    colorGrayscaleTest(); 
    14841498  } 
    14851499   
     
    16921706    } 
    16931707     
    1694     /* TODO - enable when step by 0 code fixed and remove extra tests above 
    1695     // uber combo test : comprehensive but probably WAY too much computation to finish in reasonable time 
     1708    /* TODO - could replace above code with this uber combo test 
     1709    // comprehensive but probably WAY too much computation to finish in reasonable time 
    16961710    z = 6; c = 5; t = 4; 
    16971711    for (int zStart = -1; zStart < z+2; zStart++) 
     
    17481762    final int sizeX = 50, sizeY = 20, sizeZ = 5, sizeC = 3, sizeT = 7; 
    17491763    final String path = constructFakeFilename("splitC", 
    1750       FormatTools.UINT8, sizeX, sizeY, sizeZ, sizeC, sizeT, -1, false, -1, false); 
     1764      FormatTools.UINT8, sizeX, sizeY, sizeZ, sizeC, sizeT, -1, false, -1, false, -1); 
    17511765 
    17521766    // open image 
     
    17921806    final int sizeX = 50, sizeY = 20, sizeZ = 5, sizeC = 3, sizeT = 7; 
    17931807    final String path = constructFakeFilename("splitZ", 
    1794       FormatTools.UINT8, sizeX, sizeY, sizeZ, sizeC, sizeT, -1, false, -1, false); 
     1808      FormatTools.UINT8, sizeX, sizeY, sizeZ, sizeC, sizeT, -1, false, -1, false, -1); 
    17951809 
    17961810    // open image 
     
    18361850    final int sizeX = 50, sizeY = 20, sizeZ = 5, sizeC = 3, sizeT = 7; 
    18371851    final String path = constructFakeFilename("splitT", 
    1838       FormatTools.UINT8, 50, 20, sizeZ, sizeC, sizeT, -1, false, -1, false); 
     1852      FormatTools.UINT8, 50, 20, sizeZ, sizeC, sizeT, -1, false, -1, false, -1); 
    18391853 
    18401854    // open image 
     
    19311945    // note - to reuse existing code it is necessary that the crop origin is (0,0) 
    19321946     
    1933     String path = constructFakeFilename("superCombo", pixType, sizeX, sizeY, sizeZ, sizeC, sizeT, 1, false, -1, false); 
     1947    String path = constructFakeFilename("superCombo", pixType, sizeX, sizeY, sizeZ, sizeC, sizeT, 1, false, -1, false, -1); 
    19341948   
    19351949    ImagePlus[] imps = null; 
     
    19851999    } 
    19862000  } 
     2001 
     2002  private void colorColorizedTester(int pixType, int sizeC, int rgb, boolean indexed, boolean falseColor, int lutLen) 
     2003  { 
     2004    if ((pixType != FormatTools.UINT8) && (pixType != FormatTools.UINT16)) 
     2005      throw new IllegalArgumentException("colorColorizedTester(): passed an invalid pixelType: not UINT8 or UINT16 ("+pixType+")"); 
     2006 
     2007    if (sizeC % rgb != 0) 
     2008      throw new IllegalArgumentException("colorColorizedTester() passed a bad combo of sizeC and rgb: "+sizeC+" "+rgb); 
     2009 
     2010    int totalChannels = sizeC; 
     2011    int channelsPerPlane = rgb; 
     2012    int totalPlanes = totalChannels / channelsPerPlane; 
     2013 
     2014    // TODO: necessary? 
     2015    /* 
     2016    if (channelsPerPlane > 7) 
     2017      throw new IllegalArgumentException("colorColorizedTester() passed bad sizeC - channelsPerPlane > 7 : "+channelsPerPlane); 
     2018    */ 
     2019     
     2020    int sizeX = 60, sizeY = 30, sizeZ = 1, sizeT = 1, numSeries = 1; 
     2021     
     2022    String path = constructFakeFilename("colorColorized", pixType, sizeX, sizeY, sizeZ, sizeC, sizeT, numSeries, indexed, rgb, falseColor, lutLen); 
     2023 
     2024    ImagePlus[] imps = null; 
     2025    ImagePlus imp = null; 
     2026    CompositeImage ci = null; 
     2027     
     2028    try { 
     2029      ImporterOptions options = new ImporterOptions(); 
     2030      options.setColorMode(ImporterOptions.COLOR_MODE_COLORIZED); 
     2031      options.setId(path); 
     2032      imps = BF.openImagePlus(options); 
     2033    } 
     2034    catch (IOException e) { 
     2035      fail(e.getMessage()); 
     2036    } 
     2037    catch (FormatException e) { 
     2038      fail(e.getMessage()); 
     2039    } 
     2040 
     2041    impsCountTest(imps,1); 
     2042     
     2043    imp = imps[0]; 
     2044    
     2045    int expectedSizeC = sizeC; 
     2046    //if (indexed && !falseColor) 
     2047    //  expectedSizeC = 3 * sizeC; 
     2048    //if ((totalPlanes == 1) && (expectedSizeC == 2) && falseColor) 
     2049    //  expectedSizeC = 3; 
     2050     
     2051    if (lutLen == -1) 
     2052      lutLen = 3; 
     2053     
     2054    if ((indexed) && (!falseColor)) 
     2055      expectedSizeC *= lutLen; 
     2056       
     2057    //System.out.println("  chans channsPerPlane planes expectedSizeC "+totalChannels+" "+channelsPerPlane+" "+totalPlanes+" "+expectedSizeC); 
     2058 
     2059    xyzctTest(imp,sizeX,sizeY,sizeZ,expectedSizeC,sizeT); 
     2060 
     2061    // TODO: the following code conditional as BF sometimes does not return a CompositeImage. Handle better after BF 
     2062    //   changed and after I've handled all special cases. 
     2063   
     2064    if (imp.isComposite()) 
     2065    { 
     2066      ci = (CompositeImage)imp; 
     2067     
     2068      assertFalse(ci.hasCustomLuts()); 
     2069 
     2070      assertEquals(CompositeImage.COLOR, ci.getMode()); 
     2071     
     2072      colorTests(ci,sizeC,DefaultColorOrder); 
     2073       
     2074      if (indexed) 
     2075        System.out.println("  colorColorizedTester() - MaxZ MaxC MaxT "+sizeZ+" "+expectedSizeC+" "+sizeT); 
     2076 
     2077      int iIndex = 0; 
     2078      for (int cIndex = 0; cIndex < expectedSizeC; cIndex++) 
     2079        for (int tIndex = 0; tIndex < sizeT; tIndex++) 
     2080          for (int zIndex = 0; zIndex < sizeZ; zIndex++) 
     2081            //getIndexPixelValue(ci, zIndex, cIndex, tIndex, indexed); 
     2082            assertEquals(iIndex++,getIndexPixelValue(ci, zIndex, cIndex, tIndex, indexed)); 
     2083    } 
     2084  } 
     2085 
     2086  @Test 
     2087  public void testColorizeSubcases() 
     2088  { 
     2089    System.out.println("testColorizeSubcases() - begin special cases"); 
     2090     
     2091    // INDEXED and sizeC == 1,2,3,anything bigger than 3 
     2092     
     2093    // sizeC == 1, rgb == 1, indexed, 8 bit, implicit lut length of 3 - KEY test to do, also note can vary lut len 
     2094    System.out.println("A"); 
     2095    //colorColorizedTester(FormatTools.UINT8,1,1,true,false,-1); 
     2096    System.out.println("B"); 
     2097    //colorColorizedTester(FormatTools.UINT8,1,1,true,true,-1); 
     2098    System.out.println("C"); 
     2099    //colorColorizedTester(FormatTools.UINT8,1,1,true,false,4); 
     2100     
     2101    // sizeC = 3 and rgb = 1 
     2102    System.out.println("D"); 
     2103    //colorColorizedTester(FormatTools.UINT8,3,1,true,false,-1); 
     2104    System.out.println("E"); 
     2105    colorColorizedTester(FormatTools.UINT8,3,1,true,true,-1); 
     2106 
     2107    // sizeC = 3 and rgb = 3 : interleaved 
     2108    System.out.println("F"); 
     2109    //colorColorizedTester(FormatTools.UINT8,3,3,true,false,-1); 
     2110    System.out.println("G"); 
     2111    colorColorizedTester(FormatTools.UINT8,3,3,true,true,-1); 
     2112 
     2113    // NOT INDEXED 
     2114     
     2115    // sizeC == 1 : don't test yet 
     2116     
     2117    // sizeC = 4 and rgb = 4 : interleaved including alpha 
     2118    // if indexed == true this combo throws exception in CompositeImage constructor 
     2119    System.out.println("H"); 
     2120    colorColorizedTester(FormatTools.UINT8,4,4,false,false,-1); 
     2121 
     2122    // sizeC = 6, rgb = 3, indexed = false 
     2123    // if indexed == true this combo throws exception in CompositeImage constructor 
     2124    System.out.println("I"); 
     2125    colorColorizedTester(FormatTools.UINT8,6,3,false,false,-1); 
     2126    
     2127    // sizeC = 12, rgb = 3, indexed = false 
     2128    System.out.println("J"); 
     2129    colorColorizedTester(FormatTools.UINT8,12,3,false,false,-1); 
     2130 
     2131    System.out.println("testColorizeSubcases() - past special cases"); 
     2132 
     2133    /* 
     2134    for (int sizeC : new int[] {2,3,4,6,12})  // TODO: notice 1 not handled: IJ will not return a composite image of 1 chann - will need special test 
     2135      for (int rgb : new int[] {1,2,3,4}) 
     2136        if (sizeC % rgb == 0) 
     2137          for (int pixType : new int[] {FormatTools.UINT8}) // TODO - add later FormatTools.UINT16 
     2138            for (boolean indexed : BooleanStates) 
     2139              if (!indexed)  // if !indexed make sure falseColor is false to avoid illegal combo 
     2140              { 
     2141                System.out.println("Colorized: pixT sizeC rgb indexed falseColor "+FormatTools.getPixelTypeString(pixType)+" "+sizeC+" "+rgb+" "+indexed+" "+false); 
     2142                colorColorizedTester(pixType,sizeC,rgb,indexed,false,-1); 
     2143              } 
     2144              else  // indexed == true 
     2145                for (boolean falseColor : BooleanStates) 
     2146                { 
     2147                  System.out.println("Colorized: pixT sizeC rgb indexed falseColor "+FormatTools.getPixelTypeString(pixType)+" "+sizeC+" "+rgb+" "+indexed+" "+falseColor); 
     2148                  colorColorizedTester(pixType,sizeC,rgb,indexed,falseColor,-1); 
     2149                } 
     2150    System.out.println("testColorizeSubcases() - past all cases"); 
     2151    */ 
     2152  } 
     2153   
    19872154} 
Note: See TracChangeset for help on using the changeset viewer.