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


C++ Transform3D::vector方法代码示例

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


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

示例1: eraseVolume

void EraserWidget::eraseVolume(TYPE* volumePointer)
{
	ImagePtr image = mPatientModelService->getActiveImage();
	vtkImageDataPtr img = image->getBaseVtkImageData();


	Eigen::Array3i dim(img->GetDimensions());
	Vector3D spacing(img->GetSpacing());

	Transform3D rMd = mVisualizationService->getGroup(0)->getOptions().mPickerGlyph->get_rMd();
	Vector3D c(mSphere->GetCenter());
	c = rMd.coord(c);
	double r = mSphere->GetRadius();
	mPreviousCenter = c;
	mPreviousRadius = r;

	DoubleBoundingBox3D bb_r(c[0]-r, c[0]+r, c[1]-r, c[1]+r, c[2]-r, c[2]+r);

	Transform3D dMr = image->get_rMd().inv();
	Transform3D rawMd = createTransformScale(spacing).inv();
	Transform3D rawMr = rawMd * dMr;
	Vector3D c_d = dMr.coord(c);
	double r_d = dMr.vector(r * Vector3D::UnitX()).length();
	c = rawMr.coord(c);
	r = rawMr.vector(r * Vector3D::UnitX()).length();
	DoubleBoundingBox3D bb0_raw = transform(rawMr, bb_r);
	IntBoundingBox3D bb1_raw(0, dim[0], 0, dim[1], 0, dim[2]);

//	std::cout << "     sphere: " << bb0_raw << std::endl;
//	std::cout << "        raw: " << bb1_raw << std::endl;

	for (int i=0; i<3; ++i)
	{
		bb1_raw[2*i] = std::max<double>(bb1_raw[2*i], bb0_raw[2*i]);
		bb1_raw[2*i+1] = std::min<double>(bb1_raw[2*i+1], bb0_raw[2*i+1]);
	}

	int replaceVal = mEraseValueAdapter->getValue();

	for (int x = bb1_raw[0]; x < bb1_raw[1]; ++x)
		for (int y = bb1_raw[2]; y < bb1_raw[3]; ++y)
			for (int z = bb1_raw[4]; z < bb1_raw[5]; ++z)
			{
				int index = x + y * dim[0] + z * dim[0] * dim[1];
				if ((Vector3D(x*spacing[0], y*spacing[1], z*spacing[2]) - c_d).length() < r_d)
					volumePointer[index] = replaceVal;
			}
}
开发者ID:normit-nav,项目名称:CustusX,代码行数:48,代码来源:cxEraserWidget.cpp

示例2: updateTexture

void CustomMetric::updateTexture(MeshPtr model, Transform3D rMrr)
{
	if (!model)
		return;

	if (!this->getTextureFollowTool() || !model->hasTexture())
		return;

	// special case:
	// Project tool position down to the model, then set that position as
	// the texture x pos.

	Transform3D rMt = mSpaceProvider->getActiveToolTipTransform(CoordinateSystem::reference());
	Transform3D rMd = rMrr * model->get_rMd();
	Vector3D t_r = rMt.coord(Vector3D::Zero());
	Vector3D td_r = rMt.vector(Vector3D::UnitZ());

	DoubleBoundingBox3D bb_d = model->boundingBox();
	Vector3D bl = bb_d.bottomLeft();
	Vector3D tr = bb_d.topRight();
	Vector3D c = (bl+tr)/2;
	Vector3D x_min_r(c[0], bl[1], c[2]);
	Vector3D x_max_r(c[0], tr[1], c[2]);
	x_min_r = rMd.coord(x_min_r);
	x_max_r = rMd.coord(x_max_r);

	double t_x = dot(t_r, td_r);
	double bbmin_x = dot(x_min_r, td_r);
	double bbmax_x = dot(x_max_r, td_r);
	double range = bbmax_x-bbmin_x;
	if (similar(range, 0.0))
		range = 1.0E-6;
	double s = (t_x-bbmin_x)/range;
	model->getTextureData().getPositionY()->setValue(s);
}
开发者ID:SINTEFMedtek,项目名称:CustusX,代码行数:35,代码来源:cxCustomMetric.cpp

示例3: get_sMt_new

Transform3D ToolTipCalibrationCalculator::get_sMt_new()
{
  Transform3D sMt_old = mTool->getCalibration_sMt();

  CoordinateSystem csT = mSpaces->getT(mTool); //to
  CoordinateSystem csRef = mSpaces->getT(mRef); //from
  Transform3D tMref = mSpaces->get_toMfrom(csRef, csT);

  Vector3D delta_t = tMref.vector(this->get_delta_ref());
  Transform3D T_delta_t = createTransformTranslate(delta_t);

  return sMt_old * T_delta_t;
}
开发者ID:c0ns0le,项目名称:CustusX,代码行数:13,代码来源:cxToolTipCalibrationWidget.cpp

示例4: updateClipPlane

void SlicePlaneClipper::updateClipPlane()
{
	if (!mSlicer)
		return;
	if (!mClipPlane)
		mClipPlane = vtkPlanePtr::New();

	Transform3D rMs = mSlicer->get_sMr().inv();

	Vector3D n = rMs.vector(this->getUnitNormal());
	Vector3D p = rMs.coord(Vector3D(0,0,0));
	mClipPlane->SetNormal(n.begin());
	mClipPlane->SetOrigin(p.begin());
}
开发者ID:c0ns0le,项目名称:CustusX,代码行数:14,代码来源:cxSlicePlaneClipper.cpp

示例5: getVectorUp

Vector3D CustomMetric::getVectorUp() const
{
    if(mDefineVectorUpMethod == mDefineVectorUpMethods.connectedFrameInP1)
    {
        std::vector<Transform3D> transforms = mArguments->getRefFrames();
        if (transforms.size()<2)
            return Vector3D::UnitZ();

        Transform3D rMframe = transforms[1];
        Vector3D upVector = rMframe.vector(Vector3D(-1,0,0));

        return upVector;
    }
	else if (mDefineVectorUpMethod == mDefineVectorUpMethods.tool)
	{
		Transform3D rMt = mSpaceProvider->getActiveToolTipTransform(CoordinateSystem::reference(), true);
		Vector3D toolUp = -Vector3D::UnitX();
		return rMt.vector(toolUp);
	}
	else
	{
		return mDataManager->getOperatingTable().getVectorUp();
	}
}
开发者ID:SINTEFMedtek,项目名称:CustusX,代码行数:24,代码来源:cxCustomMetric.cpp

示例6: determineAnnotation

QString OrientationAnnotationSmartRep::determineAnnotation(Vector3D planeDir_s, Transform3D rMs)
{
	Vector3D planeDir_r = rMs.vector(planeDir_s);

	QString text;
	double threshold = cos(mAngle);
//	double threshold = 0.5;

	for (std::map<QString, Vector3D>::iterator iter=mDCMDirections_r.begin(); iter!=mDCMDirections_r.end(); ++iter)
	{
		double w = dot(planeDir_r, iter->second);
		if (w > threshold)
			text += iter->first;
	}

	return text;
//	return "test_"+qstring_cast(planeDir_s);
}
开发者ID:SINTEFMedtek,项目名称:CustusX,代码行数:18,代码来源:cxOrientationAnnotation2DRep.cpp


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