<div>One of the options to visualize your 3d data is to use volume representation</div> <div>Here I show you some code that use VTK for the visualisation.</div> <div>VTK has several options for composite (means you use color) volume visualisation:</div> <div>-vtkVolumeTextureMapper2D</div> <div>-vtkVolumeTextureMapper3D</div> <div>-vtkVolumeRayCastMapper</div> <div>-vtkVolumeProMapper</div> <div> </div> <div>The c++ partial code,you still need to create additional classes like vtkRenderer ,vtkRenderWindow,,vtkRenderWindowInterator also you have to copy the files itkImageToVTKImageFilter.txx and .h in your project:</div> <div> </div> <div> #include "vtkVolumeProperty.h"<BR> #include "vtkPiecewiseFunction.h"<BR> #include "vtkVolume.h"<BR> #include "vtkColorTransferFunction.h"<BR> #include "itkImageToVTKImageFilter.h"</div> <div> #include "vtkVolumeTextureMapper2D.h"</div> <div> </div> <div> /*Pass the data
to vtk from a itk class ( file_reader in this example)*/</div> <div> </div> <div> typedef itk::ImageToVTKImageFilter< ImageType > ConnectorFilterType;<BR> ConnectorFilterType::Pointer connector = ConnectorFilterType::New();<BR> connector->GetExporter()->SetInput( file_reader->GetOutput() );<BR> connector->GetImporter()->Update();<BR> connector->Update();<BR></div> <DIV id=RTEContent> <DIV id=RTEContent> <DIV> /*Select the volume method*/</DIV> <DIV> </DIV> <DIV> vtkVolumeTextureMapper2D* VolumeMapper = vtkVolumeTextureMapper2D::New();<BR> VolumeMapper->SetInput(Reader->GetOutput());</DIV> <DIV> </DIV> <DIV>/*Define the functions that will map your density values fromm your data to color and opacity i.e all the voxels with value 0 will have color 0,0,0 or black*/</DIV> <DIV> </DIV>
<DIV> vtkPiecewiseFunction* OpacityTransferFunction=vtkPiecewiseFunction::New();<BR> vtkColorTransferFunction* ColorTransferFunction=vtkColorTransferFunction::New();<BR></DIV> <DIV> OpacityTransferFunction->AddPoint(0, 0.0);<BR><BR> OpacityTransferFunction->AddPoint(2048, 0.1);<BR> OpacityTransferFunction->AddPoint(2048+1, 0.0);</DIV> <DIV> ColorTransferFunction->AddRGBPoint(0 0.0, 0.0, 0.0);<BR> ColorTransferFunction->AddRGBPoint(2048/4, 1, 0, 0);<BR> ColorTransferFunction->AddRGBPoint(2048/2, 0, 0, 1);<BR> ColorTransferFunction->AddRGBPoint(2048/4*3, 0, 1, 0);<BR> ColorTransferFunction->AddRGBPoint(2048, 1, 1, 1);</DIV> <DIV> </DIV> <DIV> vtkVolumeProperty* VolumeProperty = vtkVolumeProperty::New();<BR> VolumeProperty->SetColor(ColorTransferFunction);<BR> VolumeProperty->SetScalarOpacity(OpacityTransferFunction);</DIV> <DIV> vtkVolume* VolumeActor =
vtkVolume::New();<BR> VolumeActor->SetMapper(VolumeMapper);<BR> VolumeActor->SetProperty(VolumeProperty);<BR><BR></DIV> <DIV>Or better in your case you can use Surface Representation instead of Volume.This is much suited for binary data visualization</DIV> <DIV> </DIV> <DIV>Here is the c++ partial code:</DIV> <DIV> </DIV> <DIV> vtkImageMarchingCubes * marcher = vtkImageMarchingCubes::New();<BR> marcher->SetInput(image);<BR> marcher->SetValue(1,1.0);//Here 1.0 represent the voxel value of your binary data<BR> marcher->Update();</DIV> <DIV> </DIV> <DIV> vtkSmoothPolyDataFilter* smoother = vtkSmoothPolyDataFilter::New();<BR> smoother->SetInput(marcher->GetOutput());<BR> smoother->SetNumberOfIterations(5);<BR> smoother->SetFeatureAngle(60);<BR>
smoother->SetRelaxationFactor(0.05);<BR> smoother->FeatureEdgeSmoothingOff();<BR> std::cout << "VTK Smoothing mesh finished...." << std::endl;</DIV> <DIV> </DIV> <DIV> // render 3D model<BR> vtkPolyDataMapper* isoMapper = vtkPolyDataMapper::New();<BR> isoMapper->SetInput(smoother->GetOutput());<BR> isoMapper->ScalarVisibilityOn();</DIV> <DIV> </DIV> <DIV> vtkActor * SurfaceExtractor = vtkActor::New();<BR> SurfaceExtractor->SetMapper(isoMapper);<BR> SurfaceExtractor->GetProperty()->SetDiffuseColor(1,1,0.9412);<BR></DIV> <DIV> </DIV> <DIV>Teo</DIV> <DIV><B><I>ilker hacıhaliloğlu <hacihaliloglu@gmail.com></I></B> wrote:</DIV> <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">hi all<BR>i have segmented a 3D image now i wantto visualize it what can i use
?<BR><BR>ilker<BR>_______________________________________________<BR>Insight-users mailing list<BR>Insight-users@itk.org<BR>http://www.itk.org/mailman/listinfo/insight-users<BR></BLOCKQUOTE> <DIV><BR></DIV></DIV></DIV><p>
                <hr size=1> <a href="http://us.lrd.yahoo.com/_ylc=X3oDMTFqODRtdXQ4BF9TAzMyOTc1MDIEX3MDOTY2ODgxNjkEcG9zAzEEc2VjA21haWwtZm9vdGVyBHNsawNmYw--/SIG=110oav78o/**http%3a//farechase.yahoo.com/">Yahoo! FareChase - Search multiple travel sites in one click.</a>