<DIV>Hello to all,</DIV>
<DIV> </DIV>
<DIV>I am trying to create a 3D model of a scapula. I am having the CT images 178 slices of the bone. I have been able to convert the slices into a single .mha file and then I have cropped it, and thresholded it to select the bone. Now I have written the binary image as a .mha file.</DIV>
<DIV> </DIV>
<DIV>I tried to look at the examples in vtk to make the marching cubes model but could not understand it very well. I tried to apply it to the following code and got some errors</DIV>
<DIV> </DIV>
<DIV>The code I used is</DIV>
<DIV><FONT size=2><FONT color=#0000ff size=2>
<P>#include</FONT><FONT size=2> "vtkRenderer.h"</P></FONT><FONT color=#0000ff size=2>
<P>#include</FONT><FONT size=2> "vtkRenderWindow.h"</P></FONT><FONT color=#0000ff size=2>
<P>#include</FONT><FONT size=2> "vtkRenderWindowInteractor.h"</P></FONT><FONT color=#008000 size=2>
<P>//#include "vtkVolume16Reader.h"</P></FONT><FONT color=#0000ff size=2>
<P>#include</FONT><FONT size=2> "vtkMetaImageReader.h"</P></FONT><FONT color=#0000ff size=2>
<P>#include</FONT><FONT size=2> "vtkPolyDataMapper.h"</P></FONT><FONT color=#0000ff size=2>
<P>#include</FONT><FONT size=2> "vtkActor.h"</P></FONT><FONT color=#0000ff size=2>
<P>#include</FONT><FONT size=2> "vtkOutlineFilter.h"</P></FONT><FONT color=#0000ff size=2>
<P>#include</FONT><FONT size=2> "vtkCamera.h"</P></FONT><FONT color=#0000ff size=2>
<P>#include</FONT><FONT size=2> "vtkMarchingCubes.h"</P></FONT><FONT color=#0000ff size=2>
<P>void</FONT><FONT size=2> main( </FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> argc, </FONT><FONT color=#0000ff size=2>char</FONT><FONT size=2> *argv[] )</P>
<P>{</P>
<P></FONT><FONT color=#008000 size=2>// create the renderer stuff</P></FONT><FONT size=2>
<P>vtkRenderer *aRenderer = vtkRenderer::New();</P>
<P>vtkRenderWindow *renWin = vtkRenderWindow::New();</P>
<P>renWin->AddRenderer(aRenderer);</P>
<P>vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();</P>
<P>iren->SetRenderWindow(renWin);</P>
<P></FONT><FONT color=#008000 size=2>/*// read the volume</P>
<P>vtkVolume16Reader *v16 = vtkVolume16Reader::New();</P>
<P>v16->SetDataDimensions(64,64);</P>
<P>v16->SetDataByteOrderToLittleEndian();</P>
<P>v16->SetFilePrefix ("E:/Methods in Image Analysis/itk_vtk_fltk/VTK/headsq/quater");</P>
<P>v16->SetImageRange(1, 93);</P>
<P>v16->SetDataSpacing (3.2, 3.2, 1.5);*/</P>
<P>/** Meta Image Reader */</P></FONT><FONT size=2>
<P>vtkMetaImageReader *v16 = vtkMetaImageReader::New();</P>
<P>v16->SetFileName("Scapula_binary.mha");</P>
<P>v16->Update();</P>
<P></FONT><FONT color=#008000 size=2>// extract the skin</P></FONT><FONT size=2>
<P>vtkMarchingCubes *skinExtractor = vtkMarchingCubes::New();</P>
<P>skinExtractor->SetInput(v16->GetOutput());</P>
<P>skinExtractor->SetValue(0, 1);</P>
<P>vtkPolyDataMapper *skinMapper = vtkPolyDataMapper::New();</P>
<P>skinMapper->SetInput(skinExtractor->GetOutput());</P>
<P>skinMapper->ScalarVisibilityOff();</P>
<P>vtkActor *skin = vtkActor::New();</P>
<P>skin->SetMapper(skinMapper);</P>
<P></FONT><FONT color=#008000 size=2>// get an outline</P></FONT><FONT size=2>
<P>vtkOutlineFilter *outlineData = vtkOutlineFilter::New();</P>
<P>outlineData->SetInput((vtkDataSet *)v16->GetOutput());</P>
<P>vtkPolyDataMapper *mapOutline = vtkPolyDataMapper::New();</P>
<P>mapOutline->SetInput(outlineData->GetOutput());</P>
<P>vtkActor *outline = vtkActor::New();</P>
<P>outline->SetMapper(mapOutline);</P>
<P>outline->GetProperty()->SetColor(0,0,0);</P>
<P></FONT><FONT color=#008000 size=2>// create a camera with the correct view up</P></FONT><FONT size=2>
<P>vtkCamera *aCamera = vtkCamera::New();</P>
<P>aCamera->SetViewUp (0, 0, -1);</P>
<P>aCamera->SetPosition (0, 1, 0);</P>
<P>aCamera->SetFocalPoint (0, 0, 0);</P>
<P>aCamera->ComputeViewPlaneNormal();</P>
<P></FONT><FONT color=#008000 size=2>// now, tell the renderer our actors</P></FONT><FONT size=2>
<P>aRenderer->AddActor(outline);</P>
<P>aRenderer->AddActor(skin);</P>
<P>aRenderer->SetActiveCamera(aCamera);</P>
<P>aRenderer->ResetCamera ();</P>
<P>aCamera->Dolly(1.5);</P>
<P>aRenderer->SetBackground(1,1,1);</P>
<P>aRenderer->ResetCameraClippingRange();</P>
<P></P>
<P></FONT><FONT color=#008000 size=2>// interact with data</P></FONT><FONT size=2>
<P>renWin->SetSize( 300, 300);</P>
<P>renWin->Render();</P>
<P>iren->Start(); </P>
<P>}</P>
<P> </P>
<P></FONT>The errors I am getting are</P>
<P>e:\Methods in Image Analysis\Testing VTK code\Test Marching Cubes\TestMarchingCubes.cxx(51): </P>
<P>error C2027: use of undefined type 'vtkProperty'</P>
<P><BR>e:\Methods in Image Analysis\Testing VTK code\Test Marching Cubes\TestMarchingCubes.cxx(51):</P>
<P> error C2227: left of '->SetColor' must point to class/struct/union</P>
<P> </P>
<P>Can anyone please help me?</P>
<P> </P>
<P>Thanks</P>
<P>Gulshan<BR></P>
<P> </P>
<P> </P>
<P> </P>
<P> </P>
<P> </P></FONT></DIV>
<DIV> </DIV><p><font face=arial size=-1>Do you Yahoo!?<br>
<a href="http://us.rd.yahoo.com/mailtag_us/*http://mail.yahoo.com" target="_blank"><b>Yahoo! Mail</a></b> - More reliable, more storage, less spam