Defines | Functions
core/vnl/vnl_matlab_read.cxx File Reference
#include "vnl_matlab_read.h"
#include <vxl_config.h>
#include <vcl_ios.h>
#include <vcl_iostream.h>
#include <vcl_cstring.h>
#include <vcl_complex.h>
#include <vnl/vnl_c_vector.h>
#include <vcl_cstdlib.h>
#include <vcl_new.h>
#include <vnl/vnl_vector.h>
#include <vnl/vnl_matrix.h>

Go to the source code of this file.

Defines

#define implement_read_complex_data(T)
#define fsm_define_methods(T)
#define inst(T)

Functions

void vnl_read_bytes (vcl_istream &s, void *p, unsigned bytes)
VCL_DEFINE_SPECIALIZATION void vnl_matlab_read_data (vcl_istream &s, float *p, unsigned n)
VCL_DEFINE_SPECIALIZATION void vnl_matlab_read_data (vcl_istream &s, double *p, unsigned n)
 implement_read_complex_data (float) implement_read_complex_data(double) vnl_matlab_readhdr
 fsm_define_methods (float)
 fsm_define_methods (double)
 fsm_define_methods (vcl_complex< float >)
 fsm_define_methods (vcl_complex< double >)
template<class T >
bool vnl_matlab_read_or_die (vcl_istream &s, vnl_vector< T > &v, char const *name)
 Attempt to read vector or matrix.
template<class T >
bool vnl_matlab_read_or_die (vcl_istream &s, vnl_matrix< T > &M, char const *name)
 inst (double)
 inst (float)

Detailed Description

Author:
fsm

Definition in file vnl_matlab_read.cxx.


Define Documentation

#define fsm_define_methods (   T)

Definition at line 174 of file vnl_matlab_read.cxx.

#define implement_read_complex_data (   T)
Value:
VCL_DEFINE_SPECIALIZATION \
void vnl_matlab_read_data(vcl_istream &s, vcl_complex<T > *ptr, unsigned n) { \
  T *re = vnl_c_vector<T >::allocate_T(n); \
  T *im = vnl_c_vector<T >::allocate_T(n); \
  ::vnl_read_bytes(s, re, n*sizeof(T)); \
  ::vnl_read_bytes(s, im, n*sizeof(T)); \
  for (unsigned i=0; i<n; ++i) \
    ptr[i] = vcl_complex<T >(re[i], im[i]); \
  vnl_c_vector<T >::deallocate(re, n); \
  vnl_c_vector<T >::deallocate(im, n); \
}

Definition at line 32 of file vnl_matlab_read.cxx.

#define inst (   T)
Value:
template bool vnl_matlab_read_or_die(vcl_istream &, vnl_vector<T> &, char const *); \
template bool vnl_matlab_read_or_die(vcl_istream &, vnl_matrix<T> &, char const *);

Definition at line 279 of file vnl_matlab_read.cxx.


Function Documentation

fsm_define_methods ( float  )
fsm_define_methods ( double  )
fsm_define_methods ( vcl_complex< float >  )
fsm_define_methods ( vcl_complex< double >  )
implement_read_complex_data ( float  )

Definition at line 45 of file vnl_matlab_read.cxx.

inst ( double  )
inst ( float  )
VCL_DEFINE_SPECIALIZATION void vnl_matlab_read_data ( vcl_istream &  s,
float *  p,
unsigned  n 
)

Definition at line 25 of file vnl_matlab_read.cxx.

VCL_DEFINE_SPECIALIZATION void vnl_matlab_read_data ( vcl_istream &  s,
double *  p,
unsigned  n 
)

Definition at line 29 of file vnl_matlab_read.cxx.

template<class T >
bool vnl_matlab_read_or_die ( vcl_istream &  ,
vnl_vector< T > &  ,
char const *  name = 0 
)

Attempt to read vector or matrix.

If the MATLAB header cannot be read, return false. Else, if a name is given, and it doesn't match what's in the file, abort(). If the data in the file cannot reasonably be read into the destination, abort().

The vector/matrix will be resized if necessary.

Definition at line 228 of file vnl_matlab_read.cxx.

template<class T >
bool vnl_matlab_read_or_die ( vcl_istream &  s,
vnl_matrix< T > &  M,
char const *  name 
)

Definition at line 254 of file vnl_matlab_read.cxx.

void vnl_read_bytes ( vcl_istream &  s,
void *  p,
unsigned  bytes 
)

Definition at line 19 of file vnl_matlab_read.cxx.