 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
35 ifstream* fimg =
new ifstream(p->
file_name());
36 if ( fimg->fail() )
return -1;
39 cout <<
"DEBUG readSPE: header size = " <<
sizeof(
SPEhead) << endl;
43 fimg->read((
char *)header,
SPESIZE);
44 if ( fimg->fail() )
return -2;
48 if ( header->datatype > 127 ) {
50 cerr <<
"Warning: Swapping header byte order" << endl;
52 swapbytes((
unsigned char *)&header->datatype, 2);
53 swapbytes((
unsigned char *)&header->xdim, 2);
54 swapbytes((
unsigned char *)&header->ydim, 2);
55 swapbytes((
unsigned char *)&header->NumFrames, 2);
56 swapbytes((
unsigned char *)&header->MaxIntensity, 4);
57 swapbytes((
unsigned char *)&header->MinIntensity, 4);
60 p->
label(header->Comments);
66 cout <<
"DEBUG readSPE: xdim=" << header->xdim <<
" ydim=" << header->ydim <<
" NumFrames=" << header->NumFrames << endl;
69 long nimg(header->NumFrames);
70 p->
size(header->xdim, header->ydim, 1);
73 if ( img_select > -1 ) {
74 if ( img_select >= nimg ) img_select = nimg - 1;
80 switch ( header->datatype ) {
92 p->
maximum(header->MaxIntensity);
93 p->
minimum(header->MinIntensity);
126 memset(header, 0,
sizeof(
SPEhead));
132 snprintf(header->
date, 10,
"%02d%3s%04d", t->tm_mday,
month[t->tm_mon], t->tm_year);
144 default: header->
datatype = 0;
break;
154 if ( fimg.fail() )
return -1;
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.
Header file for reading and writing SPE files.
Vector3< long > size() const
long data_type_size() const
Returns the size of the datatype in bytes.
void swapbytes(unsigned char *v, size_t n)
Swaps bytes.
General image parameter class.
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.
unsigned char * data_pointer()
int writeSPE(Bimage *p)
Writing a SPE image file format.
int readSPE(Bimage *p, int readdata, int img_select)
Reading a SPE image file format.