[vtkusers] help with marchingcubes with dicom slices set
kingvsk at aol.com
kingvsk at aol.com
Fri Nov 16 23:30:07 EST 2012
Hi
Change the value in following line.
surface->SetValue(0, 5);
Instead of 5 you can use 500 (Bone) or -500 (Skin).
That is, try either *surface->SetValue(0, 500);* or
*surface->SetValue(0, -500); *
--
Sathish
On Saturday 17 November 2012 02:46 AM, Rodrigo Lovera wrote:
>
> Hello everyone,
>
> I've got a set of dicom slices which I use for rendering a volume, now
> I tried to apply marching cubes to try surface rendering buy i'm only
> getting some kind of box and not the head that shold be forming.
>
> I'm using atm the following code
>
> vtkSmartPointer< vtkDICOMImageReader > reader =
> vtkSmartPointer< vtkDICOMImageReader >::New();
> reader->SetDataByteOrderToLittleEndian();
> //reader->SetDirectoryName(argv[1]);
> reader->SetDirectoryName("C:\\VTK5.10\\DATA\\DICOM");
> reader->SetDataSpacing(1, 1, 1);
> reader->SetDataOrigin(0.0, 0.0, 0.0);
> reader->Update();
>
> vtkSmartPointer< vtkMarchingCubes > surface =
> vtkSmartPointer< vtkMarchingCubes >::New();
> surface->SetInputConnection(reader->GetOutputPort());
> surface->ComputeNormalsOn();
> surface->SetValue(0, 5);
> vtkSmartPointer< vtkRenderer > surfacerenderer =
> vtkSmartPointer< vtkRenderer >::New();
> surfacerenderer->SetBackground(0.1, 0.2, 0.3);
>
> vtkSmartPointer< vtkRenderWindow > renderwin =
> vtkSmartPointer< vtkRenderWindow >::New();
> renderwin->AddRenderer(surfacerenderer);
> vtkSmartPointer< vtkRenderWindowInteractor > intersurf =
> vtkSmartPointer< vtkRenderWindowInteractor >::New();
> intersurf->SetRenderWindow(renderwin);
>
> vtkSmartPointer< vtkPolyDataNormals > premapper =
> vtkSmartPointer< vtkPolyDataNormals >::New();
> premapper->SetInputConnection(surface->GetOutputPort());
> premapper->ComputeCellNormalsOn();
> vtkSmartPointer< vtkPolyDataMapper > surfacemapper =
> vtkSmartPointer< vtkPolyDataMapper >::New();
> surfacemapper->SetInputConnection(premapper->GetOutputPort());
> //surfacemapper->SetInputConnection(surface->GetOutputPort());
>
> vtkSmartPointer< vtkActor > actor =
> vtkSmartPointer< vtkActor >::New();
> actor->SetMapper(surfacemapper);
>
> vtkSmartPointer< vtkProperty > backFaces =
> vtkSmartPointer< vtkProperty >::New();
> backFaces->SetSpecular(0.0);
> backFaces->SetDiffuse(0.0);
> backFaces->SetAmbient(1.0);
> backFaces->SetAmbientColor(1.0000, 0.3883, 0.2784);
> backFaces->SetOpacity(256);
>
> actor->SetBackfaceProperty(backFaces);
>
> surfacerenderer->AddActor(actor);
> renderwin->SetSize(800,600);
> //renderWindow->Render();
> intersurf->Start();
>
> this->ui->vtksurface->GetRenderWindow()->AddRenderer(surfacerenderer);
>
> I'd appreciate any kind of help, example code or advice. Thx in advance.
>
> --
> *Rodrigo Lovera *
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121117/c60ad29a/attachment.htm>
More information about the vtkusers
mailing list