3DSlicer开发之路——Extensions(九)

BuildTestPackageDistributeExtensions

这一节用来解释怎样将你的Extensions进行Build,Test,Package和Distribute。同时解释MIDAS账户(extension server是基于它的)和其API key的用处

一、Step-by-step: How to create, publish, distribute and maintain an extension ?(一步一步来实现)

  • Scan through the user and developer extension FAQs(首先你要先浏览一下用户和开发者的关于extension 的FAQs,实际上user extension FAQs是developer extension FAQs的一部分,浏览developer extension FAQs就行了)
  • Inform a community about your plans on the Slicer forum to get information about potential parallel efforts (other developers may already work on a similar idea and you could join or build on each other's work), past efforts (related tools might have been available in earlier Slicer versions or in other software that you may reuse), and get early feedback from prospective users. You may also seek advice on the name of your extension and how to organize features into modules. All these can save you a lot of time in the long term.(先在Slicer forum上发表你关于自己extension的想法,看看有没有跟你做类似工作的人,或者你的extension的思想别人已经做过,你可以用别人开发好的工具,另外你也可以获取到很多关于你extension设计的建议)
  • Optional (required if developing loadable or CLI module types): Build Slicer application in Release. Not needed if you only develop Python modules.(如果你想要开发loadable或者CLI类型的模块的话,你需要自行对slicer从源码进行编译,并且编译版本得是Release版,因为你开发的模块需要用到很多Release版的库;对于Python 类型的模块,直接在slicer的二进制形式的发行版上开发就行了。参见Tutorials for software developers
  • Use the Extension Wizard module in Slicer to create an extension that will contain your module(s). Learn more about ExtensionWizard capabilities here(利用现有的模板创建extension ,可以有命令行的方式和GUI的方式,Extension Wizard的功能是很强大的,后面讲). To learn about extension description file format see here(前面讲过)
  • Save source code of your extension to a publicly available repository. It is recommended to start the repository name with "Slicer" (to make Slicer extensions easier to identify) followed by your extension name (for example, "Sequences" extension is stored in "SlicerSequences" repository). However, this is not a mandatory requirement. If you have a compelling reason not to use Slicer prefix, please make a note while making the pull request.(命名规则前面讲过)
  1. GitHub is recommended (due to large user community, free public project hosting): join Github and setup Git
  2. Extension Wizard command-line interface can upload source code of your extension to GitHub:
$ bin/slicerExtensionWizard --publish ~/Slicer-MyExtension/
  • Implement your extension. Hack, hack, hack :).(自行编程实现你的extension 的各种功能)Make sure to commit often using meaningful commit message.
  • Create documentation page for your extension(要创建一个documentation page)

  1.        It is recommended to put documentation in a README.md file in your repository use the Slicer wiki: Create a documentation page for your extension.(有模板套就行)

  • Optional (only needed, if you want to upload test data to MIDAS or troubleshoot extension upload problems)(这就是你前面创建MIDAS账户的原因): Create an account on the extension server and obtain an API Key. You will then use your midas login and api key to substitute <YOUR-MIDAS-LOGIN> and <YOUR-MIDAS-APIKEY> in the examples. Go to NA-MIC community and click on Join community</p></li>
  • Assuming the source code of your extension is located in folder MyExtension, you could upload your extension doing:

     @Linux or MacOSX (Makefile):

$ mkdir MyExtension-build
$ cd MyExtension-build
$ cmake -DCMAKE_BUILD_TYPE:STRING=Release -DMIDAS_PACKAGE_EMAIL:STRING=<YOUR-MIDAS-LOGIN> -DMIDAS_PACKAGE_API_KEY:STRING=<YOUR-MIDAS-APIKEY> -DSlicer_DIR:PATH=/path/to/Slicer-Superbuild/Slicer-build ../MyExtension
$ make ExperimentalUpload

     @Windows (Visual Studio)

  1. Start CMake, select source and build directory

  2. Add Slicer_DIR, MIDAS_PACKAGE_EMAIL and MIDAS_PACKAGE_API_KEY entries to the cache

                    

 

     3. Click on Configure, select Generator, then click on Generate button.

     4. Open MyExtension.sln (1), select Release configuration (2), select ExperimentalUpload (3) and Build (4).

                      

      5. To avoid typing the API email and key, you can set the environment variables MIDAS_PACKAGE_EMAIL and MIDAS_PACKAGE_API_KEY. More details here(下面的cache API credentials)

  • Optional (required for loadable and CLI modules): Build your extension(对上述两种类型的模块你需要编译它们)
  • Test your extension:
  1. If you have built your extension then build the PACKAGE target to create a package file that you can install from the Extension Manager by clicking the small tool icon in the top-right corner.(应该在release模式下进行build和PACKAGE,怎样用Extension Manager手动加载extension package前面讲过)
  2. If you have not built your extension then set up your extension manually: Build your extension(怎样Build your extension,后面讲
  • If you consider your extension is ready for distribution (你是否想要对Slicer贡献你的extension 并公开源码,不想的话,这一步就不要了), contribute it to the ExtensionsIndex:
  1. Fork ExtensionIndex repository on GitHub by clicking Fork button on https://github.com/Slicer/ExtensionsIndex page

  2. Add your .s4ext file to your forked repository: it can be done using a git client or simply by clicking Upload files button
  3. Create a pull request: by clicking Create pull request button
  4. Note: the Extension Wizard can automate this by the following command:

     

$ bin/slicerExtensionWizard --contribute ~/Slicer-MyExtension/

(强大的slicerExtensionWizard,但是自己试的话是有问题的,包括上面的--publish功能,不知道是不是与自己编译的slicerdebug模式有关,当初编译的debug版本的slicer,等我编译一波release版本再说

二、Contribution Checklist

Wait for your pull request to be merged. Respond to comments posted on the pull request. The following checklist will automatically be associated with your pull request.(接下来你就要等待你的pull request被slicer的管理者merged,你需要对你的pull request下的评论作出回应。并且 following checklist这个文件将会自动与你的pull request相关联。 following checklist这个文件就是ExtensionsIndex中的PULL_REQUEST_TEMPLATE.md文件,描述了你pull request的extension 的必要信息,让管理者和其它使用者明白你这个extension ,分为更新一个已存在extension pull request和添加一个新extensionpull request)

三、Continuous Integration

If you shared your extension by using the ExtensionWizard, make sure you know about the Slicer testing dashboard:(如果你用ExtensionWizard来分享你的extension,你需要了解Slicer testing dashboard )

http://slicer.cdash.org/index.php?project=Slicer4&display=project

The dashboard will attempt to check out the source code of your extension, build, test and package it on Linux, MacOSX and Windows platforms.(dashboard 将帮你在不同平台上检测你的源代码)

To find your extension, use the following link replacing Slicer-MyExtension with the name of your extension:

http://slicer.cdash.org/index.php?project=Slicer4&filtercount=1&showfilters=1&field1=buildname&compare1=63&value1=Slicer-MyExtension

For example, here is the link to check the status of the SlicerDMRI extension:

http://slicer.cdash.org/index.php?project=Slicer4&filtercount=1&showfilters=1&field1=buildname&compare1=63&value1=SlicerDMRI

If you see red in any of the columns for your extension, click on the hyperlinked number of errors to see the details.

Always check the dashboard after you first introduce your extension, or after you make any changes to the code!

 

来自 <https://www.slicer.org/wiki/Documentation/Nightly/Developers/Tutorials/BuildTestPackageDistributeExtensions>

 

 

 

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
3D Slicer是一个开源的医学图像处理和可视化软件,它可以用于生成模型点云数据。下面是使用3D Slicer生成模型点云数据的步骤: 1. 导入医学图像数据:在3D Slicer中,你可以导入医学图像数据,如CT或MRI扫描图像。点击菜单栏中的“Data”选项,选择“Add Data”来导入你的医学图像数据。 2. 图像分割:使用3D Slicer的分割工具对感兴趣的结构进行分割。点击菜单栏中的“Segmentation”选项,选择“Editor”来打开分割工具。使用不同的绘制工具和分割算法来绘制和分割你感兴趣的结构。 3. 生成模型:在完成分割后,点击菜单栏中的“Segmentation”选项,选择“Export to Model”来将分割结果导出为模型数据。选择合适的输出格式(如PLY或OBJ)和保存路径,然后点击“Save”按钮。 4. 生成点云数据:打开导出的模型文件(如PLY或OBJ)并将其加载到3D Slicer中。点击菜单栏中的“Extensions”选项,选择“ModelToPointCloud”来将模型转换为点云数据。选择合适的参数设置,如采样密度和滤波方法,然后点击“Apply”按钮。 5. 导出点云数据:在生成点云数据后,你可以将其导出为常见的点云格式,如PLY或XYZ。点击菜单栏中的“File”选项,选择“Save”来保存点云数据。选择合适的输出格式和保存路径,然后点击“Save”按钮。 这样,你就可以使用3D Slicer生成模型点云数据了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值