diplib/file_io.h file

Functions for reading and writing images from/to files. See File I/O.

Contents

Classes

struct dip::FileInformation
A data structure with information about an image file.
class dip::OutputBuffer abstract
A pure virtual base class for output buffers.
class dip::SimpleOutputBuffer
A simple output buffer implementation.
class dip::FixedOutputBuffer
An output buffer implementation that cannot be resized.

Functions

auto dip::ImageReadICS(dip::Image& out, dip::String const& filename, dip::RangeArray const& roi = {}, dip::Range const& channels = {}, dip::String const& mode = "") -> dip::FileInformation
Read the image in the ICS file filename and puts it in out.
auto dip::ImageReadICS(dip::Image& out, dip::String const& filename, dip::UnsignedArray const& origin, dip::UnsignedArray const& sizes = {}, dip::UnsignedArray const& spacing = {}, dip::Range const& channels = {}, dip::String const& mode = "") -> dip::FileInformation
This function is an overload of the previous function that defines the ROI using different parameters.
auto dip::ImageReadICSInfo(dip::String const& filename) -> dip::FileInformation
Reads image information and metadata from the ICS file filename, without reading the actual pixel data. See dip::ImageReadICS for more details on the file format and the handling of filename.
auto dip::ImageIsICS(dip::String const& filename) -> bool
Returns true if the file filename is an ICS file.
void dip::ImageWriteICS(dip::Image const& image, dip::String const& filename, dip::StringArray const& history = {}, dip::uint significantBits = 0, dip::StringSet const& options = {})
Writes image as an ICS file.
auto dip::ImageReadTIFF(dip::Image& out, dip::String const& filename, dip::Range imageNumbers = Range{0}, dip::RangeArray const& roi = {}, dip::Range const& channels = {}, dip::String const& useColorMap = S::APPLY) -> dip::FileInformation
Reads an image from the TIFF file filename and puts it in out.
auto dip::ImageReadTIFF(dip::Image& out, dip::String const& filename, dip::Range const& imageNumbers, dip::UnsignedArray const& origin, dip::UnsignedArray const& sizes = {}, dip::UnsignedArray const& spacing = {}, dip::Range const& channels = {}, dip::String const& useColorMap = S::APPLY) -> dip::FileInformation
This function is an overload of the previous function that defines the ROI using different parameters.
void dip::ImageReadTIFFSeries(dip::Image& out, dip::StringArray const& filenames, dip::String const& useColorMap = S::APPLY)
Reads a set of 2D TIFF images as a single 3D image.
auto dip::ImageReadTIFFInfo(dip::String const& filename, dip::uint imageNumber = 0) -> dip::FileInformation
Reads image information and metadata from the TIFF file filename, without reading the actual pixel data. See dip::ImageReadTIFF for more details on the handling of filename and imageNumber.
auto dip::ImageIsTIFF(dip::String const& filename) -> bool
Returns true if the file filename is a TIFF file.
void dip::ImageWriteTIFF(dip::Image const& image, dip::String const& filename, dip::String const& compression = "", dip::uint jpegLevel = 80)
Writes image as a TIFF file.
auto dip::ImageReadJPEG(dip::Image& out, dip::String const& filename) -> dip::FileInformation
Reads an image from the JPEG file filename and puts it in out.
auto dip::ImageReadJPEGInfo(dip::String const& filename) -> dip::FileInformation
Reads image information and metadata from the JPEG file filename, without reading the actual pixel data. See dip::ImageReadJPEG for more details on the handling of filename.
auto dip::ImageIsJPEG(dip::String const& filename) -> bool
Returns true if the file filename is a JPEG file.
auto dip::ImageReadJPEG(dip::Image& out, void const* buffer, dip::uint length) -> dip::FileInformation
Reads an image from the JPEG-encoded buffer and puts it in out.
auto dip::ImageReadJPEGInfo(void const* buffer, dip::uint length) -> dip::FileInformation
Reads image information and metadata from the JPEG-encoded buffer, without reading the actual pixel data.
void dip::ImageWriteJPEG(dip::Image const& image, dip::String const& filename, dip::uint jpegLevel = 80)
Writes image as a JPEG file.
void dip::ImageWriteJPEG(dip::Image const& image, dip::OutputBuffer& buffer, dip::uint jpegLevel = 80)
Encodes image as a JPEG file and writes it to a user-created buffer. See dip::ImageWriteJPEG for details.
auto dip::ImageWriteJPEG(dip::Image const& image, dip::uint jpegLevel = 80) -> std::vector<dip::uint8>
Encodes image as a JPEG file and writes it to a buffer that is returned. See dip::ImageWriteJPEG for details.
auto dip::ImageReadPNG(dip::Image& out, dip::String const& filename) -> dip::FileInformation
Reads an image from the PNG file filename and puts it in out.
auto dip::ImageReadPNGInfo(dip::String const& filename) -> dip::FileInformation
Reads image information and metadata from the PNG file filename, without reading the actual pixel data. See dip::ImageReadPNG for more details on the handling of filename.
auto dip::ImageIsPNG(dip::String const& filename) -> bool
Returns true if the file filename is a PNG file.
auto dip::ImageReadPNG(dip::Image& out, void const* buffer, dip::uint length) -> dip::FileInformation
Reads an image from the PNG-encoded buffer and puts it in out.
auto dip::ImageReadPNGInfo(void const* buffer, dip::uint length) -> dip::FileInformation
Reads image information and metadata from the PNG-encoded buffer, without reading the actual pixel data.
void dip::ImageWritePNG(dip::Image const& image, dip::String const& filename, dip::sint compressionLevel = 6, dip::StringSet const& filterChoice = {S::ALL}, dip::uint significantBits = 0)
Writes image as a PNG file.
void dip::ImageWritePNG(dip::Image const& image, dip::OutputBuffer& buffer, dip::sint compressionLevel = 6, dip::StringSet const& filterChoice = {S::ALL}, dip::uint significantBits = 0)
Encodes image as a PNG file and writes it to a user-created buffer. See dip::ImageWritePNG for details.
auto dip::ImageWritePNG(dip::Image const& image, dip::sint compressionLevel = 6, dip::StringSet const& filterChoice = {S::ALL}, dip::uint significantBits = 0) -> std::vector<dip::uint8>
Encodes image as a PNG file and writes it to a buffer that is returned. See dip::ImageWritePNG for details.
auto dip::ImageReadNPY(dip::Image& out, dip::String const& filename) -> dip::FileInformation
Reads a numeric array from the NumPy NPY file filename and puts it in out.
auto dip::ImageReadNPYInfo(dip::String const& filename) -> dip::FileInformation
Reads array information (size and data type) from the NumPy NPY file filename, without reading the actual pixel data. See dip::ImageReadNPY for more details on the handling of filename.
auto dip::ImageIsNPY(dip::String const& filename) -> bool
Returns true if the file filename is a NPY file.
void dip::ImageWriteNPY(dip::Image const& image, dip::String const& filename)
Writes image as a numeric array to a NumPy NPY file.
auto dip::FileGetExtensionPosition(dip::String const& filename) -> String::size_type
Returns the location of the dot that separates the extension, or dip::String::npos if there is no dot.
auto dip::FileHasExtension(dip::String const& filename) -> bool
Returns true if the file name has an extension.
auto dip::FileGetExtension(dip::String const& filename) -> dip::String
Gets the extension for the given file name, or an empty string if there’s no extension.
auto dip::FileCompareExtension(dip::String const& filename, dip::String const& extension) -> bool
Returns true if the file name has the given extension.
auto dip::FileAddExtension(dip::String const& filename, dip::String const& extension) -> dip::String deprecated
Adds the given extension to the file name, replacing any existing extension.
auto dip::FileAppendExtension(dip::String const& filename, dip::String const& extension) -> dip::String
Appends the given extension to the file name.