Package org.anchoranalysis.test.image.io
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 Summary
Constructors Constructor Description TestLoaderImage(TestLoader loader)Constructs a TestLoaderImage with a given TestLoader.TestLoaderImage(TestLoader loader, StackReader stackReader) -
Method Summary
Modifier and Type Method Description booleancompareTwoImages(String path1, String path2)Compare two images that are located on the file system in the same test-folderstatic booleancompareTwoImages(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)booleancompareTwoObjectCollections(String path1, String path2)Compare two obj-mask-collection that are located on the file system in the test-folderbooleandoesPathExist(String testFilePath)Checks if a test path exists.TestLoadergetLoader()Delegate loader (for non image-related loading)ChannelopenChannelFromFilePath(Path filePath)Opens a channel from a file path.ChannelopenChannelFromTestPath(String testPath)Opens a channel from a test path.org.anchoranalysis.image.voxel.object.ObjectCollectionopenObjectsFromFilePath(Path folderPath)Opens an obj-mask-collection from a path to a fileorg.anchoranalysis.image.voxel.object.ObjectCollectionopenObjectsFromTestPath(String testDirectoryPath)Opens an object collection from a test path.StackopenStackFromFilePath(Path filePath)Opens a stack from a file path.StackopenStackFromTestPath(String testPath)Opens a stack from a test path.PathresolveTestPath(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
-
-
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 FileNotFoundExceptionCompare 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
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
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)
-