EMAN2
Public Member Functions | Static Public Member Functions | Public Attributes | Private Types | Private Attributes | Static Private Attributes | List of all members
EMAN::SalIO Class Reference

A SAL image is an image from Perkin Elmer PDS Microdensitometer. More...

#include <salio.h>

Inheritance diagram for EMAN::SalIO:
Inheritance graph
[legend]
Collaboration diagram for EMAN::SalIO:
Collaboration graph
[legend]

Public Member Functions

 SalIO (const string &fname, IOMode rw_mode=READ_ONLY)
 
 ~SalIO ()
 
- 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 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 int get_nimg ()
 Return the number of images in this image file. 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
 

Static Public Member Functions

static bool is_valid (const void *first_block)
 

Public Attributes

 DEFINE_IMAGEIO_FUNC
 

Private Types

enum  ScanAxis { X_SCAN_AXIS , Y_SCAN_AXIS }
 
enum  ScanMode { NON_RASTER_SCAN , RASTER_SCAN }
 

Private Attributes

int nx
 
int ny
 
int record_length
 
ScanMode scan_mode
 
float pixel
 

Static Private Attributes

static const char * HDR_EXT = "hdr"
 
static const char * IMG_EXT = "img"
 
static const char * MAGIC = " IDENTIFICATION"
 

Additional Inherited Members

- Public Types inherited from EMAN::ImageIO
enum  IOMode { READ_ONLY = 1 , READ_WRITE = 2 , WRITE_ONLY = 3 }
 
- 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...
 
- Protected Attributes inherited from EMAN::ImageIO
string filename
 
IOMode rw_mode
 
FILE * file = nullptr
 
bool initialized = false
 

Detailed Description

A SAL image is an image from Perkin Elmer PDS Microdensitometer.

A SAL image consists of 2 files: 1 header file "X.hdr" and a data file "X.img". Header file is in ASCII format. Data file is in binary format.

Each pair of hdr/img SAL files contains 1 2D image.

Definition at line 47 of file salio.h.

Member Enumeration Documentation

◆ ScanAxis

enum EMAN::SalIO::ScanAxis
private
Enumerator
X_SCAN_AXIS 
Y_SCAN_AXIS 

Definition at line 61 of file salio.h.

62 {
65 };
@ Y_SCAN_AXIS
Definition: salio.h:64
@ X_SCAN_AXIS
Definition: salio.h:63

◆ ScanMode

enum EMAN::SalIO::ScanMode
private
Enumerator
NON_RASTER_SCAN 
RASTER_SCAN 

Definition at line 67 of file salio.h.

68 {
71 };
@ NON_RASTER_SCAN
Definition: salio.h:69
@ RASTER_SCAN
Definition: salio.h:70

Constructor & Destructor Documentation

◆ SalIO()

SalIO::SalIO ( const string &  fname,
IOMode  rw_mode = READ_ONLY 
)
explicit

Definition at line 53 of file salio.cpp.

54: ImageIO(fname, rw)
55{
56 nx = 0;
57 ny = 0;
58 record_length = 512;
60 pixel = 4.6667f;
61}
ImageIO(const string &fname, IOMode rw)
Definition: imageio.cpp:40
int ny
Definition: salio.h:75
int nx
Definition: salio.h:74
float pixel
Definition: salio.h:78
int record_length
Definition: salio.h:76
ScanMode scan_mode
Definition: salio.h:77

References NON_RASTER_SCAN, nx, ny, pixel, record_length, and scan_mode.

◆ ~SalIO()

SalIO::~SalIO ( )

Definition at line 63 of file salio.cpp.

64{
65 if (file) {
66 fclose(file);
67 file = 0;
68 }
69}
FILE * file
Definition: imageio.h:354

References EMAN::ImageIO::file.

Member Function Documentation

◆ is_valid()

bool SalIO::is_valid ( const void *  first_block)
static

Definition at line 141 of file salio.cpp.

142{
143 ENTERFUNC;
144 bool result = false;
145
146 if (!first_block) {
147 result = false;
148 }
149 result = Util::check_file_by_magic(first_block, MAGIC);
150 EXITFUNC;
151 return result;
152}
static const char * MAGIC
Definition: salio.h:59
static bool check_file_by_magic(const void *first_block, const char *magic)
check whether a file starts with certain magic string.
Definition: util.cpp:239
#define ENTERFUNC
Definition: log.h:48
#define EXITFUNC
Definition: log.h:49

References EMAN::Util::check_file_by_magic(), ENTERFUNC, EXITFUNC, and MAGIC.

Referenced by EMAN::EMUtil::fast_get_image_type(), and EMAN::EMUtil::get_image_type().

Member Data Documentation

◆ DEFINE_IMAGEIO_FUNC

EMAN::SalIO::DEFINE_IMAGEIO_FUNC

Definition at line 53 of file salio.h.

◆ HDR_EXT

const char * SalIO::HDR_EXT = "hdr"
staticprivate

Definition at line 57 of file salio.h.

◆ IMG_EXT

const char * SalIO::IMG_EXT = "img"
staticprivate

Definition at line 58 of file salio.h.

◆ MAGIC

const char * SalIO::MAGIC = " IDENTIFICATION"
staticprivate

Definition at line 59 of file salio.h.

Referenced by is_valid().

◆ nx

int EMAN::SalIO::nx
private

Definition at line 74 of file salio.h.

Referenced by SalIO().

◆ ny

int EMAN::SalIO::ny
private

Definition at line 75 of file salio.h.

Referenced by SalIO().

◆ pixel

float EMAN::SalIO::pixel
private

Definition at line 78 of file salio.h.

Referenced by SalIO().

◆ record_length

int EMAN::SalIO::record_length
private

Definition at line 76 of file salio.h.

Referenced by SalIO().

◆ scan_mode

ScanMode EMAN::SalIO::scan_mode
private

Definition at line 77 of file salio.h.

Referenced by SalIO().


The documentation for this class was generated from the following files: