[vtkusers] vtkDICOMImageReader -> vtkCutter -> vtkMarchingCubes
David Doria
daviddoria+vtk at gmail.com
Thu Dec 24 07:38:28 EST 2009
On Thu, Dec 24, 2009 at 7:11 AM, Jinyoung Hwang <hwangjinyoung at gmail.com> wrote:
> Hi Jothy,
>
> My answer is definitely yes.
> vtkPlane::SetOrigion(sagittal, coronal, axial)
>
> vtkCutter::SetValue(x,dist)
> as explained in textbook (vtk user's guide),
> x is default 0, and distance means the distance of implicit function.
> (you may refer to
> http://www.vtk.org/doc/release/4.0/html/classvtkCutter.html)
> Jinyoung
>
>
> 2009/12/24 KS Jothybasu <jothybasu at gmail.com>
>>
>> Thanks!
>>
>> Does the SetOrigin(100,0,0) mean a sagitall cut or cut in the X-plane at
>> 100th pixel and what does SetValue(0, 0.5) mean?
>>
>> Many thanks again
>>
>> Jothy
>>
>> On Thu, Dec 24, 2009 at 3:50 AM, Jinyoung Hwang <hwangjinyoung at gmail.com>
>> wrote:
>>>
>>> Hello,
>>>
>>> I made an example you want, but it may not be.
>>> If not, repost again, then other will help you.
>>>
>>> Jinyoung
>>>
>>>
>>> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>> // data load
>>> vtkSmartPointer<vtkStructuredPointsReader> reader =
>>> vtkSmartPointer<vtkStructuredPointsReader>::New();
>>> reader->SetFileName("test.vtk");
>>> reader->Update();
>>> // MC is used to display in 3D
>>> vtkSmartPointer<vtkMarchingCubes> cubes =
>>> vtkSmartPointer<vtkMarchingCubes>::New();
>>> cubes->SetInputConnection(reader->GetOutputPort());
>>> cubes->ComputeNormalsOn();
>>> cubes->ComputeGradientsOn();
>>> cubes->SetValue(0, 20);
>>> cubes->Update();
>>> // create a plane, and specify it
>>> vtkSmartPointer<vtkPlane> plane = vtkSmartPointer<vtkPlane>::New();
>>> plane->SetOrigin(100,0,0);
>>> plane->SetNormal(1,0,0);
>>> // create a cutter
>>> vtkSmartPointer<vtkCutter> cutter = vtkSmartPointer<vtkCutter>::New();
>>> cutter->SetInputConnection(cubes->GetOutputPort());
>>> cutter->SetCutFunction(plane);
>>> cutter->GenerateCutScalarsOn();
>>> cutter->SetValue(0, 0.5);
>>> // create a mapper
>>> vtkSmartPointer<vtkPolyDataMapper> mapper =
>>> vtkSmartPointer<vtkPolyDataMapper>::New();
>>> mapper->SetInputConnection(cutter->GetOutputPort());
>>> mapper->ScalarVisibilityOn();
>>> mapper->Update();
>>>
>>> _______________________________________________
>>> 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
>>>
>>
>
>
> _______________________________________________
> 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
>
>
Jinyoung,
Would you mind uploading test.vtk that we can use to demonstrate this?
Also, do you have a complete compilable example (with includes, etc)?
Or should I create it from what you sent?
Thanks,
David
More information about the vtkusers
mailing list