Class TestLoaderImage

Object
org.anchoranalysis.test.image.io.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

  • 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 org.anchoranalysis.image.voxel.object.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 org.anchoranalysis.image.voxel.object.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)