Changeset 6261


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

more work on splitting tests

File:
1 edited

Legend:

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

    r6260 r6261  
    3333//      write tests for the color options : 4 cases 
    3434//      concat follows - see my test to see if sufficient 
     35//      swap dims test needs to be changed after BF updated later 
    3536//      lowest priority - record modifications 
    3637//  - add some tests for combination of options 
     
    794795    assertEquals(3,imps.length); 
    795796    for (int i = 0; i < 3; i++) 
    796       assertEquals(35,imps[i].getStack().getSize()); 
    797      
    798     // TODO - test values in files 
     797    { 
     798      ImageStack st = imps[i].getStack(); 
     799      assertEquals(35,st.getSize()); 
     800      for (int j = 0; j < 35; j++) 
     801      { 
     802        ImageProcessor proc = st.getProcessor(j+1); 
     803        assertEquals(0,zIndex(proc));  // TODO - figure actual values 
     804        assertEquals(0,tIndex(proc)); 
     805      } 
     806    } 
    799807  } 
    800808   
     
    822830    assertEquals(7,imps.length); 
    823831    for (int i = 0; i < 7; i++) 
    824       assertEquals(15,imps[0].getStack().getSize()); 
    825  
    826     // TODO - test values in files 
     832    { 
     833      ImageStack st = imps[i].getStack(); 
     834      assertEquals(15,st.getSize()); 
     835      for (int j = 0; j < 15; j++) 
     836      { 
     837        ImageProcessor proc = st.getProcessor(j+1); 
     838        assertEquals(0,cIndex(proc));  // TODO - figure actual values 
     839        assertEquals(0,tIndex(proc)); 
     840      } 
     841    } 
    827842  } 
    828843   
     
    850865    assertEquals(5,imps.length); 
    851866    for (int i = 0; i < 5; i++) 
    852       assertEquals(35,imps[i].getStack().getSize()); 
    853  
    854     // TODO - test values in files 
     867    { 
     868      ImageStack st = imps[i].getStack(); 
     869      assertEquals(21,st.getSize()); 
     870      for (int j = 0; j < 21; j++) 
     871      { 
     872        ImageProcessor proc = st.getProcessor(j+1); 
     873        assertEquals(0,zIndex(proc));  // TODO - figure actual values 
     874        assertEquals(0,cIndex(proc)); 
     875      } 
     876    } 
    855877  } 
    856878 
     
    889911} 
    890912 
    891  
    892 /*  old stuff - keep until replacement code tested 
    893  
    894   private int numPresent(ImageStack st, Axis axis) 
    895   { 
    896     List<Integer> indices = new ArrayList<Integer>(); 
    897      
    898     int count = 0; 
    899     for (int i = 0; i < st.getSize(); i++) 
    900     { 
    901       int currVal = this.index(axis, st.getProcessor(i+1)); 
    902  
    903       //fails 
    904       // (!indices.contains(new Integer(currVal))) 
    905       // 
    906       //  indices.add(new Integer(currVal)); 
    907       //  count++; 
    908       //} 
    909  
    910       boolean found = false; 
    911       for (int j = 0; j < indices.size(); j++) 
    912         if (currVal == indices.get(j)) 
    913         { 
    914           found = true; 
    915           break; 
    916         } 
    917       if (!found) 
    918       { 
    919         count++; 
    920         indices.add(currVal); 
    921       } 
    922     } 
    923     return count; 
    924   } 
    925    
    926 private void memorySpecifyZRangeTest() 
    927 {  
    928   int pixType = FormatTools.UINT8, x=30, y=30, z=6, c=2, t=4, s=-1; 
    929   int from = 1, to = 5, by = 2; 
    930   String path = constructFakeFilename("range", pixType, x, y, z, c, t, s); 
    931   ImagePlus[] imps = null; 
    932   try { 
    933     ImporterOptions options = new ImporterOptions(); 
    934     options.setId(path); 
    935     options.setZBegin(0, from); 
    936     options.setZEnd(0, to); 
    937     options.setZStep(0, by); 
    938     imps = BF.openImagePlus(options); 
    939   } 
    940   catch (IOException e) { 
    941     fail(e.getMessage()); 
    942   } 
    943   catch (FormatException e) { 
    944     fail(e.getMessage()); 
    945   } 
    946    
    947   // should have the data: one series, all t's, all c's, z's from 1 to 5 by 2 
    948   assertNotNull(imps); 
    949   assertTrue(imps.length == 1); 
    950   ImagePlus ip = imps[0]; 
    951   assertNotNull(ip); 
    952   assertTrue(ip.getWidth() == x); 
    953   assertTrue(ip.getHeight() == y); 
    954   ImageStack st = ip.getStack(); 
    955   int numSlices = st.getSize(); 
    956   assertEquals(numInSeries(from,to,by)*c*t,numSlices); 
    957  
    958   System.out.println("SpecifyZRangeTest: slices below"); 
    959   for (int i = 0; i < numSlices; i++) 
    960   { 
    961     ImageProcessor proc = st.getProcessor(i+1);  
    962     printVals(proc); 
    963   } 
    964    
    965   // all t's present 
    966   //assertEquals(numInSeries(1,t,1), numPresent(st,Axis.T)); 
    967    
    968   // all c's present 
    969   //assertEquals(numInSeries(1,c,1), numPresent(st,Axis.C)); 
    970  
    971   // only specific z's present 
    972   //assertEquals(numInSeries(from,to,by), numPresent(st,Axis.Z)); 
    973    
    974   assertTrue(seriesInCorrectOrder(st,from,to,by,0,c-1,1,0,t-1,1)); 
    975 } 
    976  
    977 private void memorySpecifyCRangeTest() 
    978 {  
    979   int pixType = FormatTools.UINT8, x=30, y=30, z=4, c=11, t=4, s=-1; 
    980   int from = 3, to = 9, by = 3; 
    981   String path = constructFakeFilename("range", pixType, x, y, z, c, t, s); 
    982   ImagePlus[] imps = null; 
    983   try { 
    984     ImporterOptions options = new ImporterOptions(); 
    985     options.setId(path); 
    986     options.setCBegin(0, from); 
    987     options.setCEnd(0, to); 
    988     options.setCStep(0, by); 
    989     imps = BF.openImagePlus(options); 
    990   } 
    991   catch (IOException e) { 
    992     fail(e.getMessage()); 
    993   } 
    994   catch (FormatException e) { 
    995     fail(e.getMessage()); 
    996   } 
    997    
    998   // should have the data: one series, all t's, all z's, c's from 3 to 9 by 3 
    999   assertNotNull(imps); 
    1000   assertTrue(imps.length == 1); 
    1001   ImagePlus ip = imps[0]; 
    1002   assertNotNull(ip); 
    1003   assertTrue(ip.getWidth() == x); 
    1004   assertTrue(ip.getHeight() == y); 
    1005   ImageStack st = ip.getStack(); 
    1006   int numSlices = st.getSize(); 
    1007   assertEquals(z*numInSeries(from,to,by)*t,numSlices); 
    1008   //System.out.println("SpecifyCRangeTest: slices below"); 
    1009   //for (int i = 0; i < numSlices; i++) 
    1010   //  printVals(st.getProcessor(i+1)); 
    1011        
    1012   // all t's present 
    1013   //assertEquals(numInSeries(1,t,1), numPresent(st,Axis.T)); 
    1014    
    1015   // all z's present 
    1016   //assertEquals(numInSeries(1,z,1), numPresent(st,Axis.Z)); 
    1017  
    1018   // only specific c's present 
    1019   //assertEquals(numInSeries(from,to,by), numPresent(st,Axis.C)); 
    1020  
    1021   assertTrue(seriesInCorrectOrder(st,0,z-1,1,from,to,by,0,t-1,1)); 
    1022 } 
    1023  
    1024 private void memorySpecifyTRangeTest() 
    1025 {  
    1026   int pixType = FormatTools.UINT8, x=30, y=30, z=3, c=2, t=12, s=-1; 
    1027   int from = 1, to = 10, by = 4; 
    1028   String path = constructFakeFilename("range", pixType, x, y, z, c, t, s); 
    1029   ImagePlus[] imps = null; 
    1030   try { 
    1031     ImporterOptions options = new ImporterOptions(); 
    1032     options.setId(path); 
    1033     options.setTBegin(0, from); 
    1034     options.setTEnd(0, to); 
    1035     options.setTStep(0, by); 
    1036     imps = BF.openImagePlus(options); 
    1037   } 
    1038   catch (IOException e) { 
    1039     fail(e.getMessage()); 
    1040   } 
    1041   catch (FormatException e) { 
    1042     fail(e.getMessage()); 
    1043   } 
    1044    
    1045   // should have the data: one series, all z's, all c's, t's from 1 to 10 by 4 
    1046   assertNotNull(imps); 
    1047   assertTrue(imps.length == 1); 
    1048   ImagePlus ip = imps[0]; 
    1049   assertNotNull(ip); 
    1050   assertTrue(ip.getWidth() == x); 
    1051   assertTrue(ip.getHeight() == y); 
    1052   ImageStack st = ip.getStack(); 
    1053   int numSlices = st.getSize(); 
    1054   assertEquals(z*c*numInSeries(from,to,by),numSlices); 
    1055   //System.out.println("SpecifyTRangeTest: slices below"); 
    1056   //for (int i = 0; i < numSlices; i++) 
    1057   //  printVals(st.getProcessor(i+1)); 
    1058    
    1059   // all z's present 
    1060   //assertEquals(numInSeries(1,z,1), numPresent(st,Axis.Z)); 
    1061    
    1062   // all c's present 
    1063   //assertEquals(numInSeries(1,c,1), numPresent(st,Axis.C)); 
    1064  
    1065   // only specific t's present 
    1066   //assertEquals(numInSeries(from,to,by), numPresent(st,Axis.T)); 
    1067    
    1068   assertTrue(seriesInCorrectOrder(st,0,z-1,1,0,c-1,1,from,to,by)); 
    1069 } 
    1070  
    1071 */ 
    1072913 
    1073914/*  notes 
Note: See TracChangeset for help on using the changeset viewer.