Xmipp  v3.23.11-Nereus
Public Member Functions | Public Attributes | List of all members
ImageOver Class Reference

#include <xmipp_image_over.h>

Inheritance diagram for ImageOver:
Inheritance graph
[legend]
Collaboration diagram for ImageOver:
Collaboration graph
[legend]

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 &params=DefaultApplyGeoParams)
 
int readApplyGeo (const FileName &name, const MetaData &md, size_t objId, const ApplyGeoParams &params=DefaultApplyGeoParams)
 
int readApplyGeo (const MetaData &md, size_t objId, const ApplyGeoParams &params=DefaultApplyGeoParams)
 
void applyGeo (const MetaData &md, size_t objId, const ApplyGeoParams &params=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 FileNamename () 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
 
MDRowgetGeometry (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
MultidimArrayBasemdaBase
 
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)
 
ImageFHandleropenFile (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
 
TIFFtif
 
hid_t fhdf5
 
ImageFHandlerhFile
 
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}
 

Detailed Description

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.

(
ImageOver& blobprint, // blob foot_print table
const struct blobtype& blob, // blob description
int istep, // number of foot-print samples per one sample
// on projection plane in u,v directions
int normalise) // set to 1 if you want normalise. Usually
// you may omit it and no normalisation is performed
{
// Resize output image and redefine the origin of it
int footmax = CEIL(blob.radius);
blobprint.init(-footmax, footmax, istep, -footmax, footmax, istep);
// Run for indexes in the Image class
for (int i = STARTINGY(blobprint()); i <= FINISHINGY(blobprint()); i++)
for (int j = STARTINGX(blobprint()); j <= FINISHINGX(blobprint());
j++)
{
// Compute oversampled index, and then its value
double vi, ui;
IMG2OVER(blobprint, i, j, vi, ui);
double r = sqrt(vi*vi + ui*ui);
IMGPIXEL(blobprint, i, j) = blob_val(r, blob);
}
// Adjust the footprint structure
if (normalise)
blobprint() = blobprint() / blobprint().sum();
}

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.

Member Function Documentation

◆ clear()

void ImageOver::clear ( )
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.

IO.clear();

Implements ImageBase.

Definition at line 93 of file xmipp_image_over.cpp.

94 {
95  overvmin = overvmax = 0;
96  overumin = overumax = 0;
97  overwmin = overwmax = 0;
98  wistep = vistep = uistep = 1;
100 }
void clear()
Definition: xmipp_image.h:144

◆ downsample()

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.

IO.down_sample(&I);

Definition at line 103 of file xmipp_image_over.cpp.

104 {
105  IMGMATRIX(*I).resize(overwmax - overwmin + 1,
106  overvmax - overvmin + 1, overumax - overumin + 1);
107 
108  double iNorm = 1./(wistep * vistep * uistep);
109 
110  for (int k = overwmin; k <= overwmax; ++k)
111  for (int i = overvmin; i <= overvmax; ++i)
112  for (int j = overumin; j <= overumax; ++j)
113  {
114  VOLVOXEL(*I, k, i, j) = 0;
115  for (int w = (k - overwmin) * wistep; w < (k + 1 - overwmin)*wistep; ++w)
116  for (int v = (i - overvmin) * vistep; v < (i + 1 - overvmin)*vistep; ++v)
117  for (int u = (j - overumin) * uistep; u < (j + 1 - overumin)*uistep; ++u)
118  {
119  VOLVOXEL(*I, k, i, j) += VOLVOXEL(*this, w, v, u);
120  }
121  VOLVOXEL(*I, k, i, j) *= iNorm;
122  }
123 }
#define VOLVOXEL(V, k, i, j)
doublereal * w
#define IMGMATRIX(I)
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
#define j
doublereal * u

◆ img2over()

void ImageOver::img2over ( size_t  iv,
size_t  iu,
double &  v,
double &  u 
) const
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).

IO.img2over(iv, iu, v, u);

Definition at line 215 of file xmipp_image_over.h.

216  {
217  if (iu < 0 || iu > XSIZE(data))
218  REPORT_ERROR(ERR_VALUE_INCORRECT, "ImageOver::img2over: iu out of range");
219  if (iv < 0 || iv > YSIZE(data))
220  REPORT_ERROR(ERR_VALUE_INCORRECT, "ImageOver::img2over: iv out of range");
221  u = (double)(overumin) + iu / (double)(uistep);
222  v = (double)(overvmin) + iv / (double)(vistep);
223  }
#define YSIZE(v)
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
MultidimArray< double > data
Definition: xmipp_image.h:55
#define XSIZE(v)
doublereal * u
Incorrect value received.
Definition: xmipp_error.h:195

◆ init() [1/2]

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.

IO.init(-2, 2, 51, -2, 2, 51);

Definition at line 33 of file xmipp_image_over.cpp.

36 {
37  overvmin = _vmin;
38  overumin = _umin;
39  overvmax = _vmax;
40  overumax = _umax;
41  vistep = _vistep;
42  uistep = _uistep;
43 
44  overwmin = _wmin;
45  overwmax = _wmax;
46  wistep = _wistep;
47 
48  // data.initZeros((_vmax-_vmin+1)*_vistep,(_umax-_umin+1)*_uistep);
49  data.initZeros((_wmax - _wmin)*_wistep + 1,(_vmax - _vmin)*_vistep + 1, (_umax - _umin)*_uistep + 1);
50  STARTINGZ(data) = 0;
51  STARTINGY(data) = 0;
52  STARTINGX(data) = 0;
53  // STARTINGY(img)=_vmin*_vistep - (_vistep-1)/2;
54  // STARTINGX(img)=_umin*_uistep - (_uistep-1)/2;
55 }
#define STARTINGX(v)
#define STARTINGY(v)
MultidimArray< double > data
Definition: xmipp_image.h:55
void initZeros(const MultidimArray< T1 > &op)
#define STARTINGZ(v)

◆ init() [2/2]

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.

58 {
59  overumin = STARTINGX(im);
60  overvmin = STARTINGY(im);
61  overwmin = STARTINGZ(im);
62  overumax = STARTINGX(im) + XSIZE(im) - 1;
63  overvmax = STARTINGY(im) + YSIZE(im) - 1;
64  overwmax = STARTINGZ(im) + ZSIZE(im) - 1;
65  uistep = _uistep;
66  vistep = (YSIZE(im) > 1) ? ((_vistep == 0) ? uistep : _vistep) : 0;
67  wistep = (ZSIZE(im) > 1) ? ((_wistep == 0) ? uistep : _wistep) : 0;
68 
69  data.initZeros(im);
70  STARTINGZ(data) = 0;
71  STARTINGY(data) = 0;
72  STARTINGX(data) = 0;
73 }
#define YSIZE(v)
#define STARTINGX(v)
#define STARTINGY(v)
MultidimArray< double > data
Definition: xmipp_image.h:55
#define XSIZE(v)
#define ZSIZE(v)
void initZeros(const MultidimArray< T1 > &op)
#define STARTINGZ(v)

◆ operator()() [1/4]

double ImageOver::operator() ( double  v,
double  u 
) const
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.

std::cout << IO(1.34,-0.56) << std::endl;

Definition at line 249 of file xmipp_image_over.h.

250  {
251  if (v < overvmin || v > overvmax)
252  REPORT_ERROR(ERR_VALUE_INCORRECT, "ImgeOver::over2img: v out of range");
253  if (u < overumin || u > overumax)
254  REPORT_ERROR(ERR_VALUE_INCORRECT, "ImgeOver::over2img: u out of range");
255  int iu, iv;
256  OVER2IMG(*this, v, u, iv, iu);
257  return A2D_ELEM(data, iv, iu);
258  }
#define A2D_ELEM(v, i, j)
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
MultidimArray< double > data
Definition: xmipp_image.h:55
#define OVER2IMG(IO, v, u, iv, iu)
doublereal * u
Incorrect value received.
Definition: xmipp_error.h:195

◆ operator()() [2/4]

double& ImageOver::operator() ( double  v,
double  u 
)
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.

IO(1.34, -0.56) = 1;

Definition at line 270 of file xmipp_image_over.h.

271  {
272  int iu, iv;
273  OVER2IMG(*this, v, u, iv, iu);
274  return A2D_ELEM(data, iv, iu);
275  }
#define A2D_ELEM(v, i, j)
MultidimArray< double > data
Definition: xmipp_image.h:55
#define OVER2IMG(IO, v, u, iv, iu)
doublereal * u

◆ operator()() [3/4]

MultidimArray< double >& ImageOver::operator() ( )
inline

Matrix access

This function allows you to access the Matrix2D over which the complex data type is based.

std::cout << IO();

Definition at line 304 of file xmipp_image_over.h.

305  {
306  return data;
307  }
MultidimArray< double > data
Definition: xmipp_image.h:55

◆ operator()() [4/4]

const MultidimArray< double >& ImageOver::operator() ( ) const
inline

Definition at line 309 of file xmipp_image_over.h.

310  {
311  return data;
312  }
MultidimArray< double > data
Definition: xmipp_image.h:55

◆ over2img()

void ImageOver::over2img ( double  v,
double  u,
int &  iv,
int &  iu 
) const
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).

IO.over2img(y, x, iy, ix);

Definition at line 175 of file xmipp_image_over.h.

176  {
177  if (v < overvmin || v > overvmax)
178  REPORT_ERROR(ERR_VALUE_INCORRECT, "ImgeOver::over2img: v out of range");
179 
180  if (u < overumin || u > overumax)
181  REPORT_ERROR(ERR_VALUE_INCORRECT, "ImgeOver::over2img: u out of range");
182 
183  iu = (int) ROUND((((u) - overumin) * uistep));
184  iv = (int) ROUND((((v) - overvmin) * vistep));
185  }
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
#define ROUND(x)
Definition: xmipp_macros.h:210
doublereal * u
Incorrect value received.
Definition: xmipp_error.h:195

◆ umax()

int ImageOver::umax ( ) const
inline

Maximum value in not sampled units on U axis

In our example: 2.

int Umax = IO.umax();

Definition at line 322 of file xmipp_image_over.h.

323  {
324  return overumax;
325  }

◆ umin()

int ImageOver::umin ( ) const
inline

Minimum value in not sampled units on U axis

In our example: -2.

int Umin = IO.umin();

Definition at line 361 of file xmipp_image_over.h.

362  {
363  return overumin;
364  }

◆ Ustep()

int ImageOver::Ustep ( ) const
inline

Sampling rate in U axis

In our example: 51.

int Usampling = IO.Ustep();

Definition at line 387 of file xmipp_image_over.h.

388  {
389  return uistep;
390  }

◆ vmax()

int ImageOver::vmax ( ) const
inline

Maximum value in not sampled units on V axis

In our example: 2.

int Vmax = IO.vmax();

Definition at line 335 of file xmipp_image_over.h.

336  {
337  return overvmax;
338  }

◆ vmin()

int ImageOver::vmin ( ) const
inline

Minimum value in not sampled units on V axis

In our example: -2.

int Vmin = IO.vmin();

Definition at line 374 of file xmipp_image_over.h.

375  {
376  return overvmin;
377  }

◆ Vstep()

int ImageOver::Vstep ( ) const
inline

Sampling rate in V axis

In our example: 51.

int Vsampling = IO.Vstep();

Definition at line 400 of file xmipp_image_over.h.

401  {
402  return vistep;
403  }

◆ window()

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.

77 {
78  overvmin = _v0;
79  overumin = _u0;
80  overvmax = _vF;
81  overumax = _uF;
82 
83  int newYdim = (_vF - _v0) * vistep + 1;
84  int newXdim = (_uF - _u0) * uistep + 1;
87  LAST_XMIPP_INDEX(newYdim), LAST_XMIPP_INDEX(newXdim));
88  STARTINGY(data) = 0;
89  STARTINGX(data) = 0;
90 }
void selfWindow(int n0, int z0, int y0, int x0, int nF, int zF, int yF, int xF, T init_value=0)
#define STARTINGX(v)
#define STARTINGY(v)
MultidimArray< double > data
Definition: xmipp_image.h:55
#define FIRST_XMIPP_INDEX(size)
Definition: xmipp_macros.h:439
#define LAST_XMIPP_INDEX(size)
Definition: xmipp_macros.h:448

◆ wmax()

int ImageOver::wmax ( ) const
inline

Maximum value in not sampled units on W axis

In our example: 2.

int Wmax = IO.wmax();

Definition at line 348 of file xmipp_image_over.h.

349  {
350  return overwmax;
351  }

◆ Wstep()

int ImageOver::Wstep ( ) const
inline

Sampling rate in W axis

In our example: 51.

int Wsampling = IO.Wstep();

Definition at line 413 of file xmipp_image_over.h.

414  {
415  return wistep;
416  }

Member Data Documentation

◆ overumax

int ImageOver::overumax

Definition at line 116 of file xmipp_image_over.h.

◆ overumin

int ImageOver::overumin

Definition at line 117 of file xmipp_image_over.h.

◆ overvmax

int ImageOver::overvmax

Definition at line 116 of file xmipp_image_over.h.

◆ overvmin

int ImageOver::overvmin

Definition at line 117 of file xmipp_image_over.h.

◆ overwmax

int ImageOver::overwmax

Definition at line 116 of file xmipp_image_over.h.

◆ overwmin

int ImageOver::overwmin

Definition at line 117 of file xmipp_image_over.h.

◆ uistep

int ImageOver::uistep

Definition at line 112 of file xmipp_image_over.h.

◆ vistep

int ImageOver::vistep

Definition at line 112 of file xmipp_image_over.h.

◆ wistep

int ImageOver::wistep

Definition at line 112 of file xmipp_image_over.h.


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