|
EMAN2
|
Single Spider Image I/O class. More...
#include <sspiderio.h>


Public Member Functions | |
| SingleSpiderIO (const string &fname, IOMode rw_mode=READ_ONLY) | |
| SingleSpiderIO constructor. More... | |
| ~SingleSpiderIO () | |
| 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. More... | |
| 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. More... | |
| bool | is_single_image_format () const |
| Is this image format only storing 1 image or not. More... | |
Public Member Functions inherited from EMAN::SpiderIO | |
| SpiderIO (const string &fname, IOMode rw_mode=READ_ONLY) | |
| ~SpiderIO () | |
| int | get_nimg () |
| get the number of images in this stacked SPIDER image More... | |
Public Member Functions inherited from EMAN::ImageIO | |
| 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 | 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 | 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... | |
| 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 |
Static Public Member Functions | |
| static bool | is_valid (const void *first_block) |
Static Public Member Functions inherited from EMAN::SpiderIO | |
| static bool | is_valid (const void *first_block) |
Protected Member Functions | |
| bool | is_valid_spider (const void *first_block) |
| check the data block to see if it represents valid stacked SPIDER image file header More... | |
Protected Member Functions inherited from EMAN::SpiderIO | |
| 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 More... | |
| 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 More... | |
| bool | need_swap () const |
| void | swap_data (float *data, size_t nitems) |
| void | swap_header (SpiderHeader *header) |
Protected Member Functions inherited from EMAN::ImageIO | |
| 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... | |
Additional Inherited Members | |
Public Types inherited from EMAN::ImageIO | |
| enum | IOMode { READ_ONLY = 1 , READ_WRITE = 2 , WRITE_ONLY = 3 } |
Public Attributes inherited from EMAN::SpiderIO | |
| DEFINE_IMAGEIO_FUNC | |
Protected Types inherited from EMAN::SpiderIO | |
| enum | SpiderType { IMAGE_2D = 1 , IMAGE_3D = 3 , IMAGE_2D_FFT_ODD = -11 , IMAGE_2D_FFT_EVEN = -12 , IMAGE_3D_FFT_ODD = -21 , IMAGE_3D_FFT_EVEN = -22 } |
| enum | { SINGLE_IMAGE_HEADER = 0 , OVERALL_STACK_HEADER = 2 , NUM_FLOATS_IN_HEADER = 211 } |
Protected Attributes inherited from EMAN::SpiderIO | |
| SpiderHeader * | first_h |
| SpiderHeader * | cur_h |
| bool | is_big_endian |
| bool | is_new_file |
Protected Attributes inherited from EMAN::ImageIO | |
| string | filename |
| IOMode | rw_mode |
| FILE * | file = nullptr |
| bool | initialized = false |
Single Spider Image I/O class.
For Spider and Single Spider image format, please refer spiderio.h.
Definition at line 44 of file sspiderio.h.
SingleSpiderIO constructor.
| filename | The filename of a single spider image file. |
| rw_mode | Read/Write file open mode. |
Definition at line 40 of file sspiderio.cpp.
| SingleSpiderIO::~SingleSpiderIO | ( | ) |
Definition at line 46 of file sspiderio.cpp.
|
inlinevirtual |
Is this image format only storing 1 image or not.
Some image formats like MRC only store 1 image in a file, so this function returns 'true' for them. Other image formats like IMAGIC/HDF5 may store mutliple images, so this function returns 'false' for them.
Reimplemented from EMAN::SpiderIO.
Definition at line 86 of file sspiderio.h.
|
static |
Definition at line 71 of file sspiderio.cpp.
References ENTERFUNC, EXITFUNC, EMAN::SpiderIO::IMAGE_2D, EMAN::SpiderIO::IMAGE_2D_FFT_EVEN, EMAN::SpiderIO::IMAGE_2D_FFT_ODD, EMAN::SpiderIO::IMAGE_3D, EMAN::SpiderIO::IMAGE_3D_FFT_EVEN, EMAN::SpiderIO::IMAGE_3D_FFT_ODD, EMAN::ByteOrder::is_float_big_endian(), EMAN::ByteOrder::is_host_big_endian(), EMAN::SpiderIO::SINGLE_IMAGE_HEADER, and EMAN::ByteOrder::swap_bytes().
Referenced by EMAN::EMUtil::fast_get_image_type(), EMAN::EMUtil::get_image_type(), and is_valid_spider().
|
protectedvirtual |
check the data block to see if it represents valid stacked SPIDER image file header
| first_block | the pointer to first block of the file |
Reimplemented from EMAN::SpiderIO.
Definition at line 132 of file sspiderio.cpp.
References is_valid().
|
virtual |
Write data to an image.
| data | An array storing the data. |
| image_index | The index of the image to write. |
| area | The region to write data to. |
| filestoragetype | The image data type used in the output file. |
| use_host_endian | Whether to use the host machine endian to write out or not. If false, use the endian opposite to the host machine's endian. |
Implements EMAN::ImageIO.
Definition at line 63 of file sspiderio.cpp.
References EMAN::SpiderIO::first_h, EMAN::SpiderIO::SpiderHeader::headlen, and EMAN::SpiderIO::write_single_data().
|
virtual |
Write a single SPIDER format header to an image.
| dict | A keyed-dictionary storing the header information. |
| image_index | The index of the image to write. |
| area | The region to write data to. |
| filestoragetype | The image data type used in the output file. |
| use_host_endian | Whether to use the host machine endian to write out or not. If false, use the endian opposite to the host machine's endian. |
Implements EMAN::ImageIO.
Definition at line 51 of file sspiderio.cpp.
References EMAN::SpiderIO::first_h, EMAN::SpiderIO::SINGLE_IMAGE_HEADER, and EMAN::SpiderIO::write_single_header().