Xmipp
v3.23.11-Nereus
|
#include <xmipp_image_generic.h>
Public Member Functions | |
ImageGeneric () | |
ImageGeneric (DataType _datatype) | |
ImageGeneric (const FileName &filename) | |
ImageGeneric (const ImageGeneric &img) | |
~ImageGeneric () | |
void | init () |
void | clear () |
void | copy (const ImageGeneric &img) |
void | clearHeader () |
void | initGeometry (const size_t n=0) |
MDRow & | getGeometry (const size_t n=0) |
void | getDimensions (size_t &Xdim, size_t &Ydim, size_t &Zdim, size_t &Ndim) const |
void | getDimensions (size_t &Xdim, size_t &Ydim, size_t &Zdim) const |
void | getDimensions (ArrayDim &aDim) const |
size_t | getSize () const |
void | getEulerAngles (double &rot, double &tilt, double &psi, size_t n=0) |
double | tilt (const size_t n=0) const |
void | resize (int Xdim, int Ydim, int Zdim, size_t Ndim, bool copy=true) |
void | setDatatype (DataType _datatype) |
void | setDatatype (const FileName &name, ImageInfo &imgInf) |
void | setDatatype (const FileName &name) |
void | setDataMode (DataMode mode) |
DataType | getDatatype () const |
void | getInfo (ImageInfo &imgInfo) const |
int | getDatatypeDepth () const |
bool | isMapped () |
int | read (const FileName &name, DataMode datamode=DATA, size_t select_img=ALL_IMAGES, bool mapData=false) |
int | readApplyGeo (const FileName &name, const MDRow &row, const ApplyGeoParams ¶ms=DefaultApplyGeoParams) |
int | readApplyGeo (const FileName &name, const MetaData &md, size_t objId, const ApplyGeoParams ¶ms=DefaultApplyGeoParams) |
int | readApplyGeo (const MetaData &md, size_t objId, const ApplyGeoParams ¶ms=DefaultApplyGeoParams) |
void | applyGeo (const MetaData &md, size_t objId, const ApplyGeoParams ¶ms=DefaultApplyGeoParams) |
void | mirrorY (void) |
int | readMapped (const FileName &name, size_t select_img=ALL_IMAGES, int mode=WRITE_READONLY) |
int | readOrReadMapped (const FileName &name, size_t select_img=ALL_IMAGES, int mode=WRITE_READONLY) |
int | readPreview (const FileName &name, size_t Xdim, size_t Ydim=0, int select_slice=CENTRAL_SLICE, size_t select_img=FIRST_IMAGE) |
int | readOrReadPreview (const FileName &name, size_t Xdim, size_t Ydim=0, int select_slice=CENTRAL_SLICE, size_t select_img=FIRST_IMAGE, bool mapData=false, bool wrap=true) |
void | getPreview (ImageGeneric &imgOut, int Xdim, int Ydim=-1, int select_slice=CENTRAL_SLICE, size_t select_img=FIRST_IMAGE) |
int | readPreviewFourier (const FileName &name, size_t Xdim, size_t Ydim=0, int select_slice=CENTRAL_SLICE, size_t select_img=FIRST_IMAGE) |
int | readPreviewSmooth (const FileName &name, size_t Xdim, size_t Ydim=0, int select_slice=CENTRAL_SLICE, size_t select_img=FIRST_IMAGE) |
void | write (const FileName &name="", size_t select_img=ALL_IMAGES, bool isStack=false, int mode=WRITE_OVERWRITE, CastWriteMode castMode=CW_CAST, int _swapWrite=0) |
void | mapFile2Write (int Xdim, int Ydim, int Zdim, const FileName &_filename, bool createTempFile=false, size_t select_img=APPEND_IMAGE, bool isStack=false, int mode=WRITE_OVERWRITE, int _swapWrite=0) |
void | movePointerTo (int select_slice=ALL_SLICES, size_t select_img=ALL_IMAGES) |
MultidimArrayGeneric & | operator() () |
const MultidimArrayGeneric & | operator() () const |
ImageGeneric & | operator= (const ImageGeneric &img) |
bool | operator== (const ImageGeneric &i1) const |
void | convert2Datatype (DataType datatype, CastWriteMode castMode=CW_CONVERT) |
void | reslice (AxisView view) |
void | reslice (AxisView view, ImageGeneric &out) |
bool | equal (const ImageGeneric &i1, double accuracy=XMIPP_EQUAL_ACCURACY) const |
double | getPixel (unsigned long n, int k, int i, int j) const |
double | getPixel (int i, int j) const |
void | setPixel (unsigned long n, int k, int i, int j, double value) const |
void | setPixel (int i, int j, double value) const |
void | initConstant (double value) const |
void | initRandom (double op1, double op2, RandomMode mode=RND_UNIFORM) const |
void | print () const |
void | toString (String &s) const |
void | add (const ImageGeneric &img) |
void | subtract (const ImageGeneric &img) |
void | multiply (const double value) |
void | multiply (const ImageGeneric &img) |
void | divide (const ImageGeneric &img) |
void | divide (const double value) |
Public Attributes | |
ImageBase * | image |
DataType | datatype |
MultidimArrayGeneric * | data |
Protected Attributes | |
bool | swap |
Friends | |
std::ostream & | operator<< (std::ostream &o, const ImageGeneric &I) |
ImageGeneric class to handle images with independence of data type
Definition at line 47 of file xmipp_image_generic.h.
|
inline |
Empty constructor.
No internal image class is declared.
Definition at line 65 of file xmipp_image_generic.h.
ImageGeneric::ImageGeneric | ( | DataType | _datatype | ) |
Constructor passing the data type of the image.
Defines the data type of the image and then declares the internal image class.
Definition at line 41 of file xmipp_image_generic.cpp.
ImageGeneric::ImageGeneric | ( | const FileName & | filename | ) |
Constructor for reading the image
This constructor will be useful for perfom construction and read in a single step.
Definition at line 47 of file xmipp_image_generic.cpp.
ImageGeneric::ImageGeneric | ( | const ImageGeneric & | img | ) |
ImageGeneric::~ImageGeneric | ( | ) |
void ImageGeneric::add | ( | const ImageGeneric & | img | ) |
Addition of the passed image to the internal's
Definition at line 543 of file xmipp_image_generic.cpp.
void ImageGeneric::applyGeo | ( | const MetaData & | md, |
size_t | objId, | ||
const ApplyGeoParams & | params = DefaultApplyGeoParams |
||
) |
Apply geometry in referring metadata to the image
Definition at line 407 of file xmipp_image_generic.cpp.
void ImageGeneric::clear | ( | ) |
Clear the parameters and initialize them.
Definition at line 72 of file xmipp_image_generic.cpp.
|
inline |
void ImageGeneric::convert2Datatype | ( | DataType | datatype, |
CastWriteMode | castMode = CW_CONVERT |
||
) |
Convert the datatype of the object and cast the image
Definition at line 414 of file xmipp_image_generic.cpp.
void ImageGeneric::copy | ( | const ImageGeneric & | img | ) |
Copy data from other ImageGeneric
Definition at line 83 of file xmipp_image_generic.cpp.
void ImageGeneric::divide | ( | const ImageGeneric & | img | ) |
Division of the internal image by another image
Definition at line 594 of file xmipp_image_generic.cpp.
void ImageGeneric::divide | ( | const double | value | ) |
Division if the internal image by a constant
Definition at line 606 of file xmipp_image_generic.cpp.
|
inline |
equal for doubles
Definition at line 354 of file xmipp_image_generic.h.
|
inline |
|
inline |
Get the data type
Definition at line 181 of file xmipp_image_generic.h.
void ImageGeneric::getDimensions | ( | size_t & | Xdim, |
size_t & | Ydim, | ||
size_t & | Zdim, | ||
size_t & | Ndim | ||
) | const |
Get Image dimensions
Definition at line 103 of file xmipp_image_generic.cpp.
void ImageGeneric::getDimensions | ( | size_t & | Xdim, |
size_t & | Ydim, | ||
size_t & | Zdim | ||
) | const |
Definition at line 97 of file xmipp_image_generic.cpp.
void ImageGeneric::getDimensions | ( | ArrayDim & | aDim | ) | const |
Definition at line 108 of file xmipp_image_generic.cpp.
|
inline |
Get Euler angles from image header
Definition at line 131 of file xmipp_image_generic.h.
|
inline |
void ImageGeneric::getInfo | ( | ImageInfo & | imgInfo | ) | const |
Get basic information from already read image file
Definition at line 113 of file xmipp_image_generic.cpp.
|
inline |
|
inline |
void ImageGeneric::getPreview | ( | ImageGeneric & | imgOut, |
int | Xdim, | ||
int | Ydim = -1 , |
||
int | select_slice = CENTRAL_SLICE , |
||
size_t | select_img = FIRST_IMAGE |
||
) |
Returns an image with a lower resolution as a preview image. If Zdim parameter is not passed, then all slices are rescaled. If Ydim is not passed, then Ydim is rescaled same factor as Xdim.
Definition at line 303 of file xmipp_image_generic.cpp.
|
inline |
void ImageGeneric::init | ( | void | ) |
Initialize the parameters.
Definition at line 65 of file xmipp_image_generic.cpp.
|
inline |
void ImageGeneric::initGeometry | ( | const size_t | n = 0 | ) |
Init geometry transformation with defaults values
Definition at line 36 of file xmipp_image_generic.cpp.
|
inline |
|
inline |
void ImageGeneric::mapFile2Write | ( | int | Xdim, |
int | Ydim, | ||
int | Zdim, | ||
const FileName & | _filename, | ||
bool | createTempFile = false , |
||
size_t | select_img = APPEND_IMAGE , |
||
bool | isStack = false , |
||
int | mode = WRITE_OVERWRITE , |
||
int | _swapWrite = 0 |
||
) |
Definition at line 360 of file xmipp_image_generic.cpp.
void ImageGeneric::mirrorY | ( | void | ) |
Definition at line 392 of file xmipp_image_generic.cpp.
|
inline |
It changes the behavior of the internal multidimarray so it points to a specific slice/image from a stack, volume or stack of volumes. No information is deallocated from memory, so it is also possible to repoint to the whole stack,volume... (passing select_slice = ALL_SLICES and selec_img = ALL_IMAGES).
The options for select_slice are:
The options for selec_img are:
If a specific slice number is selected, then a specific image from the stack must be also selected. Otherwise, FIRST_IMAGE is proposed.
If Image Object is read using readPreview method, movePointerTo only works when rescaling the image in X-Y plane only, but all slices must be read.
Definition at line 312 of file xmipp_image_generic.h.
void ImageGeneric::multiply | ( | const double | value | ) |
Multiplication of the internal image by a constant
Definition at line 583 of file xmipp_image_generic.cpp.
void ImageGeneric::multiply | ( | const ImageGeneric & | img | ) |
Multiplication of the internal image by another image
Definition at line 571 of file xmipp_image_generic.cpp.
|
inline |
Definition at line 320 of file xmipp_image_generic.h.
|
inline |
Definition at line 325 of file xmipp_image_generic.h.
ImageGeneric & ImageGeneric::operator= | ( | const ImageGeneric & | img | ) |
bool ImageGeneric::operator== | ( | const ImageGeneric & | i1 | ) | const |
void ImageGeneric::print | ( | ) | const |
int ImageGeneric::read | ( | const FileName & | name, |
DataMode | datamode = DATA , |
||
size_t | select_img = ALL_IMAGES , |
||
bool | mapData = false |
||
) |
Read image from file.
Definition at line 229 of file xmipp_image_generic.cpp.
int ImageGeneric::readApplyGeo | ( | const FileName & | name, |
const MDRow & | row, | ||
const ApplyGeoParams & | params = DefaultApplyGeoParams |
||
) |
Read image from file with a header applied.
Definition at line 378 of file xmipp_image_generic.cpp.
int ImageGeneric::readApplyGeo | ( | const FileName & | name, |
const MetaData & | md, | ||
size_t | objId, | ||
const ApplyGeoParams & | params = DefaultApplyGeoParams |
||
) |
Read image from file.
Definition at line 385 of file xmipp_image_generic.cpp.
int ImageGeneric::readApplyGeo | ( | const MetaData & | md, |
size_t | objId, | ||
const ApplyGeoParams & | params = DefaultApplyGeoParams |
||
) |
Read an image from metadata, filename is taken from MDL_IMAGE
Definition at line 397 of file xmipp_image_generic.cpp.
int ImageGeneric::readMapped | ( | const FileName & | name, |
size_t | select_img = ALL_IMAGES , |
||
int | mode = WRITE_READONLY |
||
) |
Read image mapped from file.
Definition at line 236 of file xmipp_image_generic.cpp.
int ImageGeneric::readOrReadMapped | ( | const FileName & | name, |
size_t | select_img = ALL_IMAGES , |
||
int | mode = WRITE_READONLY |
||
) |
Definition at line 242 of file xmipp_image_generic.cpp.
int ImageGeneric::readOrReadPreview | ( | const FileName & | name, |
size_t | Xdim, | ||
size_t | Ydim = 0 , |
||
int | select_slice = CENTRAL_SLICE , |
||
size_t | select_img = FIRST_IMAGE , |
||
bool | mapData = false , |
||
bool | wrap = true |
||
) |
This function allows to read the original image or a preview of it also allowing to select either a specific image from the stack or a slice from a volume.
In the case of reading images in its real dimensions it is also possible to image map from file.
Definition at line 291 of file xmipp_image_generic.cpp.
int ImageGeneric::readPreview | ( | const FileName & | name, |
size_t | Xdim, | ||
size_t | Ydim = 0 , |
||
int | select_slice = CENTRAL_SLICE , |
||
size_t | select_img = FIRST_IMAGE |
||
) |
Definition at line 280 of file xmipp_image_generic.cpp.
int ImageGeneric::readPreviewFourier | ( | const FileName & | name, |
size_t | Xdim, | ||
size_t | Ydim = 0 , |
||
int | select_slice = CENTRAL_SLICE , |
||
size_t | select_img = FIRST_IMAGE |
||
) |
Definition at line 310 of file xmipp_image_generic.cpp.
int ImageGeneric::readPreviewSmooth | ( | const FileName & | name, |
size_t | Xdim, | ||
size_t | Ydim = 0 , |
||
int | select_slice = CENTRAL_SLICE , |
||
size_t | select_img = FIRST_IMAGE |
||
) |
Definition at line 338 of file xmipp_image_generic.cpp.
|
inline |
Resizes image dimensions
Definition at line 146 of file xmipp_image_generic.h.
void ImageGeneric::reslice | ( | AxisView | view | ) |
Definition at line 502 of file xmipp_image_generic.cpp.
void ImageGeneric::reslice | ( | AxisView | view, |
ImageGeneric & | out | ||
) |
Definition at line 457 of file xmipp_image_generic.cpp.
|
inline |
void ImageGeneric::setDatatype | ( | DataType | _datatype | ) |
Set the data type for the generic image
Definition at line 118 of file xmipp_image_generic.cpp.
Set the data type according to the image file, checking if file size is correct.
Definition at line 214 of file xmipp_image_generic.cpp.
void ImageGeneric::setDatatype | ( | const FileName & | name | ) |
Definition at line 224 of file xmipp_image_generic.cpp.
|
inline |
|
inline |
void ImageGeneric::subtract | ( | const ImageGeneric & | img | ) |
Subtraction of the passed image to the internal's
Definition at line 557 of file xmipp_image_generic.cpp.
|
inline |
void ImageGeneric::toString | ( | String & | s | ) | const |
|
inline |
Write image to file.
Definition at line 278 of file xmipp_image_generic.h.
|
friend |
Definition at line 429 of file xmipp_image_generic.h.
MultidimArrayGeneric* ImageGeneric::data |
Definition at line 53 of file xmipp_image_generic.h.
DataType ImageGeneric::datatype |
Definition at line 52 of file xmipp_image_generic.h.
ImageBase* ImageGeneric::image |
Definition at line 51 of file xmipp_image_generic.h.
|
protected |
Definition at line 57 of file xmipp_image_generic.h.