public unsafe void TestMinimumIntensityProjection() { const int pixels = 512 * 512; const int subsamples = 11; var rng = new PseudoRandom(0x2DB8498F); var slabData = new ushort[pixels * subsamples]; for (var n = 0; n < slabData.Length; ++n) { slabData[n] = (ushort)rng.Next(ushort.MinValue, ushort.MaxValue); } var expectedResults = new ushort[pixels]; for (var p = 0; p < pixels; ++p) { expectedResults[p] = Enumerable.Range(0, subsamples).Select(s => slabData[s * pixels + p]).Min(); } var actualResults = new ushort[pixels]; var projectedData = new byte[pixels * sizeof(ushort)]; fixed(ushort *pSlabData = slabData) { SlabProjection.AggregateSlabMinimumIntensity((IntPtr)pSlabData, projectedData, subsamples, pixels, 2, false); Buffer.BlockCopy(projectedData, 0, actualResults, 0, projectedData.Length); } Assert.AreEqual(expectedResults, actualResults); }
public void TestParallelProjectionWorkDivision() { SlabProjection.TestParallelJobDivision(13, 4); SlabProjection.TestParallelJobDivision(12, 4); SlabProjection.TestParallelJobDivision(11, 4); SlabProjection.TestParallelJobDivision(513, 4); SlabProjection.TestParallelJobDivision(512, 4); SlabProjection.TestParallelJobDivision(511, 4); SlabProjection.TestParallelJobDivision(9, 13); SlabProjection.TestParallelJobDivision(8, 13); SlabProjection.TestParallelJobDivision(7, 13); SlabProjection.TestParallelJobDivision(512 * 512 + 1, 13); SlabProjection.TestParallelJobDivision(512 * 512, 13); SlabProjection.TestParallelJobDivision(512 * 512 - 1, 13); }
public void Initialize() { SlabProjection.ForceCodeJit(); }