@@ -1757,7 +1757,6 @@ public void getDirectionalVoxelSubset_allApical_returnsCorrectBag() {
17571757 for (int i = 0 ; i < 5 ; i ++) {
17581758 voxels .add (new Voxel (0 , 0 , i ));
17591759 expected .add (new Voxel (0 , 0 , i ));
1760-
17611760 }
17621761 Bag result =
17631762 PottsLocation .getDirectionalVoxelSubset (
@@ -1793,9 +1792,13 @@ public void getDirectionalVoxelSubset_noApical_returnsCorrectBag() {
17931792 public void getDirectionalVoxelSubset_singleVoxelBasal_returnsIt () {
17941793 ArrayList <Voxel > voxels = new ArrayList <>();
17951794 voxels .add (new Voxel (3 , 4 , 5 ));
1796- Bag result = PottsLocation .getDirectionalVoxelSubset (
1797- PottsEnums .Side .BASAL , 0.5 , voxels ,
1798- new double []{0 , 0 , 0 }, new Vector (0 , 0 , 1 ));
1795+ Bag result =
1796+ PottsLocation .getDirectionalVoxelSubset (
1797+ PottsEnums .Side .BASAL ,
1798+ 0.5 ,
1799+ voxels ,
1800+ new double [] {0 , 0 , 0 },
1801+ new Vector (0 , 0 , 1 ));
17991802 assertEquals (1 , result .size ());
18001803 assertTrue (result .contains (new Voxel (3 , 4 , 5 )));
18011804 }
@@ -1804,9 +1807,13 @@ public void getDirectionalVoxelSubset_singleVoxelBasal_returnsIt() {
18041807 public void getDirectionalVoxelSubset_singleVoxelApical_returnsIt () {
18051808 ArrayList <Voxel > voxels = new ArrayList <>();
18061809 voxels .add (new Voxel (3 , 4 , 5 ));
1807- Bag result = PottsLocation .getDirectionalVoxelSubset (
1808- PottsEnums .Side .APICAL , 0.5 , voxels ,
1809- new double []{0 , 0 , 0 }, new Vector (0 , 0 , 1 ));
1810+ Bag result =
1811+ PottsLocation .getDirectionalVoxelSubset (
1812+ PottsEnums .Side .APICAL ,
1813+ 0.5 ,
1814+ voxels ,
1815+ new double [] {0 , 0 , 0 },
1816+ new Vector (0 , 0 , 1 ));
18101817 assertEquals (1 , result .size ());
18111818 assertTrue (result .contains (new Voxel (3 , 4 , 5 )));
18121819 }
@@ -1815,37 +1822,45 @@ public void getDirectionalVoxelSubset_singleVoxelApical_returnsIt() {
18151822 public void getDirectionalVoxelSubset_negativeThreshold_throwsIllegalArgument () {
18161823 ArrayList <Voxel > voxels = new ArrayList <>();
18171824 voxels .add (new Voxel (0 , 0 , 0 ));
1818- assertThrows (IllegalArgumentException .class , () ->
1819- PottsLocation .getDirectionalVoxelSubset (
1820- PottsEnums .Side .BASAL ,
1821- -0.5 ,
1822- voxels ,
1823- new double []{0 , 0 , 0 },
1824- new Vector (0 , 0 , 1 )));
1825+ assertThrows (
1826+ IllegalArgumentException .class ,
1827+ () ->
1828+ PottsLocation .getDirectionalVoxelSubset (
1829+ PottsEnums .Side .BASAL ,
1830+ -0.5 ,
1831+ voxels ,
1832+ new double [] {0 , 0 , 0 },
1833+ new Vector (0 , 0 , 1 )));
18251834 }
18261835
18271836 @ Test
18281837 public void getDirectionalVoxelSubset_thresholdAboveOne_throwsIllegalArgument () {
18291838 ArrayList <Voxel > voxels = new ArrayList <>();
18301839 voxels .add (new Voxel (0 , 0 , 0 ));
1831- assertThrows (IllegalArgumentException .class , () ->
1832- PottsLocation .getDirectionalVoxelSubset (
1833- PottsEnums .Side .BASAL ,
1834- 1.5 ,
1835- voxels ,
1836- new double []{0 , 0 , 0 },
1837- new Vector (0 , 0 , 1 )));
1840+ assertThrows (
1841+ IllegalArgumentException .class ,
1842+ () ->
1843+ PottsLocation .getDirectionalVoxelSubset (
1844+ PottsEnums .Side .BASAL ,
1845+ 1.5 ,
1846+ voxels ,
1847+ new double [] {0 , 0 , 0 },
1848+ new Vector (0 , 0 , 1 )));
18381849 }
18391850
18401851 @ Test
18411852 public void getDirectionalVoxelSubset_invalidSide_throwsIllegalArgument () {
18421853 ArrayList <Voxel > voxels = new ArrayList <>();
18431854 voxels .add (new Voxel (0 , 0 , 0 ));
1844- assertThrows (IllegalArgumentException .class , () ->
1845- PottsLocation .getDirectionalVoxelSubset (
1846- PottsEnums .Side .UNDEFINED ,
1847- 0.5 , voxels ,
1848- new double []{0 , 0 , 0 }, new Vector (0 , 0 , 1 )));
1855+ assertThrows (
1856+ IllegalArgumentException .class ,
1857+ () ->
1858+ PottsLocation .getDirectionalVoxelSubset (
1859+ PottsEnums .Side .UNDEFINED ,
1860+ 0.5 ,
1861+ voxels ,
1862+ new double [] {0 , 0 , 0 },
1863+ new Vector (0 , 0 , 1 )));
18491864 }
18501865
18511866 @ Test
@@ -1857,10 +1872,12 @@ public void getDirectionalVoxelSubset_halfBasalHalfApical_noOverlap() {
18571872 double [] centroid = {0 , 0 , 0 };
18581873 Vector axis = new Vector (0 , 0 , 1 );
18591874
1860- Bag basal = PottsLocation .getDirectionalVoxelSubset (
1861- PottsEnums .Side .BASAL , 0.5 , voxels , centroid , axis );
1862- Bag apical = PottsLocation .getDirectionalVoxelSubset (
1863- PottsEnums .Side .APICAL , 0.5 , voxels , centroid , axis );
1875+ Bag basal =
1876+ PottsLocation .getDirectionalVoxelSubset (
1877+ PottsEnums .Side .BASAL , 0.5 , voxels , centroid , axis );
1878+ Bag apical =
1879+ PottsLocation .getDirectionalVoxelSubset (
1880+ PottsEnums .Side .APICAL , 0.5 , voxels , centroid , axis );
18641881
18651882 for (Object v : basal ) {
18661883 assertFalse (apical .contains (v ));
@@ -1876,10 +1893,12 @@ public void getDirectionalVoxelSubset_voxelsInBothBags_hasOverlap() {
18761893 double [] centroid = {0 , 0 , 0 };
18771894 Vector axis = new Vector (0 , 0 , 1 );
18781895
1879- Bag basal = PottsLocation .getDirectionalVoxelSubset (
1880- PottsEnums .Side .BASAL , 0.5 , voxels , centroid , axis );
1881- Bag apical = PottsLocation .getDirectionalVoxelSubset (
1882- PottsEnums .Side .APICAL , 0.5 , voxels , centroid , axis );
1896+ Bag basal =
1897+ PottsLocation .getDirectionalVoxelSubset (
1898+ PottsEnums .Side .BASAL , 0.5 , voxels , centroid , axis );
1899+ Bag apical =
1900+ PottsLocation .getDirectionalVoxelSubset (
1901+ PottsEnums .Side .APICAL , 0.5 , voxels , centroid , axis );
18831902
18841903 boolean voxelOnLineInBasal = false ;
18851904 for (Object v : basal ) {
@@ -1899,9 +1918,13 @@ public void getDirectionalVoxelSubset_nonZeroCentroid_returnsCorrectBasalHalf()
18991918 for (int i = 10 ; i < 20 ; i ++) {
19001919 voxels .add (new Voxel (0 , 0 , i ));
19011920 }
1902- Bag result = PottsLocation .getDirectionalVoxelSubset (
1903- PottsEnums .Side .BASAL , 0.5 , voxels ,
1904- new double []{0 , 0 , 14.5 }, new Vector (0 , 0 , 1 ));
1921+ Bag result =
1922+ PottsLocation .getDirectionalVoxelSubset (
1923+ PottsEnums .Side .BASAL ,
1924+ 0.5 ,
1925+ voxels ,
1926+ new double [] {0 , 0 , 14.5 },
1927+ new Vector (0 , 0 , 1 ));
19051928 assertEquals (5 , result .size ());
19061929 for (int i = 10 ; i < 15 ; i ++) {
19071930 assertTrue (result .contains (new Voxel (0 , 0 , i )));
@@ -1915,9 +1938,13 @@ public void getDirectionalVoxelSubset_diagonalAxis_halfBasal_returnsCorrectBag()
19151938 voxels .add (new Voxel (i , i , 0 ));
19161939 }
19171940 double inv = 1.0 / Math .sqrt (2 );
1918- Bag result = PottsLocation .getDirectionalVoxelSubset (
1919- PottsEnums .Side .BASAL , 0.5 , voxels ,
1920- new double []{0 , 0 , 0 }, new Vector (inv , inv , 0 ));
1941+ Bag result =
1942+ PottsLocation .getDirectionalVoxelSubset (
1943+ PottsEnums .Side .BASAL ,
1944+ 0.5 ,
1945+ voxels ,
1946+ new double [] {0 , 0 , 0 },
1947+ new Vector (inv , inv , 0 ));
19211948 assertEquals (3 , result .size ());
19221949 assertTrue (result .contains (new Voxel (0 , 0 , 0 )));
19231950 assertTrue (result .contains (new Voxel (1 , 1 , 0 )));
@@ -1931,9 +1958,13 @@ public void getDirectionalVoxelSubset_diagonalAxis_halfApical_returnsCorrectBag(
19311958 voxels .add (new Voxel (i , i , 0 ));
19321959 }
19331960 double inv = 1.0 / Math .sqrt (2 );
1934- Bag result = PottsLocation .getDirectionalVoxelSubset (
1935- PottsEnums .Side .APICAL , 0.5 , voxels ,
1936- new double []{0 , 0 , 0 }, new Vector (inv , inv , 0 ));
1961+ Bag result =
1962+ PottsLocation .getDirectionalVoxelSubset (
1963+ PottsEnums .Side .APICAL ,
1964+ 0.5 ,
1965+ voxels ,
1966+ new double [] {0 , 0 , 0 },
1967+ new Vector (inv , inv , 0 ));
19371968 assertEquals (3 , result .size ());
19381969 assertTrue (result .contains (new Voxel (2 , 2 , 0 )));
19391970 assertTrue (result .contains (new Voxel (3 , 3 , 0 )));
@@ -1948,13 +1979,16 @@ public void getDirectionalVoxelSubset_varyingXY_doesNotAffectProjectionOnZAxis()
19481979 voxels .add (new Voxel (2 , 7 , 2 ));
19491980 voxels .add (new Voxel (8 , 0 , 3 ));
19501981 voxels .add (new Voxel (4 , 4 , 4 ));
1951- Bag result = PottsLocation .getDirectionalVoxelSubset (
1952- PottsEnums .Side .BASAL , 0.5 , voxels ,
1953- new double []{0 , 0 , 0 }, new Vector (0 , 0 , 1 ));
1982+ Bag result =
1983+ PottsLocation .getDirectionalVoxelSubset (
1984+ PottsEnums .Side .BASAL ,
1985+ 0.5 ,
1986+ voxels ,
1987+ new double [] {0 , 0 , 0 },
1988+ new Vector (0 , 0 , 1 ));
19541989 assertEquals (3 , result .size ());
19551990 assertTrue (result .contains (new Voxel (5 , 3 , 0 )));
19561991 assertTrue (result .contains (new Voxel (1 , 9 , 1 )));
19571992 assertTrue (result .contains (new Voxel (2 , 7 , 2 )));
19581993 }
1959-
19601994}
0 commit comments