• 大小: 48KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-03
  • 语言: 其他
  • 标签: VTK  表面重建  CT  dicom  

资源简介

基于VTK的人头骨3D图像,用的是表面重建的方法。工具是vs2005,程序比较简单,用于初学者。

资源截图

代码片段和文件信息

// DicomLoad.cpp: implementation of the CDicomLoad class.
//
//////////////////////////////////////////////////////////////////////

#include “stdafx.h“
#include “Medical3D.h“
#include “DicomLoad.h“

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CDicomLoad::CDicomLoad()
{
fliterMethod=0;
int i;
for (i=0;i<9;i++)
kernel[i]=1;

resample[0]=1;
resample[1]=1;
resample[2]=1;
RadiusFactors[0]=2;
RadiusFactors[1]=2;
RadiusFactors[2]=1;

  reader =  vtkDICOMImageReader::New();
reader->SetDataByteOrderToLittleEndian();

  ShiftScale = vtkImageShiftScale::New();
ShiftScale->SetOutputScalarTypeToShort();
ShiftScale->SetShift (1024);
ShiftScale->ClampOverflowOn();

  readerImageCast = vtkImageCast::New();
readerImageCast->SetOutputScalarTypeToUnsignedShort();
readerImageCast->ClampOverflowOn();

  kernelfliter=vtkImageConvolve::New();
  gauss=vtkImageGaussianSmooth::New();
  HybridMedian2D=vtkImageHybridMedian2D::New();
  pImageResample=vtkImageResample::New();

}

CDicomLoad::~CDicomLoad()
{
reader->Delete() ;
ShiftScale->Delete();
    readerImageCast->Delete();
kernelfliter->Delete();
gauss->Delete();
HybridMedian2D->Delete();
pImageResample->Delete();
}

void CDicomLoad::pipeBuilding(CString path)
{
this->directory=path;
this->reader->SetDirectoryName(this->directory);
this->reader->Update();

switch  (this->fliterMethod)
{
case 1: 
this->kernelfliter->SetInputConnection(reader->GetOutputPort());
this->kernelfliter->SetKernel3x3 (kernel) ; 

this->pImageResample->SetInputConnection(kernelfliter->GetOutputPort());
this->pImageResample->SetAxisMagnificationFactor(0  resample[0]);
this->pImageResample->SetAxisMagnificationFactor(1  resample[1]);
this->pImageResample->SetAxisMagnificationFactor(2  resample[2]);
break;
case 2:
this->gauss->SetInputConnection(reader->GetOutputPort());
this->gauss->SetRadiusFactors  (RadiusFactors) ; 

this->pImageResample->SetInputConnection(gauss->GetOutputPort());
this->pImageResample->SetAxisMagnificationFactor(0  resample[0]);
this->pImageResample->SetAxisMagnificationFactor(1  resample[1]);
this->pImageResample->SetAxisMagnificationFactor(2  resample[2]);
break;
case 3:
HybridMedian2D->SetInputConnection(reader->GetOutputPort());

this->pImageResample->SetInputConnection(HybridMedian2D->GetOutputPort());
this->pImageResample->SetAxisMagnificationFactor(0  resample[0]);
this->pImageResample->SetAxisMagnificationFactor(1  resample[1]);
this->pImageResample->SetAxisMagnificationFactor(2  resample[2]);
break;
default ://无滤波操作
this->pImageResample->SetInputConnection(reader->GetOutputPor

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        883  2011-07-09 15:37  3D_Surface\3D_Surface.sln

    ..A..H.      7168  2011-07-09 15:37  3D_Surface\3D_Surface.suo

     文件      10820  2011-07-09 10:14  3D_Surface\3D_Surface.vcproj

     文件       1413  2011-07-09 15:37  3D_Surface\3D_Surface.vcproj.LIYONGYI.Administrator.user

     文件      20962  2011-07-09 15:35  3D_Surface\Debug\BuildLog.htm

     文件       3407  2007-07-16 15:40  3D_Surface\DicomLoad.cpp

     文件       1155  2007-07-11 20:38  3D_Surface\DicomLoad.h

     文件      41952  2011-07-09 10:16  3D_Surface\Medical3D.aps

     文件       2105  2007-07-11 19:42  3D_Surface\Medical3D.cpp

     文件       5367  2007-07-16 17:21  3D_Surface\Medical3D.dsp

     文件       1357  2007-07-11 19:42  3D_Surface\Medical3D.h

     文件       4547  2011-07-08 10:07  3D_Surface\Medical3D.rc

     文件       7521  2011-07-09 09:37  3D_Surface\Medical3DDlg.cpp

     文件       2073  2011-07-08 10:07  3D_Surface\Medical3DDlg.h

     文件       3633  2007-07-11 19:42  3D_Surface\ReadMe.txt

     文件      21630  2005-12-08 14:56  3D_Surface\res\Medical3D.ico

     文件        358  2010-11-19 18:16  3D_Surface\res\Medical3D.rc2

     文件       1021  2011-07-08 10:08  3D_Surface\Resource.h

     文件        211  2007-07-11 19:42  3D_Surface\StdAfx.cpp

     文件       1054  2007-07-11 19:42  3D_Surface\StdAfx.h

     文件       4769  2011-07-06 16:13  3D_Surface\SurfaceRender.cpp

     文件       1959  2007-07-16 14:07  3D_Surface\SurfaceRender.h

     目录          0  2011-07-09 15:37  3D_Surface\Debug

     目录          0  2011-07-09 09:40  3D_Surface\res

     目录          0  2011-07-09 15:38  3D_Surface

----------- ---------  ---------- -----  ----

               145365                    25


评论

共有 条评论