Esempio n. 1
0
    def test_get_conf(self):
        ci = ConvertImage('ci')
        c = ci.get_config()
        nt.assert_list_equal(c.available_keys(), ['ci:type'])
        nt.assert_equal(c.get_value('ci:type'), '')

        ci = ConvertImage.create('ci', 'bypass')
        c = ci.get_config()
        nt.assert_equal(c.get_value('ci:type'), 'bypass')
Esempio n. 2
0
 def test_clone(self):
     # inst_ptr will be null for both
     ci1 = ConvertImage('ci')
     ci2 = ci1.clone()
     nt.assert_false(ci1)
     nt.assert_false(ci2)
     nt.assert_not_equal(ci1.c_pointer, ci2.c_pointer)
     # They should both be null
     nt.assert_equal(mem_address(ci1.c_pointer), mem_address(ci2.c_pointer))
Esempio n. 3
0
    def test_set_name(self):
        algo_name = 'ci'
        other_name = "other_name"

        ci = ConvertImage(algo_name)
        nt.assert_equal(ci.name, algo_name)
        ci.set_name(other_name)
        nt.assert_not_equal(ci.name, algo_name)
        nt.assert_equal(ci.name, other_name)
Esempio n. 4
0
    def test_set_conf(self):
        ci = ConvertImage('ci')
        nt.assert_false(ci)
        nt.assert_is_none(ci.impl_name())

        c = ConfigBlock()
        c.set_value('ci:type', 'bypass')
        ci.set_config(c)
        nt.assert_true(ci)
        nt.assert_equal(ci.impl_name(), 'bypass')
Esempio n. 5
0
    def test_check_conf(self):
        ci = ConvertImage('ci')
        c = config_block()
        nt.assert_false(ci.check_config(c))

        c.set_value('ci:type', '')
        nt.assert_false(ci.check_config(c))

        c.set_value('ci:type', 'not_an_impl')
        nt.assert_false(ci.check_config(c))
Esempio n. 6
0
    def __init__(self):
        AlgorithmPluginManager.register_plugins()

        # Algorithms
        self.algo_convert_img = ConvertImage("convert_image")
        self.algo_image_io = ImageIo("image_reader")
        self.algo_track_features = TrackFeatures("feature_tracker")

        # Other tool variables
        self.image_list_filepath = None
        self.mask_list_filepath = None
        self.invert_masks = False
        self.expect_multichannel_masks = False
        self.output_tracks_filepath = None
Esempio n. 7
0
def base_algorithms(c=ConfigBlock()):
    """
    Determine the algorithms and algorithm names used in this utility
    :type c: vital.ConfigBlock
    """
    iio = ImageIo('image_reader')
    iio.set_config(c)

    ci = ConvertImage('convert_image')
    ci.set_config(c)

    tf = TrackFeatures('feature_tracker')
    tf.set_config(c)

    return iio, ci, tf
Esempio n. 8
0
 def test_typename(self):
     ci = ConvertImage('ci')
     nt.assert_equal(ci.type_name(), "convert_image")
Esempio n. 9
0
 def test_from_c_ptr_copy(self):
     ci = ConvertImage('ci')
     ci_new = ConvertImage.from_c_pointer(ci.c_pointer, ci)
     nt.assert_is(ci.c_pointer, ci_new.c_pointer)
     nt.assert_equal(ci_new.name, ci.name)
Esempio n. 10
0
 def test_new(self):
     ci = ConvertImage('ci')
     nt.assert_false(ci)
     nt.assert_false(ci.c_pointer)
Esempio n. 11
0
 def test_set_conf(self):
     ci = ConvertImage('ci')
     nt.assert_false(ci)
     nt.assert_is_none(ci.impl_name())
Esempio n. 12
0
 def test_get_conf(self):
     ci = ConvertImage('ci')
     c = ci.get_config()
     nt.assert_list_equal(c.available_keys(), ['ci:type'])
     nt.assert_true(c.has_value('ci:type'))
     nt.assert_equal(c.get_value('ci:type'), '')
Esempio n. 13
0
 def test_clone_empty(self):
     ci_empty = ConvertImage('ci')
     ci_empty2 = ci_empty.clone()
     nt.assert_false(ci_empty)
     nt.assert_false(ci_empty2)
Esempio n. 14
0
 def test_impl_name(self):
     ci_empty = ConvertImage('ci')
     nt.assert_is_none(ci_empty.impl_name())
     ci_bypass = ConvertImage.create('ci', 'bypass')
     nt.assert_equal(ci_bypass.impl_name(), 'bypass')
Esempio n. 15
0
 def test_impl_name(self):
     ci_empty = ConvertImage('ci')
     nt.assert_is_none(ci_empty.impl_name())
Esempio n. 16
0
 def test_name(self):
     name = 'algo_name'
     ci = ConvertImage(name)
     nt.assert_equal(ci.name, name)
Esempio n. 17
0
 def test_from_c_ptr_null(self):
     ci = ConvertImage(
         name='ci',
         from_cptr=ConvertImage.C_TYPE_PTR(),
     )
     nt.assert_false(ci.c_pointer)