 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
43 ifstream* fimg =
new ifstream(p->
file_name());
44 if ( fimg->fail() )
return -1;
48 fimg->read((
char *)header,
EMSIZE);
49 if ( fimg->fail() )
return -2;
52 unsigned char* b = (
unsigned char *) header;
54 if ( abs(header->nz) >
SWAPTRIG || header->nz < 1 ) {
56 cerr <<
"Warning: Swapping header byte order for 4-byte types" << endl;
59 for ( i=4; i<16; i+=4 )
swapbytes(b+i, 4);
60 for ( i=96; i<extent; i+=4 )
swapbytes(b+i, 4);
64 p->
size(header->nx, header->ny, header->nz);
68 switch( header->stamp[3] ){
80 p->
label(header->label);
84 unsigned char* data = NULL;
93 data =
new unsigned char[readsize];
139 memset(header, 0,
sizeof(
EMhead));
157 default : header->
stamp[3] = 1;
160 strncpy(header->
label, p->
label().c_str(), 80);
165 int xstore = header->
nx;
169 long datasize = (long) xstore*header->
ny*header->
nz*datatypesize;
171 unsigned char* data = NULL;
174 if ( fimg.fail() )
return -1;
182 data =
new unsigned char[datasize];
184 fimg.write((
char *)data, datasize);
int readEM(Bimage *p, int readdata)
Reading a EM map image file format. A 3D image format used in electron microscopy....
Header file for file checking functions.
int fread_large(unsigned char *aptr, size_t pagesize, size_t offset, ifstream *fimg)
Reads blocks of memeory no larger than 1Gb.
SysType systype(int show)
Finds the system type - mostly just for byte order.
Vector3< long > size() const
long data_type_size() const
Returns the size of the datatype in bytes.
int pack_transform(unsigned char *data, FourierType tf)
void swapbytes(unsigned char *v, size_t n)
Swaps bytes.
General image parameter class.
CompoundType compound_type()
unsigned char * data_alloc()
void color_to_simple()
A color image is converted to a simple image.
Header file for general utilities.
void change_type(char letter)
Get the data type indicated by a single letter code.
int writeEM(Bimage *p)
Writing a EM map image file format. A 3D image format used in electron microscopy.
unsigned char * data_pointer()
int unpack_transform(unsigned char *data, FourierType tf)
Header file for reading and writing EM files.