Xmipp  v3.23.11-Nereus
Classes | Macros | Functions
xmipp_image_generic.h File Reference
#include "xmipp_image_base.h"
#include "multidim_array_generic.h"
Include dependency graph for xmipp_image_generic.h:

Go to the source code of this file.

Classes

class  ImageGeneric
 

Macros

#define GETVALUE(type)   ret = NZYX_ELEM(*(MultidimArray<type>*)data->im,n,k,i,j);
 
#define GETVALUE(type)   ret = (double) A2D_ELEM(*(MultidimArray<type>*)data->im,i,j);
 
#define SETVALUE(type)   NZYX_ELEM(*(MultidimArray<type>*)data->im,n,k,i,j) = (type) value;
 
#define SETVALUE(type)   A2D_ELEM(*(MultidimArray<type>*)data->im,i,j) = (type) value;
 
#define INITCONS(type)   (*(MultidimArray<type>*)(data->im)).initConstant((type) value);
 
#define INITRND(type)   (*(MultidimArray<type>*)(data->im)).initRandom(op1, op2, mode);
 
#define CHECK_IMG(op)
 

Functions

void createEmptyFile (const FileName &_filename, int Xdim, int Ydim, int Zdim=1, size_t select_img=APPEND_IMAGE, bool isStack=false, int mode=WRITE_OVERWRITE, int _swapWrite=0, const MDRowVec *md=nullptr)
 

Macro Definition Documentation

◆ CHECK_IMG

#define CHECK_IMG (   op)
Value:
if (image == NULL) \
REPORT_ERROR(ERR_IMG_UNKNOWN, "ImageGeneric: Image not initialized.");\
else\
{\
op\
}
Unknown image type.
Definition: xmipp_error.h:130

Definition at line 35 of file xmipp_image_generic.h.

◆ GETVALUE [1/2]

#define GETVALUE (   type)    ret = NZYX_ELEM(*(MultidimArray<type>*)data->im,n,k,i,j);

◆ GETVALUE [2/2]

#define GETVALUE (   type)    ret = (double) A2D_ELEM(*(MultidimArray<type>*)data->im,i,j);

◆ INITCONS

#define INITCONS (   type)    (*(MultidimArray<type>*)(data->im)).initConstant((type) value);

◆ INITRND

#define INITRND (   type)    (*(MultidimArray<type>*)(data->im)).initRandom(op1, op2, mode);

◆ SETVALUE [1/2]

#define SETVALUE (   type)    NZYX_ELEM(*(MultidimArray<type>*)data->im,n,k,i,j) = (type) value;

◆ SETVALUE [2/2]

#define SETVALUE (   type)    A2D_ELEM(*(MultidimArray<type>*)data->im,i,j) = (type) value;

Function Documentation

◆ createEmptyFile()

void createEmptyFile ( const FileName _filename,
int  Xdim,
int  Ydim,
int  Zdim = 1,
size_t  select_img = APPEND_IMAGE,
bool  isStack = false,
int  mode = WRITE_OVERWRITE,
int  _swapWrite = 0,
const MDRowVec md = nullptr 
)

Create an empty image file

An image file, which name and format are given by filename, is created. Only the header info is written, and if image number is given, then disk space is reserved until select_img . Swap the endianness of the image header is also possible.

Definition at line 617 of file xmipp_image_generic.cpp.

619 {
620  ImageGeneric image;
621  size_t found = filename.find_first_of("%");
622  String strType = "";
623 
624  if (found == String::npos)
625  image.setDatatype(DT_Float);
626  else
627  {
628  strType = filename.substr(found+1).c_str();
629  image.setDatatype(str2Datatype(strType));
630  }
631 
632  // Use given metadata if present
633  if (md)
634  image.image->MDMainHeader = *md;
635 
636  image.mapFile2Write(xdim, ydim, Zdim, filename, false, select_img, isStack, mode, _swapWrite);
637 }
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 mode
ImageBase * image
MDRowVec MDMainHeader
DataType str2Datatype(const std::string &str)
void setDatatype(DataType _datatype)
std::string String
Definition: xmipp_strings.h:34