Changeset 6348
- Timestamp:
- 05/19/10 14:56:47 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/components/loci-plugins/test/loci/plugins/in/ImporterTest.java
r6347 r6348 37 37 // BF/imageJ returning wrong max num pixels for UINT32 - off by one 38 38 // memoryRecord failure needs BF code fix 39 // mergeOptions BF api for finishing merge tests 40 // custom color BF api for doing that test 41 // coboCropAutoscale() - autoscale of a cropped image returning min of whole image 39 // comboCropAutoscale() - autoscale of a cropped image returning min of whole image 42 40 // - flesh out existing tests 43 // write tests for the color options : 4 cases - some mention was made that indexcolor is an issue in testing 44 // merge - basic test in place but not passing. need to flesh out mergeOptions when BF code in place. 41 // write tests for the color options : some mention was made that indexcolor is an issue in testing 42 // default 43 // custom 45 44 // rgb colorize - need to do actual tests. see BF gui to get idea of how it works 46 45 // custom colorize - waiting for creation of API for setting r,g,b info … … 49 48 // swapped dims test needs to test cases other than from default swapping Z & T 50 49 // output stack order - testing of iIndex? 51 // range - more combos of ztc? uncomment the by 0 tests50 // range - uncomment the by 0 tests when BF fixed 52 51 // - add some tests for combination of options 53 52 // - improve, comment, and generalize code for increased coverage … … 57 56 private enum Axis {Z,C,T}; 58 57 59 private enum ChannelOrder {XYZTC, XYZCT, XY TZC, XYTCZ, XYCTZ, XYCZT};58 private enum ChannelOrder {XYZTC, XYZCT, XYCZT, XYCTZ, XYTZC, XYTCZ}; 60 59 61 60 private static final boolean[] BooleanStates = new boolean[] {false, true}; … … 341 340 } 342 341 342 // ****** helper tests **************************************************************************************** 343 344 private void impsTest(ImagePlus[] imps, int numExpected) 345 { 346 assertNotNull(imps); 347 assertEquals(numExpected,imps.length); 348 } 349 343 350 private void xyzctTest(ImagePlus imp, int x, int y, int z, int c, int t) 344 351 { … … 351 358 } 352 359 353 // ****** helper tests **************************************************************************************** 360 // channel is 0-based 361 private void lutTest(CompositeImage ci, int channel, int minR, int minG, int minB, int maxR, int maxG, int maxB) 362 { 363 LUT lut = null; 364 365 byte[] reds = new byte[256]; 366 byte[] blues = new byte[256]; 367 byte[] greens = new byte[256]; 368 369 lut = ci.getChannelLut(channel+1); // IJ is 1-based 370 lut.getReds(reds); 371 lut.getGreens(greens); 372 lut.getBlues(blues); 373 374 assertEquals((byte)minR,reds[0]); 375 assertEquals((byte)maxR,reds[255]); 376 assertEquals((byte)minG,greens[0]); 377 assertEquals((byte)maxG,greens[255]); 378 assertEquals((byte)minB,blues[0]); 379 assertEquals((byte)maxB,blues[255]); 380 } 354 381 355 382 private void defaultBehaviorTest(int pixType, int x, int y, int z, int c, int t) … … 368 395 } 369 396 370 assertNotNull(imps);371 assertEquals(1,imps.length); 397 impsTest(imps,1); 398 372 399 ImagePlus imp = imps[0]; 373 400 … … 393 420 } 394 421 395 assertNotNull(imps); 396 assertEquals(1,imps.length); 422 impsTest(imps,1); 397 423 398 424 ImagePlus imp = imps[0]; … … 449 475 } 450 476 451 assertNotNull(imps); 452 assertEquals(1,imps.length); 477 impsTest(imps,1); 453 478 454 479 ImagePlus imp = imps[0]; … … 495 520 // test results 496 521 497 assertEquals(1,imps.length);522 impsTest(imps,1); 498 523 xyzctTest(imps[0],x,y,z,c,t); 499 524 assertEquals(z*c*t, imps[0].getStack().getSize()); … … 550 575 // test results 551 576 552 assertNotNull(imps); 553 assertEquals(1,imps.length); 577 impsTest(imps,1); 554 578 ImageStack st = imps[0].getStack(); 555 579 … … 594 618 } 595 619 596 assertEquals(1,imps.length);620 impsTest(imps,1); 597 621 598 622 imp = imps[0]; … … 616 640 } 617 641 642 //System.out.println("Checking max/min of each processor"); 618 643 for (int i = 0; i < numSlices; i++) 619 644 { 645 //System.out.println("Trying proc #"+i+" of "+numSlices); 620 646 ImageProcessor proc = st.getProcessor(i+1); 621 647 assertEquals(expectedMax,proc.getMax(),0.1); … … 657 683 } 658 684 659 assertEquals(1,imps.length);685 impsTest(imps,1); 660 686 imp = imps[0]; 661 687 xyzctTest(imps[0],sizeCrop,sizeCrop,sizeZ,sizeC,sizeT); … … 697 723 698 724 // test results 699 assertNotNull(imps); 700 assertEquals(1,imps.length); 725 impsTest(imps,1); 701 726 ImagePlus imp = imps[0]; 702 assertNotNull(imp);703 727 xyzctTest(imp,x,y,z,c,t); 704 728 … … 732 756 733 757 // basic tests 734 assertNotNull(imps); 735 assertEquals(1,imps.length); 758 impsTest(imps,1); 736 759 imp = imps[0]; 737 760 xyzctTest(imp,x,y,z,c,t); … … 803 826 804 827 // should have the data in one series 805 assertNotNull(imps); 806 assertEquals(1,imps.length); 828 impsTest(imps,1); 807 829 ImagePlus imp = imps[0]; 808 830 xyzctTest(imp,x,y,numInSeries(zFrom,zTo,zBy),numInSeries(cFrom,cTo,cBy),numInSeries(tFrom,tTo,tBy)); … … 834 856 835 857 // test results 836 assertNotNull(imps); 837 assertEquals(1,imps.length); 858 impsTest(imps,1); 838 859 xyzctTest(imps[0],cx,cy,1,1,1); 839 860 } … … 880 901 } 881 902 882 assertEquals(1,imps.length);903 impsTest(imps,1); 883 904 assertEquals(105,imps[0].getStack().getSize()); 884 905 } … … 912 933 // test results 913 934 914 assertEquals(1,imps.length);935 impsTest(imps,1); 915 936 assertEquals(16,imps[0].getStack().getSize()); // one loaded as one set with 16 slices 916 937 … … 932 953 // test results 933 954 934 assertEquals(1,imps.length);955 impsTest(imps,1); 935 956 assertEquals(32,imps[0].getStack().getSize()); // both loaded as one set of 32 slices 936 957 } … … 991 1012 } 992 1013 993 assertEquals(1,imps.length);1014 impsTest(imps,1); 994 1015 995 1016 imp = imps[0]; … … 1002 1023 1003 1024 fail("unfinished"); 1004 }1005 1006 // channel is 0-based1007 private void lutTest(CompositeImage ci, int channel, int minR, int minG, int minB, int maxR, int maxG, int maxB)1008 {1009 LUT lut = null;1010 1011 byte[] reds = new byte[256];1012 byte[] blues = new byte[256];1013 byte[] greens = new byte[256];1014 1015 lut = ci.getChannelLut(channel+1); // IJ is 1-based1016 lut.getReds(reds);1017 lut.getGreens(greens);1018 lut.getBlues(blues);1019 1020 assertEquals((byte)minR,reds[0]);1021 assertEquals((byte)maxR,reds[255]);1022 assertEquals((byte)minG,greens[0]);1023 assertEquals((byte)maxG,greens[255]);1024 assertEquals((byte)minB,blues[0]);1025 assertEquals((byte)maxB,blues[255]);1026 1025 } 1027 1026 … … 1050 1049 } 1051 1050 1052 assertEquals(1,imps.length);1051 impsTest(imps,1); 1053 1052 1054 1053 imp = imps[0]; … … 1105 1104 } 1106 1105 1107 assertEquals(1,imps.length);1106 impsTest(imps,1); 1108 1107 1109 1108 imp = imps[0]; … … 1160 1159 } 1161 1160 1162 assertEquals(1,imps.length);1161 impsTest(imps,1); 1163 1162 1164 1163 imp = imps[0]; … … 1231 1230 } 1232 1231 1233 assertEquals(1,imps.length);1232 impsTest(imps,1); 1234 1233 1235 1234 imp = imps[0]; … … 1245 1244 assertEquals(CompositeImage.COLOR, ci.getMode()); 1246 1245 1247 lutTest(ci,0,0,0,0,0,0,25 5); // blue1246 lutTest(ci,0,0,0,0,0,0,254); // blue 1248 1247 if (sizeC >= 2) 1249 lutTest(ci,1,0,0,0,25 5,0,0); // red1248 lutTest(ci,1,0,0,0,254,0,0); // red 1250 1249 if (sizeC >= 3) 1251 lutTest(ci,2,0,0,0,0,25 5,0); // green1250 lutTest(ci,2,0,0,0,0,254,0); // green 1252 1251 if (sizeC >= 4) 1253 lutTest(ci,3,0,0,0,25 5,0,255); // magenta1252 lutTest(ci,3,0,0,0,254,0,254); // magenta 1254 1253 if (sizeC >= 5) 1255 lutTest(ci,4,0,0,0,0,25 5,255); // cyan1254 lutTest(ci,4,0,0,0,0,254,254); // cyan 1256 1255 if (sizeC >= 7) 1257 lutTest(ci,5,0,0,0,25 5,255,0); // yellow1256 lutTest(ci,5,0,0,0,254,254,0); // yellow 1258 1257 if (sizeC >= 7) 1259 lutTest(ci,6,0,0,0, 255,255,255); // gray1258 lutTest(ci,6,0,0,0,127,127,127); // gray 1260 1259 1261 1260 fail("unfinished"); … … 1289 1288 1290 1289 // test results 1291 assertEquals(1,imps.length);1290 impsTest(imps,1); 1292 1291 imp = imps[0]; 1293 1292 assertEquals(3,getEffectiveSizeC(imp)); // unmerged … … 1312 1311 1313 1312 // test results 1314 assertEquals(1,imps.length);1313 impsTest(imps,1); 1315 1314 imp = imps[0]; 1316 1315 assertTrue(imp.getHeight() > 10); // required for this test to work … … 1388 1387 } 1389 1388 1390 assertEquals(1,imps.length);1389 impsTest(imps,1); 1391 1390 imp = imps[0]; 1392 1391 assertEquals(7,getSizeZ(imp)); … … 1628 1627 for (int tEnd = -1; tEnd < t+2; tEnd++) 1629 1628 for (int tInc = -1; tInc < t+2; tInc++) 1629 // if an invalid index of some kind 1630 1630 if ((zStart < 0) || (zStart >= z) || 1631 (zEnd < 0) || (zEnd >= z) || (zEnd < zStart) ||1631 (zEnd < 0) || (zEnd >= z) || // ignored by BF (zEnd < zStart) || 1632 1632 (zInc < 1) || 1633 1633 (cStart < 0) || (cStart >= c) || 1634 (cEnd < 0) || (cEnd >= c) || (cEnd < cStart) ||1634 (cEnd < 0) || (cEnd >= c) || // ignored by BF (cEnd < cStart) || 1635 1635 (cInc < 1) || 1636 1636 (tStart < 0) || (tStart >= t) || 1637 (tEnd < 0) || (tEnd >= z) ||(tEnd < tStart) ||1637 (tEnd < 0) || (tEnd >= t) || // ignored by BF (tEnd < tStart) || 1638 1638 (tInc < 1)) 1639 1639 { 1640 // expect failure 1640 1641 try { 1641 1642 memorySpecifyRangeTest(z,c,t,zFrom,zTo,zBy,cFrom,cTo,cBy,tFrom,tTo,tBy); … … 1650 1651 } 1651 1652 else 1653 // expect success 1652 1654 memorySpecifyRangeTest(z,c,t,zStart,zEnd,zInc,cStart,cEnd,cInc,tStart,tEnd,tInc); 1653 1655 */ … … 1687 1689 1688 1690 // one channel per image 1689 assertEquals(sizeC,imps.length);1691 impsTest(imps,sizeC); 1690 1692 1691 1693 // unwind ZCT loop : C pulled outside, ZT in order … … 1731 1733 1732 1734 // one focal plane per image 1733 assertEquals(sizeZ,imps.length);1735 impsTest(imps,sizeZ); 1734 1736 1735 1737 // unwind ZCT loop : Z pulled outside, CT in order … … 1775 1777 1776 1778 // one time point per image 1777 assertEquals(sizeT,imps.length);1779 impsTest(imps,sizeT); 1778 1780 1779 1781 // unwind ZTC loop : T pulled outside, ZC in order … … 1810 1812 } 1811 1813 1814 @Test 1815 public void testComboConcatColorize() 1816 { 1817 fail("unimplemented"); 1818 } 1819 1820 @Test 1821 public void testComboConcatSplit() 1822 { 1823 fail("unimplemented"); 1824 } 1825 1826 @Test 1827 public void testComboColorizeSplit() 1828 { 1829 fail("unimplemented"); 1830 } 1831 1832 @Test 1833 public void testComboConcatColorizeSplit() 1834 { 1835 fail("unimplemented"); 1836 } 1812 1837 }
Note: See TracChangeset
for help on using the changeset viewer.