32#ifndef eman__eerio_h__
33#define eman__eerio_h__ 1
51 auto result =
cur & ((1 << N) - 1);
63 cur >>= remaining_bits;
77 return out<<
"cur: "<<std::bitset<8*sizeof(T)>(obj.
cur)
84 template<
unsigned int T,
bool BIT_OVERFLOW,
class U>
92 operator decltype(
val)
const () {
102 }
while(BIT_OVERFLOW && count == obj.
max_val);
108 template<
unsigned int T,
class U>
111 template<
unsigned int T,
class U>
123 auto operator()(
unsigned int count,
unsigned int sub_pix)
const;
129 virtual unsigned int x(
unsigned int count,
unsigned int sub_pix)
const =0;
130 virtual unsigned int y(
unsigned int count,
unsigned int sub_pix)
const =0;
134 template <
unsigned int I>
136 unsigned int num_pix()
const override;
137 unsigned int x(
unsigned int count,
unsigned int sub_pix)
const override;
138 unsigned int y(
unsigned int count,
unsigned int sub_pix)
const override;
141 template <
unsigned int I>
146 return camera_size * (1 << I);
149 template <
unsigned int I>
153 return (
DecoderIx<0>().
x(count, sub_pix) << I) | (((sub_pix & 3) ^ 2) >> (2 - I));
156 template <
unsigned int I>
160 return (
DecoderIx<0>().
y(count, sub_pix) << I) | (((sub_pix >> 2) ^ 2) >> (2 - I));
166 return count & (camera_size - 1);
172 return count >> camera_size_bits;
const decltype(T) num_bits
const decltype(T) max_val
friend BitStream< U > & operator>>(BitStream< U > &in, BitReader< T, BIT_OVERFLOW, U > &obj)
friend std::ostream & operator<<(std::ostream &out, const BitStream &obj)
const size_t max_num_bits
auto operator()(unsigned int count, unsigned int sub_pix) const
virtual unsigned int x(unsigned int count, unsigned int sub_pix) const =0
virtual unsigned int num_pix() const =0
const unsigned int camera_size
virtual unsigned int y(unsigned int count, unsigned int sub_pix) const =0
const unsigned int camera_size_bits
Dict is a dictionary to store <string, EMObject> pair.
bool is_single_image_format() const override
Is this image format only storing 1 image or not.
int get_nimg()
Return the number of images in this image file.
EerIO(const string &fname, IOMode rw_mode=READ_ONLY, Decoder &dec=decoder0x)
Dict acquisition_data_dict
ImageIO classes are designed for reading/writing various electron micrography image formats,...
static DecoderIx< 2 > decoder2x
static DecoderIx< 1 > decoder1x
static DecoderIx< 0 > decoder0x
unsigned int x(unsigned int count, unsigned int sub_pix) const override
unsigned int num_pix() const override
unsigned int y(unsigned int count, unsigned int sub_pix) const override