Package org.anchoranalysis.test.image.io
Class TestLoaderImage
Object
TestLoaderImage
A test loader for image-related operations, providing methods to open and compare images and
object collections.
-
Constructor Summary
ConstructorsConstructorDescriptionTestLoaderImage
(TestLoader loader) Constructs a TestLoaderImage with a given TestLoader.TestLoaderImage
(TestLoader loader, StackReader stackReader) Creates a newTestLoaderImage
instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
compareTwoImages
(String path1, String path2) Compare two images that are located on the file system in the same test-folderstatic boolean
compareTwoImages
(TestLoaderImage loader1, String path1, TestLoaderImage loader2, String path2, boolean ignoreResolutionDifferences) Compare two images that are located on the file system (possibly in different test folders)boolean
compareTwoObjectCollections
(String path1, String path2) Compare two obj-mask-collection that are located on the file system in the test-folderboolean
doesPathExist
(String testFilePath) Checks if a test path exists.Delegate loader (for non image-related loading)openChannelFromFilePath
(Path filePath) Opens a channel from a file path.openChannelFromTestPath
(String testPath) Opens a channel from a test path.openObjectsFromFilePath
(Path folderPath) Opens an obj-mask-collection from a path to a fileopenObjectsFromTestPath
(String testDirectoryPath) Opens an object collection from a test path.openStackFromFilePath
(Path filePath) Opens a stack from a file path.openStackFromTestPath
(String testPath) Opens a stack from a test path.resolveTestPath
(String testPath) Resolves a test path to an actual file system path.
-
Constructor Details
-
TestLoaderImage
Constructs a TestLoaderImage with a given TestLoader.- Parameters:
loader
- The TestLoader to use for non image-related loading.
-
TestLoaderImage
Creates a newTestLoaderImage
instance.- Parameters:
loader
- Delegate loader (for non image-related loading)stackReader
- Reads rasters from filesystem
-
-
Method Details
-
openChannelFromTestPath
Opens a channel from a test path.- Parameters:
testPath
- The test path to the image file.- Returns:
- The opened channel.
-
openChannelFromFilePath
Opens a channel from a file path.- Parameters:
filePath
- The file path to the image file.- Returns:
- The opened channel.
-
openStackFromTestPath
Opens a stack from a test path.- Parameters:
testPath
- The test path to the image file.- Returns:
- The opened stack.
-
openStackFromFilePath
Opens a stack from a file path.- Parameters:
filePath
- The file path to the image file.- Returns:
- The opened stack.
-
compareTwoImages
Compare two images that are located on the file system in the same test-folder- Parameters:
path1
- first-path to comparepath2
- 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 path1path1
- first-path to compareloader2
- loader to use for path2path2
- second-path to compareignoreResolutionDifferences
- 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
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
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
Compare two obj-mask-collection that are located on the file system in the test-folder- Parameters:
path1
- first-pathpath2
- second-path- Returns:
- true if the object-mask-collection are equal (every object-pixel is identical)
-
resolveTestPath
Resolves a test path to an actual file system path.- Parameters:
testPath
- The test path to resolve.- Returns:
- The resolved file system path.
-
doesPathExist
Checks if a test path exists.- Parameters:
testFilePath
- The test path to check.- Returns:
- true if the path exists, false otherwise.
-
getLoader
Delegate loader (for non image-related loading)
-