医学四视图-004-四视图增加文字显示

简介: 医学四视图-004-四视图增加文字显示

image.png这篇文章中就要给我的四视图增加文字显示了,这个东西就是在我摄像机上面的,不会随着图像变化而变化,感觉这个是不是就是在3D中的那种HUD呢。


电梯


1 效果展示

2 vtkTextActor

3 实现代码

3.1 头文件

3.2 源文件实现

3.2.1 新建变量,赋值,设置属性

3.2.2 加入到渲染器中

☞ 源码

1 效果展示

如下图所示,在每个图的左上角和左下角有文字显示,左上角显示的病人的基本信息,左下角显示的是当前切面。

image.png

2 vtkTextActor


实现文字显示,主要将用到vtkTextActor,这里还是把参考链接附上

https://vtk.org/doc/nightly/html/classvtkTextActor.htmlimage.png

image.png

for (auto i=0;i<4;i++)
{
    textActor[i] = vtkSmartPointer<vtkTextActor>::New();
    textActor[i]->SetDisplayPosition(5, 5);
    textActor[i]->GetTextProperty()->SetFontSize(14);
    textActor[i]->GetTextProperty()->SetFontFamily(VTK_FONT_FILE);
    textActor[i]->GetTextProperty()->SetFontFile(QString("./Fonts/simhei.ttf").toUtf8());
}
textActor[0]->SetInput(QString::fromUtf8("矢状").toUtf8());
textActor[0]->GetTextProperty()->SetColor(0, 1, 0);
textActor[1]->SetInput(QString::fromUtf8("冠状").toUtf8());
textActor[1]->GetTextProperty()->SetColor(0, 0, 1);
textActor[2]->SetInput(QString::fromUtf8("轴向").toUtf8());
textActor[2]->GetTextProperty()->SetColor(1, 0, 0);
textActor[3]->SetInput(QString::fromUtf8("3D").toUtf8());
textActor[3]->GetTextProperty()->SetColor(1, 1, 0);
for (auto i=0;i<4;i++)
{
    peopleInforTextActor[i] = vtkSmartPointer<vtkTextActor>::New();
    peopleInforTextActor[i]->GetTextProperty()->SetFontSize(14);
    peopleInforTextActor[i]->GetTextProperty()->SetFontFamily(VTK_FONT_FILE);
    peopleInforTextActor[i]->GetTextProperty()->SetFontFile(QString("./Fonts/simhei.ttf").toUtf8());
    peopleInforTextActor[i]->SetInput(reader->GetPatientName());
}
peopleInforTextActor[0]->GetTextProperty()->SetColor(0, 1, 0);
peopleInforTextActor[0]->SetDisplayPosition(5,ui->widget_1->height()-20);
peopleInforTextActor[1]->GetTextProperty()->SetColor(0, 0, 1);
peopleInforTextActor[1]->SetDisplayPosition(5,ui->widget_2->height()-20);
peopleInforTextActor[2]->GetTextProperty()->SetColor(1, 0, 0);
peopleInforTextActor[2]->SetDisplayPosition(5,ui->widget_3->height()-20);
peopleInforTextActor[3]->GetTextProperty()->SetColor(1, 1, 0);
peopleInforTextActor[3]->SetDisplayPosition(5,ui->widget_4->height()-20);

image.png

目录
相关文章
|
容器
医学四视图-005-四视图加按钮
医学四视图-005-四视图加按钮
216 0
医学四视图-005-四视图加按钮
医学四视图-007-增加按钮,增加文档提示
医学四视图-007-增加按钮,增加文档提示
305 0
医学四视图-007-增加按钮,增加文档提示
|
容器
表格视图 - 使用代码自定义行高度
1. 实现UITableViewDelegate协议 @interface ViewController ()   2. 将表格视图的代理属性指向其父容器视图 self.myTableView.
771 0
医学四视图-002-四视图实现
医学四视图-002-四视图实现
860 0
医学四视图-002-四视图实现
|
小程序 JavaScript
小程序实现竖行布局视图(类表格)
小程序实现竖行布局视图(类表格)
117 0
表格视图 - 填充数据
1. 实现UITableViewDataSource协议 2. 实现协议规定的重要方法 // 通知表格视图要装载的区段数(可选)  numberOfSectionsInTableView:   // 告诉表格视图控制器每个区段应该装载多少单元格或者行数(强制) tableView:num...
651 0
多样化信息显示控件 InfoGrid-更新
InfoGrid<br>本表格控件是提供给多样化信息控制的程序.<br>单元格支持 文本框 ,标签, 按钮,图片框,进度条等.用来显示一些多样化信息比较方便一些.最主要的是避免了多线程下类似 DataTable 这里控件和DataGrid搭配时出现的随机异常等问题.同时本控件比较有着相当灵活的操作方法.<br><br><br>InfoGrid 1.0.0<br>该程序分四个项目,InfoIte
1054 0
医学四视图-008-增加十字线开关功能,按钮显隐功能
医学四视图-008-增加十字线开关功能,按钮显隐功能
280 0
医学四视图-008-增加十字线开关功能,按钮显隐功能
文字处理技术:视图坐标都是在父视图的相对坐标
文字处理技术:视图坐标都是在父视图的相对坐标
92 0

热门文章

最新文章