Package net.algart.external
Class MatrixIO
java.lang.Object
net.algart.external.MatrixIO
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
clearAlgARTImageTemporaryStatus
(List<Matrix<? extends PArray>> image) Should be called if you are going to callwriteAlgARTImage(Path, List, boolean)
with allowReferencesToStandardLargeFiles=true from an external algorithm before its finishing (to return its results).deserializeAlgARTMatrix
(InputStream inputStream, MatrixIO.SerializationMode serializationMode, MemoryModel memoryModel) static String
static String
static String
static String
static String
static String
readAlgARTImage
(Path folder) Loads the multichannel image (list of matrices), saved in the specified folder bywriteAlgARTImage(Path, List)
call.readAlgARTMatrix
(Path folder) static BufferedImage
readBufferedImage
(Path file) static List<Matrix<UpdatablePArray>>
static String
removeExtension
(String fileName) static void
serializeAlgARTMatrix
(Matrix<? extends PArray> matrix, OutputStream outputStream, MatrixIO.SerializationMode serializationMode, ByteOrder byteOrder) static void
writeAlgARTImage
(Path folder, List<? extends Matrix<? extends PArray>> image) static void
writeAlgARTImage
(Path folder, List<? extends Matrix<? extends PArray>> image, boolean allowReferencesToStandardLargeFiles) Saves the multichannel image (list of matrices) in the specified folder.static void
writeAlgARTMatrix
(Path folder, Matrix<? extends PArray> matrix) static void
writeBufferedImage
(Path file, BufferedImage image) static void
writeImage
(Path file, List<? extends Matrix<? extends PArray>> image)
-
Constructor Details
-
MatrixIO
public MatrixIO()
-
-
Method Details
-
extension
-
extension
-
extension
-
extension
-
extension
-
extension
-
removeExtension
-
writeBufferedImage
- Throws:
IOException
-
readBufferedImage
- Throws:
IOException
-
writeImage
public static void writeImage(Path file, List<? extends Matrix<? extends PArray>> image) throws IOException - Throws:
IOException
-
readImage
- Throws:
IOException
-
clearAlgARTImageTemporaryStatus
Should be called if you are going to callwriteAlgARTImage(Path, List, boolean)
with allowReferencesToStandardLargeFiles=true from an external algorithm before its finishing (to return its results).- Parameters:
image
- matrices, for built-in arrays of which you want to clear the temporary status
-
writeAlgARTImage
public static void writeAlgARTImage(Path folder, List<? extends Matrix<? extends PArray>> image) throws IOException - Throws:
IOException
-
writeAlgARTImage
public static void writeAlgARTImage(Path folder, List<? extends Matrix<? extends PArray>> image, boolean allowReferencesToStandardLargeFiles) throws IOException Saves the multichannel image (list of matrices) in the specified folder. Matrices are saved in several files in very simple format without any compression. If this folder already contain an image, saved by previous call of this method, it is automatically deleted (replaced with the new one).- Parameters:
folder
- folder to save the image.image
- some multichannel imageallowReferencesToStandardLargeFiles
- if true, and if one of passed matrices is mapped to some file F byLargeMemoryModel
, this method does not write the matrix content and saves a little text "reference" file with information about the path to this file F.- Throws:
IOException
- in a case of I/O error.NullPointerException
- if one of the arguments or elements of image list is null.
-
readAlgARTImage
Loads the multichannel image (list of matrices), saved in the specified folder bywriteAlgARTImage(Path, List)
call.Note: the files containing the matrices retain open, and any access to the returned matrices will lead to operations with these files (mapping). Usually you should copy the returned matrices to some other memory model and call
Matrix.freeResources()
for them to close these files.- Parameters:
folder
- folder with multichannel image, stored in a set of files.- Returns:
- all channels of this image.
- Throws:
IOException
- in a case of I/O error.NullPointerException
- if the argument is null.
-
writeAlgARTMatrix
public static void writeAlgARTMatrix(Path folder, Matrix<? extends PArray> matrix) throws IOException - Throws:
IOException
-
readAlgARTMatrix
- Throws:
IOException
-
serializeAlgARTMatrix
public static void serializeAlgARTMatrix(Matrix<? extends PArray> matrix, OutputStream outputStream, MatrixIO.SerializationMode serializationMode, ByteOrder byteOrder) throws IOException - Throws:
IOException
-
deserializeAlgARTMatrix
public static Matrix<? extends PArray> deserializeAlgARTMatrix(InputStream inputStream, MatrixIO.SerializationMode serializationMode, MemoryModel memoryModel) throws IOException - Throws:
IOException
-