コード例 #1
0
        public void RegistrationTest()
        {
            if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                Assert.Inconclusive("Currently uses Windows Binaries");
            }

            var NiftiA = new NiftiFloat32().ReadNifti(_lrMaskNiftiPath);
            var NiftiB = new NiftiFloat32().ReadNifti(_lrNiftiPath);

            // Only doing a couple of asserts here. If something horrible goes wrong, we're expecting an exception.
            // You can also check the console output to see what the tools reckon.
            _ = Registration.ANTSRegistration(NiftiA, NiftiB, (d, e) => Console.WriteLine(e.Data));
            var outFile = Registration.ANTSApplyTransforms(_lrMaskNiftiPath, _lrNiftiPath, (d, e) => Console.WriteLine(e.Data));

            Assert.IsTrue(File.Exists(outFile), "No out file for ANTSApplyTransforms");
            _ = new NiftiFloat32().ReadNifti(outFile);

            _       = Registration.CMTKRegistration(NiftiA, NiftiB, (d, e) => Console.WriteLine(e.Data));
            outFile = Registration.CMTKResliceUsingPrevious(_lrMaskNiftiPath, _lrNiftiPath, (d, e) => Console.WriteLine(e.Data));
            Assert.IsTrue(File.Exists(outFile), "No out file for CMTKResliceUsingPrevious rego");
            NiftiA.ReadNifti(outFile);
        }