[vtkusers] How to Get rendered Volume Slices?

Italo Ribeiro italo.ribeiro at gmail.com
Sun Sep 19 06:16:09 EDT 2010


If i understand you want create 3D model of slice? Try this:

vtkDICOMImageReader *reader = vtkDICOMImageReader::New();
    reader->SetDirectoryName("C:/cranio");
    reader->Update();

 vtkContourFilter *skinExtractor = vtkContourFilter::New();
  skinExtractor->SetInputConnection(reader->GetOutputPort());
  skinExtractor->SetValue(0, 500); //skin human

  vtkPolyDataNormals *skinNormals = vtkPolyDataNormals::New();
  skinNormals->SetInputConnection(skinExtractor->GetOutputPort());
  skinNormals->SetFeatureAngle(60.0);

  vtkStripper *skinStripper = vtkStripper::New();
  skinStripper->SetInputConnection(skinNormals->GetOutputPort());

  vtkPolyDataMapper *skinMapper = vtkPolyDataMapper::New();
  skinMapper->SetInputConnection(skinStripper->GetOutputPort());
  skinMapper->ScalarVisibilityOff();

  vtkActor *skin = vtkActor::New();
  skin->SetMapper(skinMapper);

vtkRenderer *renderer2 = vtkRenderer::New();
    renderer2->SetViewport(0.5, 0.0, 1.0, 0.5);
    renderer2->SetBackground(0.0, 0.0, 0.0);
    renderWindow->AddRenderer(renderer2);

  renderer2->AddActor(skin);

bye.

2010/9/19 陆阳 <thuluyang at gmail.com>

> i have the exatly desire as finsher has...
> i am waiting for the answeer to...
> best regards
>
> 2010/9/19 finsher <zhuyinghua01 at gmail.com>
>
>
>> Hi all,
>> I need to get the Maximum intensity projection(MIP) slices.
>> so I have a series of MR images.  I use these series to do MIP(or volume
>> render etc...).  when MIP rendering completed  I need to get the rendered
>> slices. if i use vtkResliceImage dor  imageplanewidget s the input data is
>> the voxel raw data, i got the  slices is the original image slices, not
>> cut
>> from MIP volume slices.
>> so could you help me how to get the correct slices?
>>
>> best regards.
>>
>> and below is my code :
>>
>> //step 1: read raw image series data
>> vtkVolume16Reader* v16 =  vtkVolume16Reader::New();
>> v16->SetFilePrefix("d:\\aaa\\new\\a");
>> ...
>> v16->Update();
>>
>> //step.2: do MIP
>> vtkPiecewiseFunction *opacityTransferFunc = vtkPiecewiseFunction::New();
>> opacityTransferFunc->AddPoint(0.0, 0.0);
>> ...
>> vtkColorTransferFunction *colorTransferFunc =
>> vtkColorTransferFunction::New();
>> colorTransferFunc->AddRGBPoint(0.0, 0.0, 0.0, 0.0);
>> ...
>> volumeProperty = vtkVolumeProperty::New();
>> volumeProperty->SetColor(colorTransferFunc);
>> volumeProperty->SetScalarOpacity(opacityTransferFunc);
>>
>> //step 3: set mip function and create volume data
>> vtkVolumeRayCastMIPFunction *mipFunc = vtkVolumeRayCastMIPFunction::New();
>> volumeMapper = vtkVolumeRayCastMapper::New();
>> volumeMapper->SetVolumeRayCastFunction(mipFunc);
>> volumeMapper->SetInput(v16->GetOutput());
>> volume = vtkVolume::New();
>> volume->SetMapper(volumeMapper);
>> volume->SetProperty(volumeProperty);
>> volume->Update();
>>
>> //step.4: renderer volume show rendered window
>> render->AddVolume(volume);
>> renderWindow->Render();
>> ...
>>
>> //setp.5: get MIP slices
>> vtkImagePlaneWidget* planeWidget = vtkImagePlaneWidget::New();
>> ...
>> planeWidget->SetInput(v16->GetOutput()); <----i think this input data
>> could
>> not be correct. but i don't know how ...
>>
>> //step.6 display the slices
>> imageViewer2->SetInput(planeWidget->GetResliceOutput());
>> renderWindowInteractor->Initialize();
>> imageViewer2->Render();
>> renderWindowInteractor->Start();
>> ....
>> --
>> View this message in context:
>> http://vtk.1045678.n5.nabble.com/How-to-Get-rendered-Volume-Slices-tp2845243p2845243.html
>> Sent from the VTK - Users mailing list archive at Nabble.com.
>> _______________________________________________
>> 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
>>
>
>
>
> --
> 陆阳
> 清华大学医学院生物医学工程系
> Yang Lu
> Department of Biomedical Engineering,
> School of Medicine, Tsinghua University
>
>
> _______________________________________________
> 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
>
>


-- 
Ítalo Mendes
ogre.irados.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100919/39ec92c4/attachment.htm>


More information about the vtkusers mailing list