资源简介
本程序可以将.vtk文件格式转化为.obj文件格式。
代码片段和文件信息
// mcSave.cpp : Defines the entry point for the console application.
//
#include “vtkProperty.h“
#include “vtkPolyDataNormals.h“
#include “vtkContourFilter.h“
#include “vtkMarchingCubes.h“
#include “vtkDICOMImageReader.h“
#include “vtkImageCast.h“
#include “vtkDecimatePro.h“
#include “vtkStripper.h“
#include “vtkImageShrink3D.h“
#include “vtkSmoothPolyDataFilter.h“
#include “vtkTriangleFilter.h“
#include “vtkImageData.h“
#include “vtkPolyDataWriter.h“
#include
#include “vtkxmlPolyDataWriter.h“
#include “vtkDataSetWriter.h“
#include
#include “vtkSTLWriter.h“
#include “vtkSmartPointer.h“
#include
#include “vtkJPEGReader.h“
#include “vtkOBJExporter.h“
#include “vtkRenderer.h“
#include “vtkRenderWindowInteractor.h“
#include “vtkRenderWindow.h“
#include “vtkPolyDataMapper.h“
#include “vtkOutlineFilter.h“
#include“vtkPolyDataReader.h“
#include“vtkCamera.h“
#include //这个文件必须有,不然要报错
VTK_MODULE_INIT(vtkRenderingOpenGL)//同上
//int main()
//{
//
// //vtkSmartPointer reader = vtkSmartPointer::New();
// //reader->SetFilePrefix(“E:\\ExportedImages\\16\\IMG_20111028_1_“);
// //reader->SetDataExtent(0 330 0 211 164 249);
// //reader->SetFilePattern(“%s%d.jpg“);
// //reader->SetDataSpacing(0.048 0.048 0.096);
// //reader->SetDataByteOrderToLittleEndian();
// //reader->SetDataOrigin(0 0 0);
// //reader->Update();
// vtkSmartPointer reader = vtkSmartPointer::New();
// reader->SetDirectoryName(“E:\\DICOM\\temp2“);
// reader->SetDataByteOrderToLittleEndian();
// reader->Update();
// cout << “读取数据完成“ << endl;
//
// vtkSmartPointer shrink = vtkSmartPointer::New();
// shrink->SetInputDataobject((vtkDataobject *)reader->GetOutput());
// //shrink->SetInput((vtkDataobject *)reader->GetOutput());
// shrink->SetShrinkFactors(4 4 1);
// shrink->AveragingOn();
//
// vtkSmartPointer skinExtractor = vtkSmartPointer::New();
// skinExtractor->SetInputConnection(shrink->GetOutputPort());
// skinExtractor->SetValue(0 200);
//
//
//
// vtkSmartPointer deci = vtkSmartPointer::New();
// deci->SetInputConnection(skinExtractor->GetOutputPort());
// deci->SetTargetReduction(0.3);
//
// vtkSmartPointer smooth = vtkSmartPointer::New();
// smooth->SetInputConnection(deci->GetOutputPort());
// smooth->SetNumberOfIterations(200);
//
// vtkSmartPointer skinNormals = vtkSmartPointer::New();
// skinNormals->SetInputConnection(smooth->GetOutputPort());
// skinNormals->SetFeatureAngle(60.0);
//
// vtkSmartPointer stripper = vtkSmartPointer::New();
// stripper->SetInputDataobject(skinNormals->GetOutput());
// //stripper->SetInput(skinNormals-
评论
共有 条评论