def validate_data_files(self): """Verify all loader have the same files""" if self.labeled: image_ids = self.loader_moving_image.get_data_ids() label_ids = self.loader_moving_label.get_data_ids() check_difference_between_two_lists(list1=image_ids, list2=label_ids)
def test_difference_lists_different(): """ Assert ValueError raised if two lists not identical """ list_1 = [0, 1, 2] list_2 = [3, 4, 5] with pytest.raises(ValueError): util.check_difference_between_two_lists(list_1, list_2)
def validate_data_files(self): """If the data are labeled, verify image loader and label loader have the same files""" if self.labeled is True: image_ids = self.loader_moving_image.get_data_ids() label_ids = self.loader_moving_label.get_data_ids() check_difference_between_two_lists( list1=image_ids, list2=label_ids, name="images and labels in grouped loader", )
def validate_data_files(self): """ Verify all loader have the same files. Since fixed and moving loaders come from the same file_loader, there's no need to check both (avoid duplicate) """ if self.labeled: image_ids = self.loader_moving_image.get_data_ids() label_ids = self.loader_moving_label.get_data_ids() check_difference_between_two_lists(list1=image_ids, list2=label_ids)
def test_check_difference_between_two_lists(): """ Check check_difference_between_two_lists by verifying ValueError """ # same lists, no error list1 = list2 = [0, 1, 2] util.check_difference_between_two_lists(list1, list2, name="same case") # diff lists with same unique numbers list_1 = [0, 1, 2] list_2 = [1, 2, 0] with pytest.raises(ValueError) as err_info: util.check_difference_between_two_lists(list_1, list_2, name="diff case") assert "diff case are not identical" in str(err_info.value) # totally diff lists list_1 = [0, 1, 2] list_2 = [3, 4, 5] with pytest.raises(ValueError) as err_info: util.check_difference_between_two_lists(list_1, list_2, name="diff case") assert "diff case are not identical" in str(err_info.value)
def validate_data_files(self): """Verify all loaders have the same files.""" moving_image_ids = self.loader_moving_image.get_data_ids() fixed_image_ids = self.loader_fixed_image.get_data_ids() check_difference_between_two_lists( list1=moving_image_ids, list2=fixed_image_ids, name="moving and fixed images in paired loader", ) if self.labeled: moving_label_ids = self.loader_moving_label.get_data_ids() fixed_label_ids = self.loader_fixed_label.get_data_ids() check_difference_between_two_lists( list1=moving_image_ids, list2=moving_label_ids, name="moving images and labels in paired loader", ) check_difference_between_two_lists( list1=moving_image_ids, list2=fixed_label_ids, name="fixed images and labels in paired loader", )
def test_difference_lists_same(): """ Check ValueError not raised if lists same """ list_1 = list_2 = [0, 1, 2] util.check_difference_between_two_lists(list_1, list_2)