Package qupath.opencv.tools
Class NumpyTools
java.lang.Object
qupath.opencv.tools.NumpyTools
Read .npy and .npz files from NumPy.
 
Note that only a subset of files are supported. Specifically, each .npy file should contain a single (possibly multidimensional) array with a type supported by OpenCV.
Structured, complex and object arrays are not supported.
See https://numpy.org/devdocs/reference/generated/numpy.lib.format.html for more information about the format.
- Since:
- v0.4.0
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionreadAllMats(String path) Read a all Mats from an .npy or .npz file.readAllMats(String path, boolean squeezeDimensions) Read a all Mats from an .npy or .npz file, optionally squeezing singleton dimensions.readAllMats(Path path) Read a all Mats from an .npy or .npz path.readAllMats(Path path, boolean squeezeDimensions) Read a all Mats from an .npy or .npz path, optionally squeezing singleton dimensions This will be a single Mat for .npy but may be multiple for .npz.static MatreadMat(InputStream stream, boolean squeezeDimensions) Read a single Mat from an input stream, which should follow the .npy file format specification.static MatRead a single Mat from an .npy or .npz file.static MatRead a single Mat from an .npy or .npz file, optionally squeezing singleton dimensions.static MatRead an OpenCV Mat from a Numpy .npy file.static MatRead an OpenCV Mat from a Numpy .npy file, optionally squeezing singleton dimensions.
- 
Constructor Details- 
NumpyToolspublic NumpyTools()
 
- 
- 
Method Details- 
readMatRead a single Mat from an .npy or .npz file.- Parameters:
- path-
- Returns:
- Throws:
- IOException
 
- 
readMatRead a single Mat from an .npy or .npz file, optionally squeezing singleton dimensions.- Parameters:
- path- path to the .npy file
- squeezeDimensions- if true, squeeze singleton dimensions
- Returns:
- Throws:
- IOException
 
- 
readAllMatsRead a all Mats from an .npy or .npz file. This will be a single Mat for .npy but may be multiple for .npz.- Parameters:
- path- path to the file
- Returns:
- a map with mat names (from file/entry names) and their corresponding Mats
- Throws:
- IOException
 
- 
readAllMatspublic static Map<String,Mat> readAllMats(String path, boolean squeezeDimensions) throws IOException Read a all Mats from an .npy or .npz file, optionally squeezing singleton dimensions. This will be a single Mat for .npy but may be multiple for .npz.- Parameters:
- path- path to the file
- squeezeDimensions- if true, squeeze singleton dimensions
- Returns:
- a map with mat names (from file/entry names) and their corresponding Mats
- Throws:
- IOException
 
- 
readAllMatsRead a all Mats from an .npy or .npz path. This will be a single Mat for .npy but may be multiple for .npz.- Parameters:
- path- path to the file
- Returns:
- a map with mat names (from file/entry names) and their corresponding Mats
- Throws:
- IOException
 
- 
readAllMatsRead a all Mats from an .npy or .npz path, optionally squeezing singleton dimensions This will be a single Mat for .npy but may be multiple for .npz.- Parameters:
- path- path to the file
- squeezeDimensions- if true, squeeze singleton dimensions
- Returns:
- a map with mat names (from file/entry names) and their corresponding Mats
- Throws:
- IOException
 
- 
readMatRead an OpenCV Mat from a Numpy .npy file.- Parameters:
- path- path to the .npy file
- Returns:
- Throws:
- IOException- if a Mat could not be read from the given path
 
- 
readMatRead an OpenCV Mat from a Numpy .npy file, optionally squeezing singleton dimensions.- Parameters:
- path- path to the .npy file
- squeezeDimensions- if true, squeeze singleton dimensions
- Returns:
- Throws:
- IOException- if a Mat could not be read from the given path
 
- 
readMatRead a single Mat from an input stream, which should follow the .npy file format specification.- Parameters:
- stream-
- squeezeDimensions-
- Returns:
- Throws:
- IOException
 
 
-