Xmipp
v3.23.11-Nereus
|
#include <image_operate.h>
Public Member Functions | |
Image () | |
Image (int Xdim, int Ydim, int Zdim, int Ndim, const FileName &_filename) | |
Image (int Xdim, int Ydim, int Zdim=1, int Ndim=1, bool _mmapOn=false) | |
Image (const Image< T > &im) | |
Image (const MultidimArray< T > &im) | |
virtual | ~Image () |
void | clear () |
void | clearData () |
bool | isComplexT () const |
void | getInverseAxisOrder (const std::array< int, 4 > &order, std::array< int, 4 > &result) |
void | transposeAxisSizes (const std::array< size_t, 4 > &sizes, const std::array< int, 4 > &order, std::array< size_t, 4 > &result) |
void | transposeInPlace (MultidimArray< T > &multidimArray, const std::array< int, 4 > &order) |
void | castPage2T (char *page, T *ptrDest, DataType datatype, size_t pageSize) |
void | castPage2Datatype (T *srcPtr, char *page, DataType datatype, size_t pageSize) const |
void | castConvertPage2Datatype (T *srcPtr, char *page, DataType datatype, size_t pageSize, double min0, double max0, CastWriteMode castMode=CW_CONVERT) const |
void | setPage2T (size_t offset, char *page, DataType datatype, size_t pageSize) |
void | getPageFromT (size_t offset, char *page, DataType datatype, size_t pageSize) |
void | getCastConvertPageFromT (size_t offset, char *page, DataType datatype, size_t pageSize, double min0, double max0, CastWriteMode castMode=CW_CONVERT) const |
bool | checkMmapT (DataType datatype) override |
void | mirrorY (void) |
void | mirrorX (void) |
void | selfApplyGeometry (int SplineDegree, bool wrap=xmipp_transformation::WRAP, bool only_apply_shifts=false) |
int | readPreview (const FileName &name, size_t Xdim, size_t Ydim=0, int select_slice=CENTRAL_SLICE, size_t select_img=FIRST_IMAGE) |
void | getPreview (ImageBase *imgBOut, size_t Xdim, size_t Ydim=0, int select_slice=CENTRAL_SLICE, size_t select_img=FIRST_IMAGE) |
void | movePointerTo (int select_slice=ALL_SLICES, size_t select_img=ALL_IMAGES) |
void | writePageAsDatatype (FILE *fimg, DataType datatype, size_t datasize_n) |
Image< T > & | operator= (const Image< T > &op1) |
MultidimArray< T > & | operator() () |
const MultidimArray< T > & | operator() () const |
T & | operator() (int i, int j) const |
bool | operator== (const Image< T > &i1) const |
T & | operator() (int k, int i, int j) const |
size_t | getSize () const |
void | getTransformationMatrix (Matrix2D< double > &A, bool only_apply_shifts=false, const size_t n=0) |
void | sumWithFile (const FileName &fn) |
template<> | |
void | castPage2T (char *page, std::complex< double > *ptrDest, DataType datatype, size_t pageSize) |
template<> | |
void | castPage2Datatype (std::complex< double > *srcPtr, char *page, DataType datatype, size_t pageSize) const |
template<> | |
void | castConvertPage2Datatype (std::complex< double > *srcPtr, char *page, DataType datatype, size_t pageSize, double min0, double max0, CastWriteMode castMode) const |
template<> | |
void | castPage2T (char *page, std::complex< double > *ptrDest, DataType datatype, size_t pageSize) |
template<> | |
void | castPage2Datatype (std::complex< double > *srcPtr, char *page, DataType datatype, size_t pageSize) const |
template<> | |
void | castConvertPage2Datatype (std::complex< double > *srcPtr, char *page, DataType datatype, size_t pageSize, double min0, double max0, CastWriteMode castMode) const |
Public Member Functions inherited from ImageBase | |
void | init () |
void | copy (const ImageBase &other) |
void | clearHeader () |
bool | isComplex () const |
virtual | ~ImageBase () |
bool | isImage (const FileName &name) |
bool | isMapped () |
bool | isRealImage (const FileName &name) |
bool | isComplexImage (const FileName &name) |
void | rename (const FileName &name) |
void | mapFile2Write (size_t Xdim, size_t Ydim, size_t Zdim, const FileName &_filename, bool createTempFile=false, size_t select_img=APPEND_IMAGE, bool isStack=false, int mode=WRITE_OVERWRITE) |
int | read (const FileName &name, DataMode datamode=DATA, size_t select_img=ALL_IMAGES, bool mapData=false, int mode=WRITE_READONLY) |
int | readBatch (const FileName &name, size_t start_img, size_t batch_size, DataMode datamode=DATA, bool mapData=false, int mode=WRITE_READONLY) |
int | readRange (const FileName &name, size_t start_img, size_t end_img, DataMode datamode=DATA, bool mapData=false, int mode=WRITE_READONLY) |
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 | setGeo (const MDRow &row, size_t n=0) |
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 | readOrReadPreview (const FileName &name, size_t Xdim, size_t Ydim, int select_slice=CENTRAL_SLICE, size_t select_img=FIRST_IMAGE, bool mapData=false) |
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 | swapPage (char *page, size_t pageNrElements, DataType datatype, int swap=1) |
void | swapOnWrite () |
const FileName & | name () const |
void | getDimensions (size_t &Xdim, size_t &Ydim, size_t &Zdim, size_t &Ndim) const |
void | getDimensions (ArrayDim &aDim) |
ArrayDim | getDimensions () |
void | getInfo (ImageInfo &imgInfo) const |
void | getInfo (const FileName &name, ImageInfo &imgInfo) |
void | getOffsetAndSwap (size_t &_offset, int &_swap) const |
int | getSwap () const |
MDRow & | getGeometry (const size_t n=0) |
void | initGeometry (const size_t n=0) |
bool | individualContainsLabel (MDLabel label) const |
bool | mainContainsLabel (MDLabel label) const |
double | rot (const size_t n=0) const |
double | tilt (const size_t n=0) const |
double | psi (const size_t n=0) const |
double | Xoff (const size_t n=0) const |
double | Yoff (const size_t n=0) const |
double | Zoff (const size_t n=0) const |
double | weight (const size_t n=0) const |
double | scale (const size_t n=0) const |
bool | flip (const size_t n=0) const |
DataType | datatype () const |
double | samplingRateX () const |
void | setADimFile (ArrayDim aDim) |
void | setName (const FileName &_filename) |
void | setDataMode (DataMode mode) |
void | setEulerAngles (double rot, double tilt, double psi, const size_t n=0) |
void | getEulerAngles (double &rot, double &tilt, double &psi, const size_t n=0) const |
void | setRot (double rot, const size_t n=0) |
void | setTilt (double tilt, const size_t n=0) |
void | setPsi (double psi, const size_t n=0) |
void | setShifts (double xoff, double yoff, double zoff=0., const size_t n=0) |
void | getShifts (double &xoff, double &yoff, double &zoff, const size_t n=0) const |
void | setXoff (double xoff, const size_t n=0) |
void | setYoff (double yoff, const size_t n=0) |
void | setZoff (double zoff, const size_t n=0) |
void | setScale (double scale, const size_t n=0) |
void | getScale (double &scale, const size_t n=0) |
void | setFlip (bool flip, const size_t n=0) |
void | setWeight (double weight, const size_t n=0) |
Public Attributes | |
MultidimArray< T > | data |
Public Attributes inherited from ImageBase | |
MultidimArrayBase * | mdaBase |
std::vector< std::unique_ptr< MDRow > > | MD |
MDRowVec | MDMainHeader |
Protected Member Functions | |
void | applyGeo (const MDRow &row, bool only_apply_shifts=false, bool wrap=xmipp_transformation::WRAP) override |
void | setDimensions (int Xdim, int Ydim, int Zdim, size_t Ndim) |
Protected Member Functions inherited from ImageBase | |
int | readDM3 (size_t img_select, bool isStack=false) |
int | writeDM3 (size_t img_select, bool isStack=false, int mode=WRITE_OVERWRITE) |
int | readDM4 (size_t img_select, bool isStack=false) |
int | writeDM4 (size_t img_select, bool isStack=false, int mode=WRITE_OVERWRITE) |
int | readIMAGIC (size_t img_select) |
int | writeIMAGIC (size_t img_select=ALL_IMAGES, int mode=WRITE_OVERWRITE, const String &bitDepth="", CastWriteMode castMode=CW_CAST) |
int | readMRC (size_t select_img, bool isStack=false) |
int | readMRC (size_t start_img, size_t batch_size, bool isStack=false) |
int | writeMRC (size_t select_img, bool isStack=false, int mode=WRITE_OVERWRITE, const String &bitDepth="", CastWriteMode castMode=CW_CAST) |
int | readINF (size_t img_select, bool isStack=false) |
int | writeINF (size_t img_select, bool isStack=false, int mode=WRITE_OVERWRITE, String bitDepth="", CastWriteMode castMode=CW_CAST) |
DataType | datatypeRAW (String strDT) |
int | readRAW (size_t select_img, bool isStack=false) |
int | readSPIDER (size_t select_img) |
int | readSPIDER (size_t start_img, size_t batch_size) |
int | writeSPIDER (size_t select_img=ALL_IMAGES, bool isStack=false, int mode=WRITE_OVERWRITE) |
int | readSPE (size_t select_img, bool isStack=false) |
int | writeSPE (size_t select_img, bool isStack=false, int mode=WRITE_OVERWRITE) |
int | readTIA (int img_select, bool isStack=false) |
int | writeTIA (int img_select, bool isStack=false, int mode=WRITE_OVERWRITE) |
int | readJPEG (size_t select_img) |
int | writeJPEG (size_t select_img, bool isStack=false, int mode=WRITE_OVERWRITE, String bitDepth="", CastWriteMode castMode=CW_CONVERT) |
void | castTiffTile2T (size_t offset, char *tif_buf, unsigned int x, unsigned int y, unsigned int imageWidth, unsigned int imageLength, unsigned int tileWidth, unsigned int tileLength, unsigned short samplesPerPixel, DataType datatype) |
void | castTiffLine2T (size_t offset, char *tif_buf, unsigned int y, unsigned int imageWidth, unsigned int imageLength, unsigned short samplesPerPixel, DataType datatype) |
DataType | datatypeTIFF (TIFFDirHead dHead) |
int | readTIFF (size_t select_img, bool isStack=false) |
int | writeTIFF (size_t select_img, bool isStack=false, int mode=WRITE_OVERWRITE, String bitDepth="", CastWriteMode castMode=CW_CAST) |
int | readEM (size_t select_img, bool isStack=false) |
int | writeEM (size_t select_img=ALL_IMAGES, bool isStack=false, int mode=WRITE_OVERWRITE) |
int | readPIF (size_t select_img) |
int | writePIF (size_t select_img=ALL_IMAGES, bool isStack=false, int mode=WRITE_OVERWRITE) |
DataType | datatypeH5 (hid_t dataset) |
hid_t | H5Datatype (DataType datatype) |
int | readHDF5 (size_t select_img) |
int | writeHDF5 (size_t select_img, bool isStack=false, int mode=WRITE_OVERWRITE, String bitDepth="", CastWriteMode castMode=CW_CAST) |
int | readEER (size_t select_img) |
ImageFHandler * | openFile (const FileName &name, int mode=WRITE_READONLY) const |
More... | |
void | closeFile (ImageFHandler *hFile=NULL) const |
int | _read (const FileName &name, ImageFHandler *hFile, DataMode datamode=DATA, size_t select_img=ALL_IMAGES, bool mapData=false) |
int | _readBatch (const FileName &name, ImageFHandler *hFile, size_t start_img, size_t batch_size, DataMode datamode=DATA, bool mapData=false) |
void | _write (const FileName &name, ImageFHandler *hFile, size_t select_img=ALL_IMAGES, bool isStack=false, int mode=WRITE_OVERWRITE, CastWriteMode castMode=CW_CAST) |
void | setDatatype (DataType datatype) |
Friends | |
class | ImageCollection |
template<typename TT > | |
class | Image |
Additional Inherited Members | |
Protected Attributes inherited from ImageBase | |
FileName | filename |
FileName | tempFilename |
FileName | dataFName |
FILE * | fimg |
FILE * | fhed |
TIFF * | tif |
hid_t | fhdf5 |
ImageFHandler * | hFile |
ArrayDim | aDimFile |
DataMode | dataMode |
size_t | offset |
int | swap |
int | swapWrite |
std::array< int, 4 > | axisOrder |
TransformType | transform |
size_t | replaceNsize |
bool | _exists |
bool | mmapOnRead |
bool | mmapOnWrite |
int | mFd |
size_t | mappedSize |
size_t | mappedOffset |
size_t | virtualOffset |
Static Protected Attributes inherited from ImageBase | |
static constexpr std::array< int, 4 > | defaultAxisOrder = {0,1,2,3} |
Template class for images. The image class is the general image handling class.
Definition at line 36 of file image_operate.h.
Empty constructor
An empty image is created.
Definition at line 66 of file xmipp_image.h.
|
inline |
Constructor with size and filename
An image file, which name and format are given by filename, is created with the given size. Then the image is mapped to this file.
Definition at line 81 of file xmipp_image.h.
|
inline |
Constructor with size
A blank image (0.0 filled) is created with the given size. Pay attention to the dimension order: Y and then X. If _mmapOn is True then image is allocated in a temporary file.
Definition at line 104 of file xmipp_image.h.
Definition at line 113 of file xmipp_image.h.
|
inline |
Constructor with MultidimArray alias
An image is created directly with its multidimarray aliased to im. This function is useful when debugging and you want to save multidimarrays.
Definition at line 125 of file xmipp_image.h.
Destructor.
Definition at line 135 of file xmipp_image.h.
|
overrideprotectedvirtual |
Specific read functions for different file formatsApply geometry in referring metadata to the image
Implements ImageBase.
Definition at line 327 of file xmipp_image.cpp.
void Image< std::complex< double > >::castConvertPage2Datatype | ( | std::complex< double > * | srcPtr, |
char * | page, | ||
DataType | datatype, | ||
size_t | pageSize, | ||
double | min0, | ||
double | max0, | ||
CastWriteMode | castMode | ||
) | const |
Definition at line 227 of file xmipp_image.cpp.
|
inline |
Definition at line 544 of file xmipp_image.h.
void Image< std::complex< double > >::castConvertPage2Datatype | ( | std::complex< double > * | srcPtr, |
char * | page, | ||
DataType | datatype, | ||
size_t | pageSize, | ||
double | min0, | ||
double | max0, | ||
CastWriteMode | castMode | ||
) | const |
void Image< std::complex< double > >::castPage2Datatype | ( | std::complex< double > * | srcPtr, |
char * | page, | ||
DataType | datatype, | ||
size_t | pageSize | ||
) | const |
Definition at line 181 of file xmipp_image.cpp.
|
inline |
Cast page from T to datatype input pointer char *
Definition at line 426 of file xmipp_image.h.
void Image< std::complex< double > >::castPage2Datatype | ( | std::complex< double > * | srcPtr, |
char * | page, | ||
DataType | datatype, | ||
size_t | pageSize | ||
) | const |
void Image< std::complex< double > >::castPage2T | ( | char * | page, |
std::complex< double > * | ptrDest, | ||
DataType | datatype, | ||
size_t | pageSize | ||
) |
Definition at line 141 of file xmipp_image.cpp.
|
inline |
Cast a page of data from type dataType to type Tdest input pointer char *
Definition at line 268 of file xmipp_image.h.
void Image< std::complex< double > >::castPage2T | ( | char * | page, |
std::complex< double > * | ptrDest, | ||
DataType | datatype, | ||
size_t | pageSize | ||
) |
Check if file Datatype is the same as the declared image object (T type) to use mmap.
Implements ImageBase.
Definition at line 797 of file xmipp_image.h.
|
inlinevirtual |
Clear. Initialize everything to 0
Implements ImageBase.
Definition at line 144 of file xmipp_image.h.
|
inline |
Clear the data pointer either mapped or not. Initially fix the pointer position in case of tricking a lower number of slices and starting in a slice different from zero.
Definition at line 156 of file xmipp_image.h.
|
inlinevirtual |
Implements ImageBase.
Definition at line 786 of file xmipp_image.h.
|
inline |
|
inlinevirtual |
Implements ImageBase.
Definition at line 779 of file xmipp_image.h.
|
virtual |
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.
Implements ImageBase.
Definition at line 276 of file xmipp_image.cpp.
|
inlinevirtual |
|
virtual |
Get geometric transformation matrix from 2D-image header
Implements ImageBase.
Definition at line 266 of file xmipp_image.cpp.
|
inlinevirtual |
Check whether image is complex based on T
Implements ImageBase.
Definition at line 173 of file xmipp_image.h.
|
inline |
flip image around Y axis
Definition at line 865 of file xmipp_image.h.
|
inlinevirtual |
flip image around X axis
Implements ImageBase.
Definition at line 838 of file xmipp_image.h.
|
inlinevirtual |
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.
Implements ImageBase.
Definition at line 931 of file xmipp_image.h.
|
inline |
Data access
This operator can be used to access the data multidimarray. In this way we could resize an image just by resizing its associated matrix or we could add two images by adding their matrices.
Definition at line 1025 of file xmipp_image.h.
|
inline |
Definition at line 1030 of file xmipp_image.h.
|
inline |
Pixel access
This operator is used to access a pixel within a 2D image. This is a logical access, so you could access to negative positions if the image has been defined so (see the general explanation for the class).
Definition at line 1049 of file xmipp_image.h.
|
inline |
Voxel access
This operator is used to access a voxel within a 3D image. This is a logical access, so you could access to negative positions if the image has been defined so (see the general explanation for the class).
Definition at line 1076 of file xmipp_image.h.
Copy the MDA and the fields related to the (possible) original file
Definition at line 1006 of file xmipp_image.h.
|
virtual |
Implements ImageBase.
Definition at line 38 of file xmipp_image.cpp.
|
virtual |
Internal apply geometrical transformations
Implements ImageBase.
Definition at line 247 of file xmipp_image.cpp.
|
inlineprotectedvirtual |
|
inlinevirtual |
Implements ImageBase.
Definition at line 773 of file xmipp_image.h.
Sum this object with other file and keep in this object
Implements ImageBase.
Definition at line 1105 of file xmipp_image.h.
|
inline |
Trasposes the given size array according to inverseOrder
Definition at line 202 of file xmipp_image.h.
|
inline |
Trasposes the given MultidimArray with the given order
Definition at line 221 of file xmipp_image.h.
|
inlinevirtual |
Write an entire page as datatype
A page of datasize_n elements T is cast to datatype and written to fimg The memory for the casted page is allocated and freed internally.
Implements ImageBase.
Definition at line 994 of file xmipp_image.h.
Definition at line 1550 of file xmipp_image.h.
|
friend |
Definition at line 1548 of file xmipp_image.h.
MultidimArray<T> Image< T >::data |
Definition at line 55 of file xmipp_image.h.