Image 转化 vtkpoints
void ImageToPoints(ImageType::Pointer sliceimage,vtkPoints*points)
{
typedef itk::ImageToVTKImageFilter<ImageType> itkVtkConverter;
itkVtkConverter::Pointer conv=itkVtkConverter::New();
conv->SetInput(sliceimage);
conv->Update();
vtkImageData *pData=conv->GetOutput();
int*dims=pData->GetDimensions();
double tmp[3];
int id=0;
double *spacing=orginalImage->GetSpacing();
double *origin=orginalImage->GetOrigin();
for(int i=0; i<dims[0]; i++)
{
for(int j=0; j<dims[1]; j++)
{
int tmp_point[3];
tmp_point[0]=i;
tmp_point[1]=j;
tmp_point[2]=0;
short* gray_value = static_cast<short*>(pData->GetScalarPointer(tmp_point));
if (*gray_value!=0)
{
tmp_point[2]=sliceIndex;
points->InsertNextPoint(tmp_point[0],tmp_point[1],tmp_point[2]);
}
}
}
}