Changeset 6578


Ignore:
Timestamp:
06/28/10 15:28:38 (9 years ago)
Author:
bdezonia
Message:

started adding code to test everything with VirtualStacks also

File:
1 edited

Legend:

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

    r6574 r6578  
    3737 
    3838// left off 
    39 //   do the comboConcatSplits() require options.openAllSeries()? If so, still broken. 
     39//   comboConcatSplit bugs: IJ reorders dims cuz stacksize does not match ZxCxT. Waiting for Curtis to implement default 
     40//     concat axis choice behavior and then fix those tests. 
     41//   expand testing to use virtual stacks everywhere if possible 
    4042//   expand compositeTestSubcases() to handle more pixTypes and indexed data 
    4143//   finish the colorize tests 
     
    463465    return value; 
    464466  } 
    465    
    466467  
    467468  /** calculate the effective size C of an image given various params */ 
     
    767768  private void calibrationTest(ImagePlus imp, int pixType) 
    768769  { 
     770    // IJ handles BF INT32 as float. So this test is invalid in that case 
     771    if (pixType == FormatTools.INT32) 
     772      return; 
     773     
    769774    if (FormatTools.isSigned(pixType) && !FormatTools.isFloatingPoint(pixType)) 
    770775    { 
     
    919924  private void imageSeriesInTczOrderTest(ImagePlus[] imps, int numSeries, int sizeX, int sizeY, int sizeZ, int sizeC, int sizeT) 
    920925  { 
     926    System.out.println("imageSeriesInTczOrderTest(z="+sizeZ+" c="+sizeC+" t="+sizeT+" s="+numSeries+")"); 
    921927    // from CZT order: T pulled out, CZ in order 
    922928    for (int t = 0; t < sizeT; t++) 
     
    10141020   
    10151021  /** tests BF's options.setStackOrder() */ 
    1016   private void outputStackOrderTester(int pixType, ChannelOrder order, int x, int y, int z, int c, int t) 
     1022  private void outputStackOrderTester(boolean virtual, int pixType, ChannelOrder order, int x, int y, int z, int c, int t) 
    10171023  { 
    10181024    String bfChOrder = bfChanOrd(order); 
     
    10241030    try { 
    10251031      ImporterOptions options = new ImporterOptions(); 
     1032      options.setVirtual(virtual); 
    10261033      options.setId(path); 
    10271034      options.setStackOrder(bfChOrder); 
     
    10471054 
    10481055  /** tests BF's options.setSwapDimensions() */ 
    1049   private void datasetSwapDimsTester(int pixType, int x, int y, int z, int t) 
     1056  private void datasetSwapDimsTester(boolean virtual, int pixType, int x, int y, int z, int t) 
    10501057  { 
    10511058    int c = 3; 
     
    10581065    try { 
    10591066      ImporterOptions options = new ImporterOptions(); 
     1067      options.setVirtual(virtual); 
    10601068      options.setId(path); 
    10611069      options.setSwapDimensions(true); 
     
    10801088 
    10811089  /** open a fakefile series either as separate ImagePluses or as one ImagePlus depending on input flag allOfThem */ 
    1082   private ImagePlus[] openSeriesTest(String fakeFileName, boolean allOfThem) 
     1090  private ImagePlus[] openSeriesTest(String fakeFileName, boolean virtual, boolean openAllValue) 
    10831091  { 
    10841092    ImagePlus[] imps = null; 
     
    10861094    try { 
    10871095      ImporterOptions options = new ImporterOptions(); 
     1096      options.setVirtual(virtual); 
    10881097      options.setId(fakeFileName); 
    1089       options.setOpenAllSeries(allOfThem); 
     1098      options.setOpenAllSeries(openAllValue); 
    10901099      imps = BF.openImagePlus(options); 
    10911100    } 
     
    11011110   
    11021111  /** tests BF's options.setOpenAllSeries() */ 
    1103   private void datasetOpenAllSeriesTester(boolean allOfThem) 
    1104   { 
    1105     int x = 55, y = 20, z = 2, c = 3, t = 4, s = 5; 
    1106      
    1107     String path = constructFakeFilename("openAllSeries", FormatTools.UINT32, x, y, z, c, t, s, false, -1, false, -1); 
    1108      
    1109     int expectedNumSeries = 1; 
    1110     if (allOfThem) 
    1111       expectedNumSeries = s; 
    1112      
    1113     ImagePlus[] imps = openSeriesTest(path,allOfThem); 
    1114     impsCountTest(imps,expectedNumSeries); 
    1115     for (int i = 0; i < expectedNumSeries; i++) 
     1112  private void datasetOpenAllSeriesTester(boolean virtual, boolean openAll) 
     1113  { 
     1114    int x = 55, y = 20, z = 2, c = 3, t = 4, numSeries = 5; 
     1115     
     1116    String path = constructFakeFilename("openAllSeries", FormatTools.UINT32, x, y, z, c, t, numSeries, false, -1, false, -1); 
     1117     
     1118    int expectedNumImps = 1; 
     1119    if (openAll) 
     1120      expectedNumImps = numSeries; 
     1121     
     1122    ImagePlus[] imps = openSeriesTest(path,virtual,openAll); 
     1123    impsCountTest(imps,expectedNumImps); 
     1124    for (int i = 0; i < expectedNumImps; i++) 
    11161125      xyzctTest(imps[i],x,y,z,c,t); 
    11171126  } 
     
    11491158     
    11501159    // TODO 
    1151     //   BF right now does not scale one of z/c/t by s. So z*c*t != stacksize. IJ jandles by reordering dimensions as 
     1160    //   BF right now does not scale one of z/c/t by s. So z*c*t != stacksize. IJ handles by reordering dimensions as 
    11521161    //   1x1xnSlices. Once BF is updated to specify which dimension to concat along then uncomment a modified version 
    1153     //   the next test 
     1162    //   of the next test. 
    11541163    //xyzctTest(x,y,z,c,t); // this test but one of z,c,t scaled by s 
    11551164     
     
    16481657    // run split and concat at same time 
    16491658 
    1650     final int sizeX = 50, sizeY = 20, sizeZ = 5, sizeC = 3, sizeT = 7, series = 4; 
     1659    //TODO - restore - final int sizeX = 50, sizeY = 20, sizeZ = 5, sizeC = 3, sizeT = 7, series = 4; 
     1660    final int sizeX = 50, sizeY = 20, sizeZ = 1, sizeC = 1, sizeT = 1, series = 2; 
    16511661     
    16521662    final String path = constructFakeFilename("concatSplitZ", 
     
    16581668    try { 
    16591669      ImporterOptions options = new ImporterOptions(); 
    1660       options.setOpenAllSeries(true);  // TODO - added to see if needed for passing 
     1670      options.setOpenAllSeries(true); 
    16611671      options.setConcatenate(true); 
    16621672      options.setSplitFocalPlanes(true); 
     
    16831693    // run split and concat at same time 
    16841694 
    1685     final int sizeX = 50, sizeY = 20, sizeZ = 5, sizeC = 3, sizeT = 7, series = 4; 
     1695    // TODO - restore -  final int sizeX = 50, sizeY = 20, sizeZ = 5, sizeC = 3, sizeT = 7, series = 4; 
     1696    final int sizeX = 50, sizeY = 20, sizeZ = 1, sizeC = 1, sizeT = 1, series = 2; 
    16861697     
    16871698    final String path = constructFakeFilename("concatSplitC", 
     
    16931704    try { 
    16941705      ImporterOptions options = new ImporterOptions(); 
    1695       options.setOpenAllSeries(true);  // TODO - added to see if needed for passing 
     1706      options.setOpenAllSeries(true); 
    16961707      options.setConcatenate(true); 
    16971708      options.setSplitChannels(true); 
     
    17181729    // run split and concat at same time 
    17191730 
    1720     final int sizeX = 50, sizeY = 20, sizeZ = 5, sizeC = 3, sizeT = 7, series = 4; 
     1731    // TODO - restore - final int sizeX = 50, sizeY = 20, sizeZ = 5, sizeC = 3, sizeT = 7, series = 4; 
     1732    final int sizeX = 50, sizeY = 20, sizeZ = 1, sizeC = 1, sizeT = 1, series = 2; 
    17211733   
    17221734    final String path = constructFakeFilename("concatSplitT", 
     
    17281740    try { 
    17291741      ImporterOptions options = new ImporterOptions(); 
    1730       options.setOpenAllSeries(true);  // TODO - added to see if needed for passing 
     1742      options.setOpenAllSeries(true); 
    17311743      options.setConcatenate(true); 
    17321744      options.setSplitTimepoints(true); 
     
    17971809  public void testDefaultBehavior() 
    17981810  { 
     1811    defaultBehaviorTester(FormatTools.UINT8, 57, 78, 5, 4, 3); 
     1812    defaultBehaviorTester(FormatTools.UINT32, 323, 206, 3, 2, 1); 
    17991813    defaultBehaviorTester(FormatTools.UINT16, 400, 300, 1, 1, 1); 
     1814    defaultBehaviorTester(FormatTools.INT8, 232, 153, 3, 7, 5); 
    18001815    defaultBehaviorTester(FormatTools.INT16, 107, 414, 1, 1, 1); 
    1801     defaultBehaviorTester(FormatTools.UINT32, 323, 206, 3, 2, 1); 
    1802     defaultBehaviorTester(FormatTools.UINT8, 57, 78, 5, 4, 3); 
    18031816    defaultBehaviorTester(FormatTools.INT32, 158, 99, 2, 3, 4); 
    1804     defaultBehaviorTester(FormatTools.INT8, 232, 153, 3, 7, 5); 
    18051817    defaultBehaviorTester(FormatTools.FLOAT, 73, 99, 3, 4, 5); 
    18061818    defaultBehaviorTester(FormatTools.DOUBLE, 106, 44, 5, 5, 4); 
     
    18111823  { 
    18121824    for (ChannelOrder order : ChannelOrder.values()) 
    1813       outputStackOrderTester(FormatTools.UINT8, order,  82, 47, 2, 3, 4); 
     1825      for (boolean virtual : BooleanStates) 
     1826        outputStackOrderTester(virtual,FormatTools.UINT8, order,  82, 47, 2, 3, 4); 
    18141827  } 
    18151828     
     
    19011914    //   Note that testComboManyOptions() tests another swap order 
    19021915 
    1903     datasetSwapDimsTester(FormatTools.UINT8, 82, 47, 1, 3); 
    1904     datasetSwapDimsTester(FormatTools.UINT16, 82, 47, 3, 1); 
    1905     datasetSwapDimsTester(FormatTools.UINT16, 82, 47, 5, 2); 
    1906     datasetSwapDimsTester(FormatTools.UINT32, 82, 47, 5, 2); 
    1907     datasetSwapDimsTester(FormatTools.INT8, 44, 108, 1, 4); 
    1908     datasetSwapDimsTester(FormatTools.INT16, 44, 108, 2, 1); 
    1909     datasetSwapDimsTester(FormatTools.INT32, 44, 108, 4, 3); 
    1910     datasetSwapDimsTester(FormatTools.FLOAT, 67, 109, 4, 3); 
    1911     datasetSwapDimsTester(FormatTools.DOUBLE, 67, 100, 3, 2); 
     1916    for (boolean virtual : BooleanStates) 
     1917    { 
     1918      datasetSwapDimsTester(virtual,FormatTools.UINT8, 82, 47, 1, 3); 
     1919      datasetSwapDimsTester(virtual,FormatTools.UINT16, 82, 47, 3, 1); 
     1920      datasetSwapDimsTester(virtual,FormatTools.UINT16, 82, 47, 5, 2); 
     1921      datasetSwapDimsTester(virtual,FormatTools.UINT32, 82, 47, 5, 2); 
     1922      datasetSwapDimsTester(virtual,FormatTools.INT8, 44, 108, 1, 4); 
     1923      datasetSwapDimsTester(virtual,FormatTools.INT16, 44, 108, 2, 1); 
     1924      datasetSwapDimsTester(virtual,FormatTools.INT32, 44, 108, 4, 3); 
     1925      datasetSwapDimsTester(virtual,FormatTools.FLOAT, 67, 109, 4, 3); 
     1926      datasetSwapDimsTester(virtual,FormatTools.DOUBLE, 67, 100, 3, 2); 
     1927    } 
    19121928  } 
    19131929 
     
    19151931  public void testDatasetOpenAllSeries() 
    19161932  { 
    1917     datasetOpenAllSeriesTester(false); 
    1918     datasetOpenAllSeriesTester(true); 
     1933    for (boolean virtual : BooleanStates) 
     1934      for (boolean openAll : BooleanStates) 
     1935      { 
     1936        datasetOpenAllSeriesTester(virtual,openAll); 
     1937        datasetOpenAllSeriesTester(virtual,openAll); 
     1938      } 
    19191939  } 
    19201940 
Note: See TracChangeset for help on using the changeset viewer.