码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • VTK 标注类Widget 文字标注 vtkCaptionWidget


    目录

    Part1: 简介

    Part2: 效果

     Part3: example


    Part1: 简介

    vtkCaptionWidget:用一个带线框及箭头的文本信息来标注某一对象;

    在可视化程序中,经常会对某个对象做一些标注说明;

    如,在医学图像诊断中,常常会手动标注出被诊断为肿瘤的区域或者其他病变区域,并用文字进行标注。

    Part2: 效果

    vtkCaptionWidget 如下表所示

     也可以给它加个中心点;

     Part3: example

    1. #include "vtkSmartPointer.h"
    2. #include "vtkObjectFactory.h"
    3. #include "vtkRenderWindow.h"
    4. #include "vtkGenericRenderWindowInteractor.h"
    5. #include "vtkRenderer.h"
    6. #include "vtkActor.h"
    7. #include "vtkDICOMImageReader.h"
    8. #include "vtkImageViewer2.h"
    9. #include "vtkInteractorStyleImage.h"
    10. /
    11. #include
    12. #include
    13. #include
    14. #include
    15. #include
    16. #include
    17. #include
    18. #include
    19. #include
    20. #include
    21. #include
    22. #include
    23. #include
    24. #include
    25. #include
    26. #include
    27. #include
    28. #include ///
    29. #include
    30. #include
    31. #include
    32. #include
    33. #include
    34. int main(int argc, char* argv[])
    35. {
    36. auto reader = vtkSmartPointer::New();
    37. reader->SetDirectoryName("D:/dicom");
    38. reader->Update();
    39. auto imageViewer = vtkSmartPointer::New();
    40. imageViewer->SetInputConnection(reader->GetOutputPort());
    41. auto interactor = vtkSmartPointer::New();
    42. interactor->SetRenderWindow(imageViewer->GetRenderWindow());
    43. imageViewer->SetupInteractor(interactor);
    44. imageViewer->SetSize(400, 400);
    45. imageViewer->SetColorLevel(211);
    46. imageViewer->SetColorWindow(2470);
    47. imageViewer->SetSliceOrientationToXY();
    48. imageViewer->GetRenderer()->SetBackground(0, 0, 0);
    49. vtkSmartPointer captionWidget =
    50. vtkSmartPointer::New();
    51. captionWidget->SetInteractor(interactor);
    52. captionWidget->GetCaptionActor2D();
    53. vtkSmartPointer captionRepresentation =
    54. vtkSmartPointer::New();
    55. captionRepresentation->GetCaptionActor2D()->SetCaption("VTK Caption Test");
    56. captionRepresentation->SetHandleSize(20);
    57. //captionRepresentation->GetCaptionActor2D()->SetBorder(false);
    58. captionRepresentation->GetCaptionActor2D()->GetTextActor()->GetTextProperty()->SetColor(1, 0, 0);
    59. captionRepresentation->GetCaptionActor2D()->GetTextActor()->GetTextProperty()->SetVerticalJustificationToCentered();
    60. double pos[3] = { 100,100, 10};
    61. captionRepresentation->SetAnchorPosition(pos);
    62. //captionWidget->SetCaptionActor2D(captionRepresentation->GetCaptionActor2D());
    63. captionWidget->SetRepresentation(captionRepresentation);
    64. captionWidget->On();
    65. imageViewer->Render();
    66. imageViewer->GetRenderer()->ResetCamera();
    67. imageViewer->Render();
    68. //memcpy(style->bound, captionWidget->GetRepresentation()->GetBounds(), sizeof(double) * 6);
    69. interactor->Start();
    70. return EXIT_SUCCESS;
    71. }

  • 相关阅读:
    Java反序列化之CommonsCollections(CC1)基础篇
    【openGauss数据迁移系列】使用pgloader将数据从MySQL迁移到openGauss的最佳实践
    Java版分布式微服务云开发架构 Spring Cloud+Spring Boot+Mybatis 电子招标采购系统功能清单
    【leetcode】429. N 叉树的层序遍历
    数据结构与算法:树 顺序存储二叉树(二)
    C# 连接SQL Sever 数据库与数据查询实例 数据仓库
    JavaWeb-05 jQuery
    嵌入式学习笔记(32)S5PV210的向量中断控制器
    【前端面试】(特别篇)面试准备——相互了解阶段
    钉钉h5微应用调试 整理
  • 原文地址:https://blog.csdn.net/q610098308/article/details/133904711
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号