|
| SerIO (const string &fname, IOMode rw_mode=READ_ONLY) |
|
| ~SerIO () |
|
int | get_nimg () |
| Return the number of images in this image file. More...
|
|
| ImageIO (const string &fname, IOMode rw) |
|
virtual | ~ImageIO () |
|
virtual int | read_header (Dict &dict, int image_index=0, const Region *area=0, bool is_3d=false)=0 |
| Read the header from an image. More...
|
|
virtual 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)=0 |
| Write a header to an image. More...
|
|
virtual int | read_data (float *data, int image_index=0, const Region *area=0, bool is_3d=false)=0 |
| Read the data from an image. More...
|
|
virtual int | read_data_8bit (unsigned char *data, int image_index=0, const Region *area=0, bool is_3d=false, float minval=0.0f, float maxval=0.0f) |
| Read the data from an image as an 8 bit array, regardless of format. More...
|
|
virtual int | write_data (float *data, int image_index=0, const Region *area=0, EMUtil::EMDataType filestoragetype=EMUtil::EM_FLOAT, bool use_host_endian=true)=0 |
| Write data to an image. More...
|
|
virtual int | read_ctf (Ctf &ctf, int image_index=0) |
| Read CTF data from this image. More...
|
|
virtual void | write_ctf (const Ctf &ctf, int image_index=0) |
| Write CTF data to this image. More...
|
|
virtual void | flush ()=0 |
| Flush the IO buffer. More...
|
|
virtual bool | is_complex_mode ()=0 |
| Is this an complex image or not. More...
|
|
virtual bool | is_image_big_endian ()=0 |
| Is this image in big endian or not. More...
|
|
virtual bool | is_single_image_format () const |
| Is this image format only storing 1 image or not. More...
|
|
template<class T > |
void | become_host_endian (T *data, size_t n=1) |
| Convert data of this image into host endian format. More...
|
|
string | get_filename () const |
|
|
enum | IOMode { READ_ONLY = 1
, READ_WRITE = 2
, WRITE_ONLY = 3
} |
|
virtual void | init ()=0 |
| Do some initialization before doing the read/write. More...
|
|
void | check_read_access (int image_index) |
| Validate 'image_index' in file reading. More...
|
|
void | check_read_access (int image_index, const float *data) |
| Validate 'image_index' and 'data' in file reading. More...
|
|
void | check_write_access (IOMode rw_mode, int image_index, int max_nimg=0) |
| Validate rw_mode and image_index in file writing. More...
|
|
void | check_write_access (IOMode rw_mode, int image_index, int max_nimg, const float *data) |
| Validate rw_mode, image_index, and data pointer in file writing. More...
|
|
void | check_region (const Region *area, const FloatSize &max_size, bool is_new_file=false, bool inbounds_only=true) |
| Validate image I/O region. More...
|
|
void | check_region (const Region *area, const IntSize &max_size, bool is_new_file=false, bool inbounds_only=true) |
| Validate image I/O region. More...
|
|
FILE * | sfopen (const string &filename, IOMode mode, bool *is_new=0, bool overwrite=false) |
| Run fopen safely. More...
|
|
string | filename |
|
IOMode | rw_mode |
|
FILE * | file = nullptr |
|
bool | initialized = false |
|
SER (Series File Format) is a file format created by Dr.
Chris Boothroyd. The file format is used by TIA (Tecnai imaging and analysis), which is the program used on FEI Tecnai and Titan microscopes for acquiring and displaying scanned images and spectra.
Each .ser file stores a number of 1D or 2D images. We do not support complex SER image for now.
http://www.microscopy.cen.dtu.dk/~cbb/info/TIAformat/index.html
Definition at line 55 of file serio.h.
void SerIO::read_data_element |
( |
Dict & |
dict | ) |
|
|
private |
helper function to read header attributes in data element
Definition at line 441 of file serio.cpp.
445 if (fread(hitem4,
sizeof(
double), 2,
file) != 2) {
448 dict[
"SER.CalibrationOffset"] = hitem4[0];
449 dict[
"SER.CalibrationDelta"] = hitem4[1];
452 if (fread(&cali,
sizeof(
int), 1,
file) != 1) {
455 dict[
"SER.CalibrationElement"] = cali;
458 if (fread(&datatype,
sizeof(
short), 1,
file) != 1) {
461 dict[
"SER.DataType"] = datatype;
464 if (fread(&arrlen,
sizeof(
int), 1,
file) != 1) {
477 if (fread(hitem4,
sizeof(
double), 2,
file) != 2) {
480 dict[
"SER.CalibrationOffsetX"] = hitem4[0];
481 dict[
"SER.CalibrationDeltaX"] = hitem4[1];
484 if (fread(&calix,
sizeof(
int), 1,
file) != 1) {
487 dict[
"SER.CalibrationElementX"] = calix;
490 if (fread(hitem5,
sizeof(
double), 2,
file) != 2) {
493 dict[
"SER.CalibrationOffsetX"] = hitem5[0];
494 dict[
"SER.CalibrationDeltaX"] = hitem5[1];
497 if (fread(&caliy,
sizeof(
int), 1,
file) != 1) {
500 dict[
"SER.CalibrationElementY"] = caliy;
503 if (fread(&datatype,
sizeof(
short), 1,
file) != 1) {
506 dict[
"SER.DataType"] = datatype;
510 if (fread(&arrsize,
sizeof(
int), 2,
file) != 2) {
513 dict[
"nx"] = arrsize[0];
514 dict[
"ny"] = arrsize[1];
References datamode, datatypeid, EMAN::ImageIO::file, EMAN::ImageIO::filename, ImageReadException, nx, ny, nz, oneD, and twoD.