Class TestLoaderImage

Object
TestLoaderImage

public class TestLoaderImage extends Object
A test loader for image-related operations, providing methods to open and compare images and object collections.
  • Constructor Details

    • TestLoaderImage

      public TestLoaderImage(TestLoader loader)
      Constructs a TestLoaderImage with a given TestLoader.
      Parameters:
      loader - The TestLoader to use for non image-related loading.
    • TestLoaderImage

      public TestLoaderImage(TestLoader loader, StackReader stackReader)
      Creates a new TestLoaderImage instance.
      Parameters:
      loader - Delegate loader (for non image-related loading)
      stackReader - Reads rasters from filesystem
  • Method Details

    • openChannelFromTestPath

      public Channel openChannelFromTestPath(String testPath)
      Opens a channel from a test path.
      Parameters:
      testPath - The test path to the image file.
      Returns:
      The opened channel.
    • openChannelFromFilePath

      public Channel openChannelFromFilePath(Path filePath)
      Opens a channel from a file path.
      Parameters:
      filePath - The file path to the image file.
      Returns:
      The opened channel.
    • openStackFromTestPath

      public Stack openStackFromTestPath(String testPath)
      Opens a stack from a test path.
      Parameters:
      testPath - The test path to the image file.
      Returns:
      The opened stack.
    • openStackFromFilePath

      public Stack openStackFromFilePath(Path filePath)
      Opens a stack from a file path.
      Parameters:
      filePath - The file path to the image file.
      Returns:
      The opened stack.
    • compareTwoImages

      public boolean compareTwoImages(String path1, String path2) throws FileNotFoundException
      Compare two images that are located on the file system in the same test-folder
      Parameters:
      path1 - first-path to compare
      path2 - second-path to compare
      Returns:
      true if the images are equal (every pixel is identical, and data-types are the same)
      Throws:
      FileNotFoundException - if one or both of the files cannot be found
    • compareTwoImages

      public static boolean compareTwoImages(TestLoaderImage loader1, String path1, TestLoaderImage loader2, String path2, boolean ignoreResolutionDifferences) throws FileNotFoundException
      Compare two images that are located on the file system (possibly in different test folders)
      Parameters:
      loader1 - loader to use for path1
      path1 - first-path to compare
      loader2 - loader to use for path2
      path2 - second-path to compare
      ignoreResolutionDifferences - if true any differences in image-resolution are not considered
      Returns:
      true if the images are equal (every pixel is identical, and data-types are the same)
      Throws:
      FileNotFoundException - if one or both of the files cannot be found
    • openObjectsFromTestPath

      public ObjectCollection openObjectsFromTestPath(String testDirectoryPath)
      Opens an object collection from a test path.
      Parameters:
      testDirectoryPath - The test path to the directory containing the object collection.
      Returns:
      The opened object collection.
    • openObjectsFromFilePath

      public ObjectCollection openObjectsFromFilePath(Path folderPath)
      Opens an obj-mask-collection from a path to a file
      Parameters:
      folderPath - the path to a folder
      Returns:
      an object-mask collection
      Throws:
      TestDataLoadException - if data cannot be loaded
    • compareTwoObjectCollections

      public boolean compareTwoObjectCollections(String path1, String path2)
      Compare two obj-mask-collection that are located on the file system in the test-folder
      Parameters:
      path1 - first-path
      path2 - second-path
      Returns:
      true if the object-mask-collection are equal (every object-pixel is identical)
    • resolveTestPath

      public Path resolveTestPath(String testPath)
      Resolves a test path to an actual file system path.
      Parameters:
      testPath - The test path to resolve.
      Returns:
      The resolved file system path.
    • doesPathExist

      public boolean doesPathExist(String testFilePath)
      Checks if a test path exists.
      Parameters:
      testFilePath - The test path to check.
      Returns:
      true if the path exists, false otherwise.
    • getLoader

      public TestLoader getLoader()
      Delegate loader (for non image-related loading)