日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

3DSlicer7:FAQ-1

發布時間:2025/3/15 编程问答 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 3DSlicer7:FAQ-1 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.Core Feature 應該采用C++還是Python進行開發?

這并沒有統一的答案,因為Slicer應用各種語言和技術進行開發。
  • MRML和大多數邏輯操作符是采用c++開發的,如VTK子類
  • 應用和大多數的界面是采用C++開發的,如QWidget子類
  • 很多和C++捆綁在一起的重要模塊,如LabelStatistics/ExtensionWizard,采用Python腳本開發;另外一些,如Editor、DICOM、DataProbe,是采用C++和Python混合開發的
  • 其他的一些核心特征,如Charts、SceneViews、ExtensionManager等,依賴于JavaScript和網絡技術進行開發

2.組建 Building

2.1 Slicer building tree 是如何組織的?

Slicer building tree 有兩個層次:
  • ~/Projects/Slicer-SuperBuild:管理所有的依賴模塊,如VTK,ITK,Python...
  • ~/Projects/Slicer-SuperBuild/Slicer-build:組建目錄
Slicer的目錄結構請參看:https://www.slicer.org/wiki/Documentation/Nightly/Developers/DirectoryStructure 該目錄結構包括Slicer本體(Building tree;Install tree)、拓展安裝與組建樹、API

2.2 什么是Clean Building?

將Slicer目錄作為頂層文件;例如: C:/Projects/Slicer-SuperBuilding

2.3 如果VS編譯器崩潰了怎么辦?

如果VS編譯器崩潰了,并報錯 "Microsoft C/C++ Compiler Driver has stopped working", 最有可能的原因是路徑名字太長了。因此在組建Slicer工程時,強烈建議將其放在最頂層,如2.2.

2.4 Qt4>=4.85需要Ubuntu12.04以上的版本?

https://issues.slicer.org/view.php?id=3325

2.5 為什么分布式的CMake必能不用在Ubuntu12.04以上的版本?

http://slicer-devel-archive.65872.n3.nabble.com/PYTHON-INCLUDE-DIR2-when-building-Slicer4-td4028557.html https://issues.slicer.org/view.php?id=3103
https://issues.slicer.org/view.php?id=3116#c8649
http://public.kitware.com/Bug/view.php?id=14156

2.6 Windows上配置、組建Slicer?

https://www.slicer.org/wiki/Documentation/Nightly/Developers/Build_Instructions#Windows

3.Python Scripting

3.1 如何從Python腳本訪問一個Python腳本化模塊?

所有的Slicer模塊都在slicer.modules命名空間下,例如,如果我想訪問sampledata模塊可以采用如下方式: slicer.modules.sampledata. 如果想訪問模塊的窗口小部件,使用widgetRepresentations()獲得C++基礎類 & 使用self()獲得Python類。例如,slicer.modules.sampledata.widgetRepresentation().self()返回該模塊下的一個PythonWidget對象。

3.2 如何利用Python保存一幅圖像/體數據?

slicer.util模塊提供了保存一個節點saveNote或者整個場景saveScene的方法: 更多細節可以參考如下兩篇材料: https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/util.py#L229-267
https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/tests/test_slicer_util_save.py

3.3 在保存體數據時,如何實現壓縮和禁止壓縮?

在Slicer Python Modules中,使用VTKMRMLVolumeNode可以操作體數據。‘壓縮’等偏好會被傳遞到slicer.util.saveNode函數。這個屬性將會被傳遞到Slicer保存的Node里面。壓縮示例如下所示:
  • properties['useCompression'] = 0; #不采用壓縮
  • file-path = os.path.join(cast_dir,file_name)
  • slicer.util.saveNode(node,file_path,properties)

3.4 如何向Slicer的一個場景視圖中分配一個體數據Volume?

以MRHead體數據為例,操作如下:
  • red_logic = slicer.app.layoutManager().slicerWidget("Red").slicerLogic()
  • red_cn = red_logic.GetSlicerCompositeNode()
  • red_logic.GetSliceCompositeNode().SetBackgroundVolumeID(slicer.util.getNode('MRHead').GetID)
可以參考如下資料: http://slicer-devel-archive.65872.n3.nabble.com/Assign-volumes-to-views-tt4028694.html

3.5 如何在3DSlicer的視圖中訪問VTKRender?

renderer = slicer.app.layoutManager().threeDWidget(0).threeDView().renderWindow(). GetRenderers().GetFirstRenderer()

3.6 如何獲得VTK rendering的后端?

backend = slicer.app.layoutManager().threeDWidget(0).threeDView().renderWindow(). GetRenderingBackend()

3.7 如何在場景中使三維視圖居中?

  • ayoutManager = slicer.app.layoutManager()
  • threeDWidget = layoutManager.threeDWidget(0)
  • threeDView = threeDWidget.threeDView()
  • threeDView.resetFocalPoint()

3.8 如何隱藏一個變換?

  • n = getNode('Bone')
  • logic = slicer.vtkSlicerTransformLogic()
  • logic.hardenTransform(n)
參看資料詳見: http://slicer-devel-archive.65872.n3.nabble.com/Scripting-hardened-transforms-tt4029456.html

3.9 我在哪里可以找到一個示例的腳本?

所有的腳本文檔都在如下: https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository

3.10 我如何使用一個可視化的調試器進行單步調試?

在Windows系統,PTVS(Python Tool for Visual Studio,https://github.com/Microsoft/PTVS)支持在VS環境下調試Python代碼。至于具體的調試細節以及調試方法,可以參看如下: https://www.slicer.org/wiki/Documentation/Nightly/Developers/Tutorials/Debugging_Python_in_Visual_Studio

總結

以上是生活随笔為你收集整理的3DSlicer7:FAQ-1的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。