<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:DengXian;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
{font-family:"\@DengXian";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Courier New";}
span.sy1
{mso-style-name:sy1;}
span.sy4
{mso-style-name:sy4;}
span.me2
{mso-style-name:me2;}
span.br0
{mso-style-name:br0;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p><span style="font-family:"Calibri",sans-serif;color:black">Dear all,<o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">I want to convert 3D DICOM or NIFTI image to points cloud (.stl) using vtkMarchingCubes.<o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">But there is always the error that ‘pointer to incomplete class type is not allowed’ when I deepcopy volume from reader(show in boldface in following code).<o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">I am using vtk 8.0.1. And I am a novice.<o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">I am looking forward to your answer.<o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">Thank you very much.<o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">There is the code :<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkSmartPointer</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkNIFTIImageReader</span><span style="font-size:9.5pt;font-family:Consolas;color:black">>
reader1 = </span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkSmartPointer</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkNIFTIImageReader</span><span style="font-size:9.5pt;font-family:Consolas;color:black">>::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"> reader1</span><span style="font-size:9.5pt;font-family:Consolas;color:teal">-></span><span style="font-size:9.5pt;font-family:Consolas;color:black">SetFileName(</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515">"C:/Users/studentx/Desktop/lung/test/case1-00.nii"</span><span style="font-size:9.5pt;font-family:Consolas;color:black">);<o:p></o:p></span></p>
<p><span style="font-size:9.5pt;font-family:Consolas;color:black"> reader1</span><span style="font-size:9.5pt;font-family:Consolas;color:teal">-></span><span style="font-size:9.5pt;font-family:Consolas;color:black">Update();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkSmartPointer</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkImageData</span><span style="font-size:9.5pt;font-family:Consolas;color:black">>
volume =<o:p></o:p></span></p>
<p><span style="font-size:9.5pt;font-family:Consolas;color:black"> </span>
<span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkSmartPointer</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkImageData</span><span style="font-size:9.5pt;font-family:Consolas;color:black">>::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkSmartPointer</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkMarchingCubes</span><span style="font-size:9.5pt;font-family:Consolas;color:black">>
surface =<o:p></o:p></span></p>
<p><span style="font-size:9.5pt;font-family:Consolas;color:black"> </span>
<span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkSmartPointer</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkMarchingCubes</span><span style="font-size:9.5pt;font-family:Consolas;color:black">>::New();<o:p></o:p></span></p>
<p><b><span style="font-size:10.0pt;font-family:Consolas;color:black">volume</span></b><b><span style="font-size:10.0pt;font-family:Consolas;color:teal">-></span></b><b><span style="font-size:10.0pt;font-family:Consolas;color:black">DeepCopy(reader1</span></b><b><span style="font-size:10.0pt;font-family:Consolas;color:teal">-></span></b><b><span style="font-size:10.0pt;font-family:Consolas;color:black">GetOutput());<o:p></o:p></span></b></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:gray">#if</span><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:#6F008A">VTK_MAJOR_VERSION</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> <= 5<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"> surface->SetInput(volume);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:gray">#else</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"> surface</span><span style="font-size:9.5pt;font-family:Consolas;color:teal">-></span><span style="font-size:9.5pt;font-family:Consolas;color:black">SetInputData(volume);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:gray">#endif</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"> surface</span><span style="font-size:9.5pt;font-family:Consolas;color:teal">-></span><span style="font-size:9.5pt;font-family:Consolas;color:black">ComputeNormalsOn();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"> surface</span><span style="font-size:9.5pt;font-family:Consolas;color:teal">-></span><span style="font-size:9.5pt;font-family:Consolas;color:black">SetValue(0,0.5);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkSmartPointer</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkPolyData</span><span style="font-size:9.5pt;font-family:Consolas;color:black">>
moving = </span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkSmartPointer</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> <</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkPolyData</span><span style="font-size:9.5pt;font-family:Consolas;color:black">>::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"> moving</span><span style="font-size:9.5pt;font-family:Consolas;color:teal">-></span><span style="font-size:9.5pt;font-family:Consolas;color:black">surface->GetOutput();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:green">//write polydata</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkSmartPointer</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkPolyDataWriter</span><span style="font-size:9.5pt;font-family:Consolas;color:black">>
writer0 = </span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkSmartPointer</span><span style="font-size:9.5pt;font-family:Consolas;color:black"><</span><span style="font-size:9.5pt;font-family:Consolas;color:#2B91AF">vtkPolyDataWriter</span><span style="font-size:9.5pt;font-family:Consolas;color:black">>::New();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"> writer0</span><span style="font-size:9.5pt;font-family:Consolas;color:teal">-></span><span style="font-size:9.5pt;font-family:Consolas;color:black">SetFileName(</span><span style="font-size:9.5pt;font-family:Consolas;color:#A31515">"C:/Users/studentx/Desktop/lung/test/case1orgin.stl"</span><span style="font-size:9.5pt;font-family:Consolas;color:black">);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"> writer0</span><span style="font-size:9.5pt;font-family:Consolas;color:teal">-></span><span style="font-size:9.5pt;font-family:Consolas;color:black">SetInputData(moving);<o:p></o:p></span></p>
<p><span style="font-size:9.5pt;font-family:Consolas;color:black"> writer0</span><span style="font-size:9.5pt;font-family:Consolas;color:teal">-></span><span style="font-size:9.5pt;font-family:Consolas;color:black">Write();<o:p></o:p></span></p>
<p><span style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p><span style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>