Xmipp
v3.23.11-Nereus
|
#include <xmipp_image_over.h>
Public Member Functions | |
void | init (int _umin, int _umax, int _uistep, int _vmin, int _vmax, int _vistep, int _wmin=0, int _wmax=0, int _wistep=1) |
void | init (MultidimArray< double > &im, int _uistep=1, int _vistep=0, int _wistep=0) |
void | window (int _v0, int _u0, int _vF, int _uF) |
void | clear () |
void | over2img (double v, double u, int &iv, int &iu) const |
void | img2over (size_t iv, size_t iu, double &v, double &u) const |
double | operator() (double v, double u) const |
double & | operator() (double v, double u) |
MultidimArray< double > & | operator() () |
const MultidimArray< double > & | operator() () const |
int | umax () const |
int | vmax () const |
int | wmax () const |
int | umin () const |
int | vmin () const |
int | Ustep () const |
int | Vstep () const |
int | Wstep () const |
void | downsample (Image< double > *I) const |
Public Member Functions inherited from Image< double > | |
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< double > &im) | |
Image (const MultidimArray< double > &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< double > &multidimArray, const std::array< int, 4 > &order) |
void | castPage2T (char *page, double *ptrDest, DataType datatype, size_t pageSize) |
void | castPage2T (char *page, std::complex< double > *ptrDest, DataType datatype, size_t pageSize) |
void | castPage2T (char *page, std::complex< double > *ptrDest, DataType datatype, size_t pageSize) |
void | castPage2Datatype (double *srcPtr, char *page, DataType datatype, size_t pageSize) const |
void | castPage2Datatype (std::complex< double > *srcPtr, char *page, DataType datatype, size_t pageSize) const |
void | castPage2Datatype (std::complex< double > *srcPtr, char *page, DataType datatype, size_t pageSize) const |
void | castConvertPage2Datatype (double *srcPtr, char *page, DataType datatype, size_t pageSize, double min0, double max0, CastWriteMode castMode=CW_CONVERT) const |
void | castConvertPage2Datatype (std::complex< double > *srcPtr, char *page, DataType datatype, size_t pageSize, double min0, double max0, CastWriteMode castMode) const |
void | castConvertPage2Datatype (std::complex< double > *srcPtr, char *page, DataType datatype, size_t pageSize, double min0, double max0, CastWriteMode castMode) 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< double > & | operator= (const Image< double > &op1) |
MultidimArray< double > & | operator() () |
const MultidimArray< double > & | operator() () const |
double & | operator() (int i, int j) const |
double & | operator() (int k, int i, int j) const |
bool | operator== (const Image< double > &i1) 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) |
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 | |
int | uistep |
int | vistep |
int | wistep |
int | overumax |
int | overvmax |
int | overwmax |
int | overumin |
int | overvmin |
int | overwmin |
Public Attributes inherited from Image< double > | |
MultidimArray< double > | data |
Public Attributes inherited from ImageBase | |
MultidimArrayBase * | mdaBase |
std::vector< std::unique_ptr< MDRow > > | MD |
MDRowVec | MDMainHeader |
Additional Inherited Members | |
Protected Member Functions inherited from Image< double > | |
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) |
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} |
The oversampled images are images which allow a more accurate treatment of information by oversampling all pixels. The idea of this class is to have an image with a logical size smaller than its physical one, for this reason you could use non integer logical positions to access to different samples of the "same" pixel. Let's set an example, blob footprints are of size 5x5, for instance, with the center at physical position 3x3. It's convenient to have this footprint defined between -2 and 2 with the origin at the center of the image. But it's also convenient to have more than 25 values of the footprint, this could be done by sampling finer each pixel, say 51 samples per pixel, this would result in an image of 255x255 samples (with the center at [127][127]). But we don't to access to the pixel at position (-120,-120) but to the one at logical position (-2.35,-2.35) which we know is close to the border. The oversampled image class allows you this kind of image access. You have to say from where to where your image is defined for each axis (in this case -2...2 for both) and which are the sampling rates for both axes (51 for both). This is the initialisation process. From now on you can work with your image in the way formerly described.
Pay attention to two points:
Oversampled images are normal images except for pixel access which can be done in two fashions: either using the normal Image procedures (in this case, you are restricted to the macro IMGPIXEL), or using the fractional indexes defined for this class. Have a look at the following example of how to compute the blob footprint with this kind of images. Pay special attention to the pixel access at the end of the loop. Notice that x and y moves at values between -2 and 2, which keep logical meaning of what we are doing while all the burden of computing where to put these values at the image is done by the library.
Note: for this class the X axis has been renamed as U, Y as V, and Z as W.
Definition at line 109 of file xmipp_image_over.h.
|
virtual |
Empty image
A 0x0 image with no information about oversampling is produced. Remember to re-initialise the oversampled image before starting to use it again.
Implements ImageBase.
Definition at line 93 of file xmipp_image_over.cpp.
void ImageOver::downsample | ( | Image< double > * | I | ) | const |
Generate the normal image by averaging
This function passes from an oversampled image to a normal one, in our example from the 250x250 image to a 5x5. A pointer to the normal image must be given.
Definition at line 103 of file xmipp_image_over.cpp.
|
inline |
Returns the logical position of a "physical" location
This function makes the conversion from image logical location to oversampled logical position. In our example of footprints the conversion between the oversampled position (-51,51) to the image index (-1,1) (what is returned). Notice that the "physical" position of the pixel (-51,51) is not the true physical one, that would be (76,178).
Definition at line 215 of file xmipp_image_over.h.
void ImageOver::init | ( | int | _umin, |
int | _umax, | ||
int | _uistep, | ||
int | _vmin, | ||
int | _vmax, | ||
int | _vistep, | ||
int | _wmin = 0 , |
||
int | _wmax = 0 , |
||
int | _wistep = 1 |
||
) |
Prepare the Oversampled Image for work
This function defines the oversampled image, it's very important to call it before starting to work with the image. If the sampling rate in any of the directions is an even number, then it is substituted by the next odd number (+1). This is done in order to force the logical oversampled pixels to be exactly in one cell of the underlying 2D matrix.
Definition at line 33 of file xmipp_image_over.cpp.
void ImageOver::init | ( | MultidimArray< double > & | im, |
int | _uistep = 1 , |
||
int | _vistep = 0 , |
||
int | _wistep = 0 |
||
) |
Initialize from Image
This functions sets the origins maximum values and steps from image arguments and values passed.
Definition at line 57 of file xmipp_image_over.cpp.
|
inline |
Constant pixel access with fractional indexes
This function returns you a constant pixel access referred with a fractional index. If you want to access to the pixels in the classic Image fashion then you should use the macro IMGPIXEL. An exception is thrown if you try to access an image outside the image.
Definition at line 249 of file xmipp_image_over.h.
|
inline |
Pixel access with fractional indexes
This function allows you to set pixels referred with a fractional index. If you want to access to the pixels in the classic Image fashion then you should use the macro IMGPIXEL.
Definition at line 270 of file xmipp_image_over.h.
|
inline |
Matrix access
This function allows you to access the Matrix2D over which the complex data type is based.
Definition at line 304 of file xmipp_image_over.h.
|
inline |
Definition at line 309 of file xmipp_image_over.h.
|
inline |
Returns the exact position of a non-integer location
The existing indexes (iu,iv) within the overimage are returned according to a certain (u,v) and the Oversampled Image definition. Usually this function is not needed in normal oversampled images operation as you can access to pixels with fractional indexes. In our example of footprints, this function would make the conversion between the oversampled position (-1,1) to the image index (-51,51) (what is returned). Don't be mislead by the physical position of the pixel (-51,51) which is (76,178).
Definition at line 175 of file xmipp_image_over.h.
|
inline |
Maximum value in not sampled units on U axis
In our example: 2.
Definition at line 322 of file xmipp_image_over.h.
|
inline |
Minimum value in not sampled units on U axis
In our example: -2.
Definition at line 361 of file xmipp_image_over.h.
|
inline |
Sampling rate in U axis
In our example: 51.
Definition at line 387 of file xmipp_image_over.h.
|
inline |
Maximum value in not sampled units on V axis
In our example: 2.
Definition at line 335 of file xmipp_image_over.h.
|
inline |
Minimum value in not sampled units on V axis
In our example: -2.
Definition at line 374 of file xmipp_image_over.h.
|
inline |
Sampling rate in V axis
In our example: 51.
Definition at line 400 of file xmipp_image_over.h.
void ImageOver::window | ( | int | _v0, |
int | _u0, | ||
int | _vF, | ||
int | _uF | ||
) |
Window
Set a selfWindow in the logical space.
Definition at line 76 of file xmipp_image_over.cpp.
|
inline |
Maximum value in not sampled units on W axis
In our example: 2.
Definition at line 348 of file xmipp_image_over.h.
|
inline |
Sampling rate in W axis
In our example: 51.
Definition at line 413 of file xmipp_image_over.h.
int ImageOver::overumax |
Definition at line 116 of file xmipp_image_over.h.
int ImageOver::overumin |
Definition at line 117 of file xmipp_image_over.h.
int ImageOver::overvmax |
Definition at line 116 of file xmipp_image_over.h.
int ImageOver::overvmin |
Definition at line 117 of file xmipp_image_over.h.
int ImageOver::overwmax |
Definition at line 116 of file xmipp_image_over.h.
int ImageOver::overwmin |
Definition at line 117 of file xmipp_image_over.h.
int ImageOver::uistep |
Definition at line 112 of file xmipp_image_over.h.
int ImageOver::vistep |
Definition at line 112 of file xmipp_image_over.h.
int ImageOver::wistep |
Definition at line 112 of file xmipp_image_over.h.