![]() |
Visual Servoing Platform version 3.7.0
|
Classes | |
| struct | NpyArray |
Typedefs | |
| using | npz_t = std::map<std::string, NpyArray> |
Functions | |
| VISP_EXPORT npz_t | npz_load (const std::string &fname) |
| VISP_EXPORT char | BigEndianTest () |
| VISP_EXPORT char | map_type (const std::type_info &t) |
| template<typename T> | |
| std::vector< char > | create_npy_header (const std::vector< size_t > &shape) |
| VISP_EXPORT void | parse_npy_header (FILE *fp, size_t &word_size, std::vector< size_t > &shape, bool &fortran_order, bool &little_endian, char &data_type) |
| VISP_EXPORT void | parse_npy_header (unsigned char *buffer, size_t &word_size, std::vector< size_t > &shape, bool &fortran_order, bool &little_endian, char &data_type) |
| VISP_EXPORT void | parse_zip_footer (FILE *fp, uint16_t &nrecs, size_t &global_header_size, size_t &global_header_offset) |
| VISP_EXPORT NpyArray | npz_load (const std::string &fname, const std::string &varname) |
| VISP_EXPORT NpyArray | npy_load (const std::string &fname) |
| VISP_EXPORT void | npz_save (const std::string &zipname, std::string fname, const std::vector< std::string > &data_vec, const std::vector< size_t > &shape, const std::string &mode="w") |
| VISP_EXPORT void | npz_save (const std::string &zipname, const std::string &fname, const std::string &data, const std::string &mode="w") |
| template<typename T> | |
| std::vector< char > & | operator+= (std::vector< char > &lhs, const T rhs) |
| template<> | |
| std::vector< char > & | operator+= (std::vector< char > &lhs, const std::string rhs) |
| template<> | |
| std::vector< char > & | operator+= (std::vector< char > &lhs, const char *rhs) |
| template<typename T> | |
| void | npy_save (const std::string &fname, const T *data, const std::vector< size_t > &shape, const std::string &mode="w") |
| template<typename T> | |
| void | npz_save (const std::string &zipname, std::string fname, const T *data, const std::vector< size_t > &shape, const std::string &mode="w") |
| template<typename T> | |
| void | npy_save (const std::string &fname, const std::vector< T > &data, const std::string &mode="w") |
| template<typename T> | |
| void | npz_save (const std::string &zipname, const std::string &fname, const std::vector< T > &data, const std::string &mode="w") |
| std::vector< char > | create_npy_header_string (const std::vector< size_t > &shape, const std::vector< size_t > &lengths) |
| std::vector< char > | utf8_to_utf32_vec_pad (const std::string &utf8, const std::size_t &max_size) |
Helpers to convert NPY/NPZ format to/from ViSP format.
Tutorials
If you are interested in converting NPY/NPZ format to/from ViSP format, you may have a look at:
| using visp::cnpy::npz_t = std::map<std::string, NpyArray> |
Definition at line 177 of file vpIoTools.h.
| char visp::cnpy::BigEndianTest | ( | ) |
Definition at line 145 of file vpIoTools_npy.cpp.
Referenced by create_npy_header(), and create_npy_header_string().
| std::vector< char > visp::cnpy::create_npy_header | ( | const std::vector< size_t > & | shape | ) |
Definition at line 456 of file vpIoTools.h.
References BigEndianTest(), map_type(), and vpEndian::swap16bits().
Referenced by npy_save(), and npz_save().
| std::vector< char > visp::cnpy::create_npy_header_string | ( | const std::vector< size_t > & | shape, |
| const std::vector< size_t > & | lengths ) |
Definition at line 656 of file vpIoTools_npy.cpp.
References BigEndianTest(), map_type(), and vpEndian::swap16bits().
Referenced by npz_save().
| char visp::cnpy::map_type | ( | const std::type_info & | t | ) |
Definition at line 151 of file vpIoTools_npy.cpp.
Referenced by create_npy_header(), and create_npy_header_string().
| visp::cnpy::NpyArray visp::cnpy::npy_load | ( | const std::string & | fname | ) |
Load the specified npy fname filepath as one array of data. This function is similar to the numpy.load function.
| [in] | fname | : Path to the npy file. |
Definition at line 594 of file vpIoTools_npy.cpp.
References vpIoTools::checkFilename(), and vpException::ioError.
Referenced by vpDiskGrabber::acquire().
| void visp::cnpy::npy_save | ( | const std::string & | fname, |
| const std::vector< T > & | data, | ||
| const std::string & | mode = "w" ) |
Save the specified 1-D array of data (data) into the fname npz file. This function is similar to the numpy.save function.
| [in] | fname | : Path to the npy file. |
| [in] | data | : Pointer to a 1-D array of basic datatype (int, float, double, std::complex<double>, ...). |
| [in] | mode | : Writing mode, i.e. overwrite (w) or append (a) to the file. |
Definition at line 430 of file vpIoTools.h.
References npy_save().
| void visp::cnpy::npy_save | ( | const std::string & | fname, |
| const T * | data, | ||
| const std::vector< size_t > & | shape, | ||
| const std::string & | mode = "w" ) |
Save an array of data (data) into the fname npy file. This function is similar to the numpy.save function.
| [in] | fname | : Path to the npy file. |
| [in] | data | : Pointer to an array of basic datatype (int, float, double, std::complex<double>, ...). |
| [in] | shape | : Shape of the array, e.g. Nz x Ny x Nx. |
| [in] | mode | : Writing mode, i.e. overwrite (w) or append (a) to the file. |
Definition at line 228 of file vpIoTools.h.
References create_npy_header(), and parse_npy_header().
Referenced by npy_save().
| visp::cnpy::npz_t visp::cnpy::npz_load | ( | const std::string & | fname | ) |
Load the specified fname filepath as arrays of data. This function is similar to the numpy.load function.
| [in] | fname | : Path to the npz file. |
Definition at line 420 of file vpIoTools_npy.cpp.
References vpIoTools::checkFilename(), and vpException::ioError.
| visp::cnpy::NpyArray visp::cnpy::npz_load | ( | const std::string & | fname, |
| const std::string & | varname ) |
Load the specified varname array of data from the fname npz file. This function is similar to the numpy.load function.
| [in] | fname | : Path to the npz file. |
| [in] | varname | : Identifier for the requested array of data. |
Definition at line 511 of file vpIoTools_npy.cpp.
References vpIoTools::checkFilename(), and vpException::ioError.
| void visp::cnpy::npz_save | ( | const std::string & | zipname, |
| const std::string & | fname, | ||
| const std::string & | data_str, | ||
| const std::string & | mode = "w" ) |
Save the specified fname std::string (data_str) into the zipname npz file. This function is similar to the numpy.savez function.
| [in] | zipname | : Path to the npz file. |
| [in] | fname | : Identifier for the corresponding array of data. |
| [in] | data_str | : C++ std::string data. |
| [in] | mode | : Writing mode, i.e. overwrite (w) or append (a) to the file. |
Definition at line 919 of file vpIoTools_npy.cpp.
References npz_save().
| void visp::cnpy::npz_save | ( | const std::string & | zipname, |
| const std::string & | fname, | ||
| const std::vector< T > & | data, | ||
| const std::string & | mode = "w" ) |
Save the specified fname 1-D array of data (data) into the zipname npz file. This function is similar to the numpy.savez function.
| [in] | zipname | : Path to the npz file. |
| [in] | fname | : Identifier for the corresponding array of data. |
| [in] | data | : Pointer to a 1-D array of basic datatype (int, float, double, std::complex<double>, ...). |
| [in] | mode | : Writing mode, i.e. overwrite (w) or append (a) to the file. |
Definition at line 449 of file vpIoTools.h.
References npz_save().
| void visp::cnpy::npz_save | ( | const std::string & | zipname, |
| std::string | fname, | ||
| const std::vector< std::string > & | data_vec, | ||
| const std::vector< size_t > & | shape, | ||
| const std::string & | mode = "w" ) |
Save the specified fname vector of std::string (data) into the zipname npz file. This function is similar to the numpy.savez function.
| [in] | zipname | : Path to the npz file. |
| [in] | fname | : Identifier for the corresponding array of data. |
| [in] | data_vec | : Vector of std::string. |
| [in] | shape | : Shape of the array, e.g. Nz x Ny x Nx. |
| [in] | mode | : Writing mode, i.e. overwrite (w) or append (a) to the file. |
Definition at line 758 of file vpIoTools_npy.cpp.
References vpException::badValue, create_npy_header_string(), vpException::dimensionError, parse_zip_footer(), vpEndian::swap16bits(), vpEndian::swap32bits(), and utf8_to_utf32_vec_pad().
Referenced by npz_save(), and npz_save().
| void visp::cnpy::npz_save | ( | const std::string & | zipname, |
| std::string | fname, | ||
| const T * | data, | ||
| const std::vector< size_t > & | shape, | ||
| const std::string & | mode = "w" ) |
Save the specified fname array of data (data) into the zipname npz file. This function is similar to the numpy.savez function.
| [in] | zipname | : Path to the npz file. |
| [in] | fname | : Identifier for the corresponding array of data. |
| [in] | data | : Pointer to an array of basic datatype (int, float, double, std::complex<double>, ...). |
| [in] | shape | : Shape of the array, e.g. Nz x Ny x Nx. |
| [in] | mode | : Writing mode, i.e. overwrite (w) or append (a) to the file. |
Definition at line 291 of file vpIoTools.h.
References create_npy_header(), parse_zip_footer(), vpEndian::swap16bits(), and vpEndian::swap32bits().
|
inline |
Definition at line 207 of file vpIoTools.h.
|
inline |
Definition at line 201 of file vpIoTools.h.
| std::vector< char > & visp::cnpy::operator+= | ( | std::vector< char > & | lhs, |
| const T | rhs ) |
Definition at line 191 of file vpIoTools.h.
| void visp::cnpy::parse_npy_header | ( | FILE * | fp, |
| size_t & | word_size, | ||
| std::vector< size_t > & | shape, | ||
| bool & | fortran_order, | ||
| bool & | little_endian, | ||
| char & | data_type ) |
Definition at line 217 of file vpIoTools_npy.cpp.
Referenced by npy_save().
| void visp::cnpy::parse_npy_header | ( | unsigned char * | buffer, |
| size_t & | word_size, | ||
| std::vector< size_t > & | shape, | ||
| bool & | fortran_order, | ||
| bool & | little_endian, | ||
| char & | data_type ) |
Definition at line 180 of file vpIoTools_npy.cpp.
| void visp::cnpy::parse_zip_footer | ( | FILE * | fp, |
| uint16_t & | nrecs, | ||
| size_t & | global_header_size, | ||
| size_t & | global_header_offset ) |
Definition at line 277 of file vpIoTools_npy.cpp.
References vpEndian::swap16bits(), and vpEndian::swap32bits().
Referenced by npz_save(), and npz_save().
| std::vector< char > visp::cnpy::utf8_to_utf32_vec_pad | ( | const std::string & | utf8, |
| const std::size_t & | max_size ) |
Definition at line 727 of file vpIoTools_npy.cpp.
Referenced by npz_save().