예제 #1
0
    def test_normalize_air_ok(self):
        import IMAT.tomorec.reconstruction_command as cmd
        cmd = cmd.ReconstructionCommand()

        import IMAT.tomorec.configs as cfgs
        pre_conf = cfgs.PreProcConfig()

        normalized = cmd.normalize_air_region(self.data_vol, pre_conf)
        np.testing.assert_allclose(normalized, self.data_vol,
                                   err_msg="Epected normalized data volume not to changed")
예제 #2
0
    def test_normalize_air_ok(self):
        import IMAT.tomorec.reconstruction_command as cmd
        cmd = cmd.ReconstructionCommand()

        import IMAT.tomorec.configs as cfgs
        pre_conf = cfgs.PreProcConfig()

        normalized = cmd.normalize_air_region(self.data_vol, pre_conf)
        np.testing.assert_allclose(
            normalized,
            self.data_vol,
            err_msg="Epected normalized data volume not to changed")
예제 #3
0
    def test_normalize_air_raises(self):
        import IMAT.tomorec.reconstruction_command as cmd
        cmd = cmd.ReconstructionCommand()

        import IMAT.tomorec.configs as cfgs
        pre_conf = cfgs.PreProcConfig()
        alg_conf = cfgs.ToolAlgorithmConfig()
        post_conf = cfgs.PostProcConfig()
        conf = cfgs.ReconstructionConfig(pre_conf, alg_conf, post_conf)

        normalized = cmd.normalize_air_region(self.data_vol, pre_conf)
        np.testing.assert_allclose(normalized, self.data_vol,
                                   err_msg="Epected normalized data volume not to changed")

        # absolutely invalid data
        with self.assertRaises(ValueError):
            cmd.normalize_air_region([], pre_conf)

        # wrong data dimensions
        with self.assertRaises(ValueError):
            cmd.normalize_air_region(np.ones((3, 2)), pre_conf)

        # invalid configurations
        with self.assertRaises(ValueError):
            cmd.normalize_air_region(self.data_vol, alg_conf)

        with self.assertRaises(ValueError):
            cmd.normalize_air_region(self.data_vol, post_conf)

        with self.assertRaises(ValueError):
            cmd.normalize_air_region(self.data_vol, conf)

        # wrong air-regions
        pre_conf.normalize_air_region = [3]
        with self.assertRaises(ValueError):
            cmd.normalize_air_region(self.data_vol, pre_conf)

        pre_conf.normalize_air_region = (3, 0, 100, 10)
        with self.assertRaises(ValueError):
            cmd.normalize_air_region(self.data_vol, pre_conf)

        pre_conf.normalize_air_region = [3, 0, 100]
        with self.assertRaises(ValueError):
            cmd.normalize_air_region(self.data_vol, pre_conf)