请问怎么把vtkContourWidget画的闭合轮廓线,转换成一个二值图
vtk吧
全部回复
仅看楼主
level 7
wangdong1210 楼主
我现在手动在Dicom数据上画了一个闭合曲线,我想把这个曲线转换成二值图像数据,曲线内是1,曲线外是0。请问要怎么实现啊?
2017年11月06日 07点11分 1
level 7
wangdong1210 楼主
有人回答吗
2017年11月30日 03点11分 2
level 1
划线结果是polydata,你的数据是imagedata,需要用imagestencil那个东西转一下。大概意思就是按照imagedata的尺寸,把polydata限定为固定的大小,然后那个imagestencil还可以设置前景和背景色,然后输出就是你要的结果了。
2017年12月03日 03点12分 3
level 7
wangdong1210 楼主
多谢!问题已经解决了!
vtkSmartPointer<vtkImageData> tempImageData=vtkSmartPointer<vtkImageData>::New();
//得到维度
int dim[3];
imageData->GetDimensions(dim);
double o[3];
imageData->GetOrigin(o);
double spacing[3];
imageData->GetSpacing(spacing);
tempImageData->SetSpacing(spacing);
tempImageData->SetDimensions(dim);
tempImageData->SetOrigin(0,0,0);
tempImageData->AllocateScalars(VTK_UNSIGNED_CHAR,1);
tempImageData->SetExtent(0, dim[0] - 1, 0, dim[1] - 1, myInteractorStyle1->_Slice, myInteractorStyle1->_Slice);
vtkSmartPointer<vtkPolyDataToImageStencil> polyDataToImageStencil =
vtkSmartPointer<vtkPolyDataToImageStencil>::New();
polyDataToImageStencil->SetTolerance(0);
polyDataToImageStencil->SetInputData(contourRepresentation->GetContourRepresentationAsPolyData());
polyDataToImageStencil->SetOutputOrigin(tempImageData->GetOrigin());
polyDataToImageStencil->SetOutputSpacing(tempImageData->GetSpacing());
polyDataToImageStencil->SetOutputWholeExtent(0, dim[0] - 1, 0, dim[1] - 1, myInteractorStyle1->_Slice, myInteractorStyle1->_Slice);
polyDataToImageStencil->Update();
vtkSmartPointer<vtkImageStencilToImage> imageStencilToImage =
vtkSmartPointer<vtkImageStencilToImage>::New();
imageStencilToImage->SetInputConnection(polyDataToImageStencil->GetOutputPort());
imageStencilToImage->SetInsideValue(1);
imageStencilToImage->Update();
vtkSmartPointer<vtkImageAccumulate> imageAccumulate =
vtkSmartPointer<vtkImageAccumulate>::New();
imageAccumulate->SetStencilData(polyDataToImageStencil->GetOutput());
imageAccumulate->SetInputData(tempImageData);
imageAccumulate->Update();
vtkSmartPointer<vtkPNGWriter> writer =
vtkSmartPointer<vtkPNGWriter>::New();
writer->SetFileName("selection2.png");
writer->SetInputData(imageStencilToImage->GetOutput());
writer->Write();
2017年12月09日 00点12分 4
楼主,我想问一下,我用这个方法做出来之后没有报错,但是生成的二值图是纯黑的,能方便解答一下吗
2021年05月10日 13点05分
level 7
wangdong1210 楼主
contourRepresentation->GetContourRepresentationAsPolyData() 这里是关键!
vtkSmartPointer<vtkOrientedGlyphContourRepresentation> contourRepresentation;
contourRepresentation = vtkSmartPointer<vtkOrientedGlyphContourRepresentation>::New();
contourRepresentation->GetLinesProperty()->SetColor(1, 0, 0); // Set color to red
contourWidget->SetRepresentation(contourRepresentation);
2017年12月09日 00点12分 5
[大拇指] 我先研究一下,不懂再问你
2017年12月12日 03点12分
level 5
楼主,想问您一下怎么实现手动画闭合轮廓线
2018年04月10日 06点04分 6
手动画用tracerwidget
2018年04月10日 06点04分
楼主可否分享一下手动画闭合曲线的方法?
2020年01月08日 08点01分
@爱一路平凡 就是去看我说的这个类么,你去官网的文档里搜这个类,会有一个Demo。可以直接运行的
2020年01月08日 08点01分
楼主,我画了一个封闭曲线,为什么总是判定不闭合啊?
2020年02月02日 06点02分
level 1
楼主,怎么把这个闭合区域的轮廓线或者这个闭合区域保存下来,保存下来又是什么格式的呢?
2018年06月13日 05点06分 7
level 7
wangdong1210 楼主
我没保存啊,不过我觉得,你就直接把锚点的坐标,自己写个文件保存不就行了吗?
2018年06月13日 05点06分 8
level 1
lz 有联系方式吗?求交流 QQ
2018年09月14日 08点09分 9
19367527加这个群
2018年09月14日 08点09分
level 1
楼主可以请问一下您怎么用contourwidget实现手动画轮廓的嘛?
2019年11月18日 14点11分 10
level 1
您好,可不可以讲数据给我发一份,谢谢啦!邮箱:[email protected]
2019年12月18日 09点12分 11
level 7
手动画轮廓线用vtkImageTracerWidget吧。。。
2020年03月04日 09点03分 12
level 2
VTK+QT软件开发工程师(北京长木谷医疗科技有限公司)
薪资:15000-26000 学历:本科及以上
技能要求:VTK , ITK
岗位职责:
1、负责项目中的医学影像应用的研发及二次开发;
2、负责运用VTK等图像处理库进行软件功能研发;
3、通过集成图像处理算法实现具有特定功能的影像处理系统;
4、负责项目中软件测试及技术文档撰写。
任职资格:
1、计算机、图像处理、模式识别、生物医学工程相关专业的本科以上学历;
2、有2年以上医学影像应用的研发经验。精通ITK、VTK等开源工具者优先;
3、掌握计算机视觉和图像处理基本算法,对图像分割、特征提取、分类器识别、三维重建有较深入研究及相关项目经历。熟悉图像三维重建和图像处理算法设计与优化;
4、能够担当影像处理的研发任务和影像软件的开发、完善任务;
5、熟悉C/C++、具备良好的代码书写规范和文档编写能力;
6、有良好的英文阅读能力和书写能力;
7、熟悉DICOM、HL7、IHE等标准和规范者优先考虑;
8、具有三维图像重建及可视化经验者优先;
注:实习生及应届毕业生均可。
简历投递:[email protected]
2020年04月13日 08点04分 13
level 1
VTK完整教程: 希望对您有帮助,盼采纳:https://blog.csdn.net/it_xiangqiang/category_11009484.html
2021年05月12日 05点05分 14
1