40SingleSpiderIO::SingleSpiderIO(
const string & fname,
IOMode rw)
77 const float *data =
static_cast < const float *
>(first_block);
78 float nslice = data[0];
80 float iform = data[4];
81 float nsam = data[11];
82 float labrec = data[12];
83 float labbyt = data[21];
84 float lenbyt = data[22];
85 float istack = data[23];
99 if(
int(nslice) != nslice ||
int(nrow) != nrow
100 ||
int(iform) != iform ||
int(nsam) != nsam
101 ||
int(labrec) != labrec ||
int(labbyt) != labbyt
102 ||
int(lenbyt) != lenbyt ) {
106 int itype =
static_cast < int >(iform);
119 int ilabrec =
static_cast<int>(labrec);
120 int ilabbyt =
static_cast<int>(labbyt);
121 int ilenbyt =
static_cast<int>(lenbyt);
122 if( ilabbyt != ilabrec * ilenbyt ) {
static bool is_host_big_endian()
static void swap_bytes(T *data, size_t n=1)
swap the byte order of data with 'n' T-type elements.
static bool is_float_big_endian(float small_number)
given a small floating number, return whether the number is in big endian or not.
Dict is a dictionary to store <string, EMObject> pair.
EMDataType
Image pixel data type used in EMAN.
Region defines a 2D or 3D rectangular region specified by its origin coordinates and all edges' sizes...
int write_header(const Dict &dict, int image_index=0, const Region *area=0, EMUtil::EMDataType filestoragetype=EMUtil::EM_FLOAT, bool use_host_endian=true)
Write a single SPIDER format header to an image.
bool is_valid_spider(const void *first_block)
check the data block to see if it represents valid stacked SPIDER image file header
int write_data(float *data, int image_index=0, const Region *area=0, EMUtil::EMDataType filestoragetype=EMUtil::EM_FLOAT, bool use_host_endian=true)
Write data to an image.
static bool is_valid(const void *first_block)
SPIDER: (System for Processing Image Data from Electron microscopy and Related fields) is an image pr...
int write_single_data(float *data, const Region *area, SpiderHeader *&hp, size_t offset, int img_index, int max_nimg, bool use_host_endian=true)
write a single image data
int write_single_header(const Dict &dict, const Region *area, int image_index, size_t offset, SpiderHeader *&hp, int ISTACK, int MAXIM=1, int IMGNUM=1, bool use_host_endian=true)
write a SPIDER header to spider_file