当前位置: 首页>>代码示例>>C++>>正文


C++ Pointer::setOrigin方法代码示例

本文整理汇总了C++中imagegeom::Pointer::setOrigin方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::setOrigin方法的具体用法?C++ Pointer::setOrigin怎么用?C++ Pointer::setOrigin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在imagegeom::Pointer的用法示例。


在下文中一共展示了Pointer::setOrigin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dataCheck

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void SetOriginResolutionImageGeom::dataCheck()
{
  setErrorCondition(0);

  ImageGeom::Pointer image = getDataContainerArray()->getPrereqGeometryFromDataContainer<ImageGeom, AbstractFilter>(this, getDataContainerName());
  if(getErrorCondition() < 0)
  {
    return;
  }
  if(getChangeOrigin())
  {
    image->setOrigin(m_Origin.x, m_Origin.y, m_Origin.z);
  }
  if(getChangeResolution())
  {
    image->setResolution(m_Resolution.x, m_Resolution.y, m_Resolution.z);
  }
}
开发者ID:ravishivaraman,项目名称:DREAM3D,代码行数:21,代码来源:SetOriginResolutionImageGeom.cpp

示例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;

}
开发者ID:BlueQuartzSoftware,项目名称:SIMPL,代码行数:101,代码来源:VTKFileReader.cpp


注:本文中的imagegeom::Pointer::setOrigin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。