コード例 #1
0
    def test_create_labelling(self, setup, valid_rgb_image_path, mock_patches):
        """
        Test creating a labelling matrix from image labels.

        Args:
            valid_rgb_image_path: A path to a valid RGB image.

        Test Condition:
            The shape of the image mask is the same as the image shape
        """
        image = Image(valid_rgb_image_path)

        image._patches = mock_patches

        image._create_labelling()

        assert image._landmark_matrix.shape == image.image.shape
コード例 #2
0
    def test_export_labels(self, setup, valid_rgb_image_path,
                           export_label_path, mock_patches):
        """
        Test exporting a landmark label matrix.

        Args:
            setup: Setup for Image tests
            valid_rgb_image_path: A path to a valid RGB image.

        Test Condition:
            The label matrix exists on the file system.
        """

        image = Image(valid_rgb_image_path)

        image._patches = mock_patches

        image.export_labels(export_label_path)

        assert os.path.exists(export_label_path)
コード例 #3
0
    def test_export_mask(self, setup, valid_rgb_image_path, export_mask_path,
                         mock_patches):
        """
        Test exporting the mask to a PNG file.

        Args:
            valid_rbg_image_path: A path to a valid RGB image.
            export_mask_path: The path to save the exported mask to

        Test Condition:
            The PNG mask file should exist.
        """

        image = Image(valid_rgb_image_path)

        image._patches = mock_patches

        image.export_mask(export_mask_path)

        assert os.path.exists(export_mask_path)
コード例 #4
0
    def test_create_mask(self, setup, valid_rgb_image_path, mock_patches):
        """
        Test creating a mask from the patches in the image.

        Args:
            valid_rgb_image_path: A path to a valid RGB image

        Test Condition:
            The shapes of the images mask is the same as the images shape
            The type of the mask is boolean
        """

        image = Image(valid_rgb_image_path)

        image._patches = mock_patches

        image._create_mask()

        assert image.mask.shape == image.image.shape
        assert image.mask.dtype == bool