本文整理汇总了C++中ImageView::getNRow方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageView::getNRow方法的具体用法?C++ ImageView::getNRow怎么用?C++ ImageView::getNRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageView
的用法示例。
在下文中一共展示了ImageView::getNRow方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fillKImageQuadrant
void SBTopHat::SBTopHatImpl::fillKImage(ImageView<std::complex<double> > im,
double kx0, double dkx, int izero,
double ky0, double dky, int jzero) const
{
dbg<<"SBTopHat fillKImage\n";
dbg<<"kx = "<<kx0<<" + i * "<<dkx<<", izero = "<<izero<<std::endl;
dbg<<"ky = "<<ky0<<" + j * "<<dky<<", jzero = "<<jzero<<std::endl;
if (izero != 0 || jzero != 0) {
xdbg<<"Use Quadrant\n";
fillKImageQuadrant(im,kx0,dkx,izero,ky0,dky,jzero);
} else {
xdbg<<"Non-Quadrant\n";
const int m = im.getNCol();
const int n = im.getNRow();
std::complex<double>* ptr = im.getData();
int skip = im.getNSkip();
assert(im.getStep() == 1);
kx0 *= _r0;
dkx *= _r0;
ky0 *= _r0;
dky *= _r0;
for (int j=0; j<n; ++j,ky0+=dky,ptr+=skip) {
double kx = kx0;
double kysq = ky0*ky0;
for (int i=0; i<m; ++i,kx+=dkx)
*ptr++ = kValue2(kx*kx + kysq);
}
}
}
示例2: assert
void SBTopHat::SBTopHatImpl::fillKImage(ImageView<std::complex<double> > im,
double kx0, double dkx, double dkxy,
double ky0, double dky, double dkyx) const
{
dbg<<"SBTopHat fillKImage\n";
dbg<<"kx = "<<kx0<<" + i * "<<dkx<<" + j * "<<dkxy<<std::endl;
dbg<<"ky = "<<ky0<<" + i * "<<dkyx<<" + j * "<<dky<<std::endl;
const int m = im.getNCol();
const int n = im.getNRow();
std::complex<double>* ptr = im.getData();
int skip = im.getNSkip();
assert(im.getStep() == 1);
kx0 *= _r0;
dkx *= _r0;
dkxy *= _r0;
ky0 *= _r0;
dky *= _r0;
dkyx *= _r0;
for (int j=0; j<n; ++j,kx0+=dkxy,ky0+=dky) {
double kx = kx0;
double ky = ky0;
for (int i=0; i<m; ++i,kx+=dkx,ky+=dkyx)
*ptr++ = kValue2(kx*kx + ky*ky);
}
}
示例3: assert
void SBGaussian::SBGaussianImpl::fillXImage(ImageView<T> im,
double x0, double dx, double dxy,
double y0, double dy, double dyx) const
{
dbg<<"SBGaussian fillXImage\n";
dbg<<"x = "<<x0<<" + i * "<<dx<<" + j * "<<dxy<<std::endl;
dbg<<"y = "<<y0<<" + i * "<<dyx<<" + j * "<<dy<<std::endl;
const int m = im.getNCol();
const int n = im.getNRow();
T* ptr = im.getData();
const int skip = im.getNSkip();
assert(im.getStep() == 1);
x0 *= _inv_sigma;
dx *= _inv_sigma;
dxy *= _inv_sigma;
y0 *= _inv_sigma;
dy *= _inv_sigma;
dyx *= _inv_sigma;
for (int j=0; j<n; ++j,x0+=dxy,y0+=dy,ptr+=skip) {
double x = x0;
double y = y0;
for (int i=0; i<m; ++i,x+=dx,y+=dyx)
*ptr++ = _norm * fmath::expd( -0.5 * (x*x + y*y) );
}
}
示例4: assert
void SBShapelet::SBShapeletImpl::fillKImage(ImageView<std::complex<double> > im,
double kx0, double dkx, int izero,
double ky0, double dky, int jzero) const
{
dbg<<"SBShapelet fillKImage\n";
dbg<<"kx = "<<kx0<<" + i * "<<dkx<<", izero = "<<izero<<std::endl;
dbg<<"ky = "<<ky0<<" + j * "<<dky<<", jzero = "<<jzero<<std::endl;
const int m = im.getNCol();
const int n = im.getNRow();
std::complex<double>* ptr = im.getData();
int skip = im.getNSkip();
assert(im.getStep() == 1);
kx0 *= _sigma;
dkx *= _sigma;
ky0 *= _sigma;
dky *= _sigma;
tmv::Matrix<double> mkx(m,n);
for (int i=0; i<m; ++i,kx0+=dkx) mkx.row(i).setAllTo(kx0);
tmv::Matrix<double> mky(m,n);
for (int j=0; j<n; ++j,ky0+=dky) mky.col(j).setAllTo(ky0);
tmv::Matrix<std::complex<double> > val(m,n);
fillKValue(val.view(),mkx,mky);
typedef tmv::VIt<std::complex<double>,1,tmv::NonConj> CIt;
CIt valit = val.linearView().begin();
for (int j=0; j<n; ++j,ptr+=skip) {
for (int i=0; i<m; ++i)
*ptr++ = *valit++;
}
}
示例5: assert
void SBSpergel::SBSpergelImpl::fillXImage(ImageView<double> im,
double x0, double dx, double dxy,
double y0, double dy, double dyx) const
{
dbg<<"SBSpergel fillXImage\n";
dbg<<"x = "<<x0<<" + i * "<<dx<<" + j * "<<dxy<<std::endl;
dbg<<"y = "<<y0<<" + i * "<<dyx<<" + j * "<<dy<<std::endl;
const int m = im.getNCol();
const int n = im.getNRow();
double* ptr = im.getData();
const int skip = im.getNSkip();
assert(im.getStep() == 1);
x0 *= _inv_r0;
dx *= _inv_r0;
dxy *= _inv_r0;
y0 *= _inv_r0;
dy *= _inv_r0;
dyx *= _inv_r0;
for (int j=0; j<n; ++j,x0+=dxy,y0+=dy,ptr+=skip) {
double x = x0;
double y = y0;
for (int i=0; i<m; ++i,x+=dx,y+=dyx)
*ptr++ = _xnorm * _info->xValue(sqrt(x*x + y*y));
}
}
示例6: fillXImageQuadrant
void SBSpergel::SBSpergelImpl::fillXImage(ImageView<double> im,
double x0, double dx, int izero,
double y0, double dy, int jzero) const
{
dbg<<"SBSpergel fillXImage\n";
dbg<<"x = "<<x0<<" + i * "<<dx<<", izero = "<<izero<<std::endl;
dbg<<"y = "<<y0<<" + j * "<<dy<<", jzero = "<<jzero<<std::endl;
if (izero != 0 || jzero != 0) {
xdbg<<"Use Quadrant\n";
fillXImageQuadrant(im,x0,dx,izero,y0,dy,jzero);
} else {
xdbg<<"Non-Quadrant\n";
const int m = im.getNCol();
const int n = im.getNRow();
double* ptr = im.getData();
const int skip = im.getNSkip();
assert(im.getStep() == 1);
x0 *= _inv_r0;
dx *= _inv_r0;
y0 *= _inv_r0;
dy *= _inv_r0;
for (int j=0; j<n; ++j,y0+=dy,ptr+=skip) {
double x = x0;
double ysq = y0*y0;
for (int i=0; i<m; ++i,x+=dx)
*ptr++ = _xnorm * _info->xValue(sqrt(x*x + ysq));
}
}
}
示例7: fillKImageQuadrant
void SBGaussian::SBGaussianImpl::fillKImage(ImageView<std::complex<T> > im,
double kx0, double dkx, int izero,
double ky0, double dky, int jzero) const
{
dbg<<"SBGaussian fillKImage\n";
dbg<<"kx = "<<kx0<<" + i * "<<dkx<<", izero = "<<izero<<std::endl;
dbg<<"ky = "<<ky0<<" + j * "<<dky<<", jzero = "<<jzero<<std::endl;
if (izero != 0 || jzero != 0) {
xdbg<<"Use Quadrant\n";
fillKImageQuadrant(im,kx0,dkx,izero,ky0,dky,jzero);
} else {
xdbg<<"Non-Quadrant\n";
const int m = im.getNCol();
const int n = im.getNRow();
std::complex<T>* ptr = im.getData();
int skip = im.getNSkip();
assert(im.getStep() == 1);
kx0 *= _sigma;
dkx *= _sigma;
ky0 *= _sigma;
dky *= _sigma;
// The Gaussian profile is separable:
// im(kx,ky) = _flux * exp(-0.5 * (kx*kx + ky*ky)
// = _flux * exp(-0.5 * kx*kx) * exp(-0.5 * ky*ky)
std::vector<double> gauss_kx(m);
std::vector<double> gauss_ky(n);
typedef std::vector<double>::iterator It;
It kxit = gauss_kx.begin();
for (int i=0; i<m; ++i,kx0+=dkx) *kxit++ = fmath::expd(-0.5 * kx0*kx0);
if ((kx0 == ky0) && (dkx == dky) && (m==n)) {
gauss_ky = gauss_kx;
} else {
It kyit = gauss_ky.begin();
for (int j=0; j<n; ++j,ky0+=dky) *kyit++ = fmath::expd(-0.5 * ky0*ky0);
}
for (int j=0; j<n; ++j,ptr+=skip) {
for (int i=0; i<m; ++i)
*ptr++ = _flux * gauss_kx[i] * gauss_ky[j];
}
}
}
示例8: fillXImageQuadrant
void SBGaussian::SBGaussianImpl::fillXImage(ImageView<T> im,
double x0, double dx, int izero,
double y0, double dy, int jzero) const
{
dbg<<"SBGaussian fillXImage\n";
dbg<<"x = "<<x0<<" + i * "<<dx<<", izero = "<<izero<<std::endl;
dbg<<"y = "<<y0<<" + j * "<<dy<<", jzero = "<<jzero<<std::endl;
if (izero != 0 || jzero != 0) {
xdbg<<"Use Quadrant\n";
fillXImageQuadrant(im,x0,dx,izero,y0,dy,jzero);
} else {
xdbg<<"Non-Quadrant\n";
const int m = im.getNCol();
const int n = im.getNRow();
T* ptr = im.getData();
const int skip = im.getNSkip();
assert(im.getStep() == 1);
x0 *= _inv_sigma;
dx *= _inv_sigma;
y0 *= _inv_sigma;
dy *= _inv_sigma;
// The Gaussian profile is separable:
// im(x,y) = _norm * exp(-0.5 * (x*x + y*y)
// = _norm * exp(-0.5 * x*x) * exp(-0.5 * y*y)
std::vector<double> gauss_x(m);
std::vector<double> gauss_y(n);
typedef std::vector<double>::iterator It;
It xit = gauss_x.begin();
for (int i=0; i<m; ++i,x0+=dx) *xit++ = fmath::expd(-0.5 * x0*x0);
if ((x0 == y0) && (dx == dy) && (m==n)) {
gauss_y = gauss_x;
} else {
It yit = gauss_y.begin();
for (int j=0; j<n; ++j,y0+=dy) *yit++ = fmath::expd(-0.5 * y0*y0);
}
for (int j=0; j<n; ++j,ptr+=skip) {
for (int i=0; i<m; ++i)
*ptr++ = _norm * gauss_x[i] * gauss_y[j];
}
}
}