本文整理汇总了C++中ImageBase::selfApplyGeometry方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageBase::selfApplyGeometry方法的具体用法?C++ ImageBase::selfApplyGeometry怎么用?C++ ImageBase::selfApplyGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageBase
的用法示例。
在下文中一共展示了ImageBase::selfApplyGeometry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
/** Image inplace subtraction, equivalent to -= operator */
PyObject *
Image_applyTransforMatScipion(PyObject *obj, PyObject *args, PyObject *kwargs)
{
PyObject * list = NULL;
PyObject * item = NULL;
ImageObject *self = (ImageObject*) obj;
ImageBase * img;
PyObject *only_apply_shifts = Py_False;
PyObject *wrap = (WRAP ? Py_True : Py_False);
img = self->image->image;
bool boolOnly_apply_shifts = false;
bool boolWrap = WRAP;
try
{
PyArg_ParseTuple(args, "O|OO", &list, &only_apply_shifts, &wrap);
if (PyList_Check(list))
{
if (PyBool_Check(only_apply_shifts))
boolOnly_apply_shifts = (only_apply_shifts == Py_True);
else
PyErr_SetString(PyExc_TypeError, "ImageGeneric::applyGeo: Expecting boolean value");
if (PyBool_Check(wrap))
boolWrap = (wrap == Py_True);
else
PyErr_SetString(PyExc_TypeError, "ImageGeneric::applyGeo: Expecting boolean value");
size_t size = PyList_Size(list);
Matrix2D<double> A,B;
A.initIdentity(4);
for (size_t i = 0; i < size; ++i)
{
item = PyList_GetItem(list, i);
MAT_ELEM(A,i/4,i%4 ) = PyFloat_AsDouble(item);
}
double scale, shiftX, shiftY, shiftZ, rot,tilt, psi;
bool flip;
transformationMatrix2Parameters3D(A, flip, scale, shiftX, shiftY, shiftZ, rot,tilt, psi);
double _rot;
if (tilt==0.)
_rot=rot + psi;
else
_rot=psi;
img->setEulerAngles(0,0.,_rot);
img->setShifts(shiftX,shiftY);
img->setScale(scale);
img->setFlip(flip);
img->selfApplyGeometry(LINEAR, boolWrap, boolOnly_apply_shifts);//wrap, onlyShifts
Py_RETURN_NONE;
}
else
{
PyErr_SetString(PyExc_TypeError, "ImageGeneric::applyTransforMatScipion: Expecting a list");
}
}
catch (XmippError &xe)
{
PyErr_SetString(PyXmippError, xe.msg.c_str());
}
return NULL;
}//operator +=