本文整理汇总了C++中imagegeom::Pointer::setDimensions方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::setDimensions方法的具体用法?C++ Pointer::setDimensions怎么用?C++ Pointer::setDimensions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类imagegeom::Pointer
的用法示例。
在下文中一共展示了Pointer::setDimensions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dataCheck
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void RegularizeZSpacing::dataCheck()
{
setErrorCondition(0);
if (getNewZRes() <= 0)
{
QString ss = QObject::tr("The new Z resolution Y (%1) must be positive").arg(getNewZRes());
setErrorCondition(-5555);
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
}
std::ifstream inFile;
inFile.open(m_InputFile.toLatin1().data());
if (!inFile.good())
{
QString ss = QObject::tr("Unable to open input file with name '%1'").arg(getInputFile());
setErrorCondition(-5556);
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
return;
}
ImageGeom::Pointer image = getDataContainerArray()->getPrereqGeometryFromDataContainer<ImageGeom, AbstractFilter>(this, getCellAttributeMatrixPath().getDataContainerName());
AttributeMatrix::Pointer cellAttrMat = getDataContainerArray()->getPrereqAttributeMatrixFromPath<AbstractFilter>(this, getCellAttributeMatrixPath(), -301);
if(getErrorCondition() < 0) {
return;
}
float zval = 0.0f;
for (size_t iter = 0; iter < image->getZPoints() + 1; iter++)
{
inFile >> zval;
}
size_t zP = static_cast<size_t>(zval / getNewZRes());
if(zP == 0) {
zP = 1;
}
if (getInPreflight())
{
image->setDimensions(image->getXPoints(), image->getYPoints(), zP);
QVector<size_t> tDims(3, 0);
tDims[0] = image->getXPoints();
tDims[1] = image->getYPoints();
tDims[2] = zP;
cellAttrMat->resizeAttributeArrays(tDims);
}
inFile.close();
}
示例2: readHeader
//.........这里部分代码省略.........
return -100;
}
QByteArray buf;
buf = in.readLine(); // Read Line 1 - VTK Version Info
buf = in.readLine(); // Read Line 2 - User Comment
setComment(QString(buf.trimmed()));
buf = in.readLine(); // Read Line 3 - BINARY or ASCII
QString fileType(buf);
if (fileType.startsWith("BINARY") == true)
{
setFileIsBinary(true);
}
else if (fileType.startsWith("ASCII") == true)
{
setFileIsBinary(false);
}
else
{
err = -1;
qDebug()
<< "The file type of the VTK legacy file could not be determined. It should be ASCII' or 'BINARY' and should appear on line 3 of the file."
;
return err;
}
QList<QByteArray> tokens;
buf = in.readLine(); // Read Line 4 - Type of Dataset
{
tokens = buf.split(' ');
setDatasetType(QString(tokens[1]));
}
buf = in.readLine(); // Read Line 5 which is the Dimension values
bool ok = false;
int64_t dims[3];
tokens = buf.split(' ');
dims[0] = tokens[1].toLongLong(&ok, 10);
dims[1] = tokens[2].toLongLong(&ok, 10);
dims[2] = tokens[3].toLongLong(&ok, 10);
#if (CMP_SIZEOF_SSIZE_T==4)
int64_t max = std::numeric_limits<size_t>::max();
#else
int64_t max = std::numeric_limits<int64_t>::max();
#endif
if (dims[0] * dims[1] * dims[2] > max )
{
err = -1;
QString ss = QObject::tr("The total number of elements '%1' is greater than this program can hold. Try the 64 bit version.").arg(dims[0] * dims[1] * dims[2]);
setErrorCondition(err);
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
return err;
}
if (dims[0] > max || dims[1] > max || dims[2] > max)
{
err = -1;
QString ss = QObject::tr("One of the dimensions is greater than the max index for this sysem. Try the 64 bit version. dim[0]=%1 dim[1]=%2im[2]=%3")\
.arg(dims[0]).arg(dims[1]).arg(dims[2]);
setErrorCondition(err);
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
return err;
}
size_t dcDims[3] = { static_cast<size_t>(dims[0]), static_cast<size_t>(dims[1]), static_cast<size_t>(dims[2]) };
DataContainer::Pointer dc = getDataContainerArray()->getDataContainer(getDataContainerName());
if (dc.get() == NULL)
{
return -1;
}
ImageGeom::Pointer image = dc->getGeometryAs<ImageGeom>();
if (image.get() == NULL)
{
return -1;
}
image->setDimensions(dcDims);
buf = in.readLine(); // Read Line 6 which is the Origin values
float origin[3];
tokens = buf.split(' ');
origin[0] = tokens[1].toFloat(&ok);
origin[1] = tokens[2].toFloat(&ok);
origin[2] = tokens[3].toFloat(&ok);
image->setOrigin(origin);
buf = in.readLine(); // Read Line 7 which is the Scaling values
float resolution[3];
tokens = buf.split(' ');
resolution[0] = tokens[1].toFloat(&ok);
resolution[1] = tokens[2].toFloat(&ok);
resolution[2] = tokens[3].toFloat(&ok);
image->setResolution(resolution);
return err;
}