[vtkusers] Segmentation for 3D ultrasound data set

Rodrigo Lovera lobo.theslayer at gmail.com
Thu Nov 29 11:57:07 EST 2012


Thx for your help, I got my code to work seems to be that my problem was
the setInvalue in vtkimagethreshold.


2012/11/29 shinaji <t_shinaji at chiba-u.jp>

> Hi,
>
> Take try vtkFixedPointVolumeRayCastMapper, it's better than
> vtkVolumeRayCastMapper.
> The vtkImageThresh worked  in the following code.
>
> See also
>
> http://vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/VolumeRendering/Cxx/FixedPointVolumeRayCastMapperCT.cxx
>
>
>         double opacityWindow = 4096;
>         double opacityLevel = 2048;
>         int clip = 0;
>         double frameRate = 10.0;
>
>         vtkSmartPointer< vtkDICOMImageReader > reader =
>                 vtkSmartPointer< vtkDICOMImageReader >::New();
>         reader->SetDataByteOrderToLittleEndian();
>         reader->SetDirectoryName("E:/DD2319/");
>         reader->Update();
>
>         vtkSmartPointer<vtkImageThreshold> thresh =
>                 vtkSmartPointer<vtkImageThreshold>::New();
>
>         thresh->SetInput(reader->GetOutput());
>         thresh->SetInValue(32768);
>         thresh->ThresholdBetween(0, 200);
>
>         vtkPiecewiseFunction* opacityFunction =
>                 vtkPiecewiseFunction::New();
>         vtkColorTransferFunction* colorTransferFunction =
>                 vtkColorTransferFunction::New();
>
>         vtkSmartPointer< vtkVolumeProperty > volumeProperty =
>                 vtkSmartPointer <vtkVolumeProperty >::New();
>         volumeProperty->SetColor(colorTransferFunction);
>         volumeProperty->SetScalarOpacity(opacityFunction);
>         volumeProperty->ShadeOn();
>         volumeProperty->SetInterpolationTypeToLinear();
>
>         vtkSmartPointer< vtkFixedPointVolumeRayCastMapper > volumeMapper =
>                 vtkSmartPointer< vtkFixedPointVolumeRayCastMapper >::New();
>         volumeMapper->SetInput(thresh->GetOutput());
>
>         vtkSmartPointer< vtkVolume > volume =
>                 vtkSmartPointer< vtkVolume >::New();
>         volume->SetMapper(volumeMapper);
>         volume->SetProperty(volumeProperty);
>
>
>         colorTransferFunction->AddRGBSegment(0.0, 1.0, 1.0, 1.0, 255.0,
> 1.0, 1.0,
> 1.0 );
>         opacityFunction->AddSegment( opacityLevel - 0.5*opacityWindow, 0.0,
>                 opacityLevel + 0.5*opacityWindow, 1.0 );
>         volumeMapper->SetBlendModeToComposite();
>         volumeProperty->ShadeOn();
>
>
>         vtkSmartPointer< vtkRenderer > renderer =
>                 vtkSmartPointer< vtkRenderer >::New();
>         renderer->AddVolume(volume);
>         renderer->ResetCamera();
>
>         vtkSmartPointer<vtkRenderWindow> renWin =
>                 vtkSmartPointer<vtkRenderWindow>::New();
>
>         // Add the volume to the scene
>         renderer->AddVolume( volume );
>         renderer->ResetCamera();
>         renWin->AddRenderer(renderer);
>
>         // Set the default window size
>         renWin->SetSize(600,600);
>         renWin->Render();
>
>         vtkSmartPointer<vtkRenderWindowInteractor> iren =
>                 vtkSmartPointer<vtkRenderWindowInteractor>::New();
>         iren->SetRenderWindow(renWin);
>         iren->SetDesiredUpdateRate(frameRate / (1+clip) );
>         iren->GetInteractorStyle()->SetDefaultRenderer(renderer);
>         iren->Start();
>
>         vtkSmartPointer<vtkWindowToImageFilter> windowToImageFilter =
>                 vtkSmartPointer<vtkWindowToImageFilter>::New();
>         windowToImageFilter->SetInput(renWin);
>         windowToImageFilter->SetInputBufferTypeToRGBA();
>         windowToImageFilter->Update();
>
> Shinaji
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Segmentation-for-3D-ultrasound-data-set-tp5717312p5717333.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
>



-- 
*Rodrigo aka WarHearT*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121129/b929ef5d/attachment.htm>


More information about the vtkusers mailing list