<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Hi Amy <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></DIV>
<DIV><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Thank you for your help. vtkFixedPointVolumeRayCastMapper is well working. Also I have tried keeping vtkVolumeRayCastMapper with the use of vtkImageShiftScale filter but I het the folloing error&nbsp;regarding the statment&nbsp;: shifter-&gt;SetInput(vtkImporter-&gt;GetOutput());<o:p></o:p></SPAN></DIV>
<DIV><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;<o:p></o:p></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">1&gt;..\test_itk.cxx(129) : error C2664: 'void vtkImageAlgorithm::SetInput(vtkDataObject *)' : cannot convert parameter 1 from 'vtkImageData *' to 'vtkDataObject *'<o:p></o:p></SPAN></DIV>
<DIV><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;</SPAN></DIV><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">
<DIV><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Please&nbsp;do you know how to resolve this problem. I'm not expert; I’m just doing my first steps&nbsp;in vtk and itk. <o:p></o:p></SPAN></DIV>
<DIV><SPAN lang=FR style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: FR">Thank you<o:p></o:p></SPAN></DIV>
<DIV><SPAN lang=FR style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: FR">&nbsp;<o:p></o:p></SPAN></DIV>
<DIV><SPAN lang=FR style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: FR">&nbsp;<o:p></o:p></SPAN></DIV>
<DIV><SPAN lang=FR style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: FR">Sara<o:p></o:p></SPAN></DIV><o:p></o:p></SPAN>
<DIV><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN>&nbsp;</DIV>
<DIV><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">this this the&nbsp;modified code :<o:p></o:p></SPAN></DIV>
<DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></DIV><FONT color=#008000 size=2>
<DIV>// The following example illustrates the use of the ConfidenceConnectedImageFilter. The criterion used by the</DIV>
<DIV>// ConfidenceConnectedImageFilter is based on simple statistics of the current region. </DIV>
<DIV>// 3D</DIV>
<DIV>// The following example illustrates the use of the ConfidenceConnectedImageFilter. The criterion used by the</DIV>
<DIV>// ConfidenceConnectedImageFilter is based on simple statistics of the current region. </DIV>
<DIV>// 3D</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"itkConfidenceConnectedImageFilter.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"itkImage.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"itkCastImageFilter.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"itkCurvatureFlowImageFilter.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"itkImageFileReader.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"itkImageFileWriter.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"itkVTKImageExport.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"itkVTKImageImport.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"vtkImageImport.h"</FONT><FONT size=2> </DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"vtkImageExport.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"vtkImageReader.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"vtkPiecewiseFunction.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"vtkVolumeProperty.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"vtkVolumeRayCastMapper.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"vtkVolumeTextureMapper3D.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"vtkFixedPointVolumeRayCastMapper.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"vtkVolumeRayCastCompositeFunction.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"vtkVolume.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"vtkRenderer.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"vtkRenderWindow.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"vtkRenderWindowInteractor.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"vtkImageShiftScale.h"</DIV></FONT><FONT color=#0000ff size=2>
<DIV>#include</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>"vtkFixedPointVolumeRayCastMapper.h"</DIV></FONT><FONT color=#008000 size=2>
<DIV>// This function will connect the given itk::VTKImageExport filter to the given vtkImageImport filter.</DIV></FONT><FONT color=#0000ff size=2>
<DIV>template</FONT><FONT size=2> &lt;</FONT><FONT color=#0000ff size=2>typename</FONT><FONT size=2> ITK_Exporter, </FONT><FONT color=#0000ff size=2>typename</FONT><FONT size=2> VTK_Importer&gt;</DIV></FONT><FONT color=#0000ff size=2>
<DIV>void</FONT><FONT size=2> ConnectPipelines(ITK_Exporter exporter, VTK_Importer* importer)</DIV>
<DIV>{</DIV>
<DIV>importer-&gt;SetUpdateInformationCallback(exporter-&gt;GetUpdateInformationCallback());</DIV>
<DIV>importer-&gt;SetPipelineModifiedCallback(exporter-&gt;GetPipelineModifiedCallback());</DIV>
<DIV>importer-&gt;SetWholeExtentCallback(exporter-&gt;GetWholeExtentCallback());</DIV>
<DIV>importer-&gt;SetSpacingCallback(exporter-&gt;GetSpacingCallback());</DIV>
<DIV>importer-&gt;SetOriginCallback(exporter-&gt;GetOriginCallback());</DIV>
<DIV>importer-&gt;SetScalarTypeCallback(exporter-&gt;GetScalarTypeCallback());</DIV>
<DIV>importer-&gt;SetNumberOfComponentsCallback(exporter-&gt;GetNumberOfComponentsCallback());</DIV>
<DIV>importer-&gt;SetPropagateUpdateExtentCallback(exporter-&gt;GetPropagateUpdateExtentCallback());</DIV>
<DIV>importer-&gt;SetUpdateDataCallback(exporter-&gt;GetUpdateDataCallback());</DIV>
<DIV>importer-&gt;SetDataExtentCallback(exporter-&gt;GetDataExtentCallback());</DIV>
<DIV>importer-&gt;SetBufferPointerCallback(exporter-&gt;GetBufferPointerCallback());</DIV>
<DIV>importer-&gt;SetCallbackUserData(exporter-&gt;GetCallbackUserData());</DIV>
<DIV>}</DIV></FONT><FONT color=#0000ff size=2>
<DIV>int</FONT><FONT size=2> main( )</DIV>
<DIV>{</DIV>
<DIV></FONT><FONT color=#008000 size=2>//typedef unsigned short InputPixelType;</DIV></FONT><FONT size=2>
<DIV></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>float</FONT><FONT size=2> InputPixelType;</DIV>
<DIV></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>char</FONT><FONT size=2> OutputPixelType;</DIV>
<DIV></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> Dimension = 3;</DIV>
<DIV></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::Image&lt; InputPixelType, Dimension &gt; InputImageType;</DIV>
<DIV></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::Image&lt; OutputPixelType, Dimension &gt; OutputImageType;</DIV>
<DIV></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::CastImageFilter&lt; InputImageType, OutputImageType &gt; CastingFilterType;</DIV>
<DIV></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::ImageFileReader&lt; InputImageType &gt; ReaderType;</DIV>
<DIV></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::ImageFileWriter&lt; OutputImageType &gt; WriterType;</DIV>
<DIV></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::CurvatureFlowImageFilter&lt; InputImageType, InputImageType &gt; CurvatureFlowImageFilterType; </DIV>
<DIV></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::ConfidenceConnectedImageFilter&lt;InputImageType, InputImageType&gt; ConnectedFilterType;</DIV>
<DIV>CastingFilterType::Pointer caster = CastingFilterType::New(); </DIV>
<DIV>ReaderType::Pointer reader = ReaderType::New();</DIV>
<DIV>WriterType::Pointer writer = WriterType::New();</DIV>
<DIV>CurvatureFlowImageFilterType::Pointer smoothing = CurvatureFlowImageFilterType::New(); </DIV>
<DIV>ConnectedFilterType::Pointer confidenceConnected = ConnectedFilterType::New();</DIV>
<DIV></DIV>
<DIV>reader-&gt;SetFileName( </FONT><FONT color=#a31515 size=2>"c:/images/3DImages/Patient01.mhd"</FONT><FONT size=2> );</DIV>
<DIV>writer-&gt;SetFileName( </FONT><FONT color=#a31515 size=2>"c:/images/3DConfidenceConnectedSegmImg.mhd"</FONT><FONT size=2> );</DIV>
<DIV>smoothing-&gt;SetInput( reader-&gt;GetOutput() );</DIV>
<DIV>confidenceConnected-&gt;SetInput( smoothing-&gt;GetOutput() );</DIV>
<DIV>caster-&gt;SetInput( confidenceConnected-&gt;GetOutput() );</DIV>
<DIV>writer-&gt;SetInput( caster-&gt;GetOutput() );</DIV>
<DIV></DIV>
<DIV>smoothing-&gt;SetNumberOfIterations( 5 );</DIV>
<DIV>smoothing-&gt;SetTimeStep( 0.125 );</DIV>
<DIV></DIV>
<DIV>confidenceConnected-&gt;SetMultiplier( 2.5 ); </DIV>
<DIV>confidenceConnected-&gt;SetNumberOfIterations( 5);</DIV>
<DIV>confidenceConnected-&gt;SetReplaceValue( 255 ); </DIV>
<DIV>InputImageType::IndexType index; </DIV>
<DIV>index[0] = atoi( </FONT><FONT color=#a31515 size=2>"256"</FONT><FONT size=2> );</DIV>
<DIV>index[1] = atoi( </FONT><FONT color=#a31515 size=2>"256"</FONT><FONT size=2> );</DIV>
<DIV>index[2] = atoi( </FONT><FONT color=#a31515 size=2>"16"</FONT><FONT size=2> );</DIV>
<DIV>confidenceConnected-&gt;SetSeed( index ); </DIV>
<DIV>confidenceConnected-&gt;SetInitialNeighborhoodRadius( 2 );</DIV>
<DIV></FONT><FONT color=#0000ff size=2>try</DIV></FONT><FONT size=2>
<DIV>{</DIV>
<DIV>writer-&gt;Update();</DIV>
<DIV>}</DIV>
<DIV></FONT><FONT color=#0000ff size=2>catch</FONT><FONT size=2>( itk::ExceptionObject &amp; excep )</DIV>
<DIV>{</DIV>
<DIV>std::cerr &lt;&lt; </FONT><FONT color=#a31515 size=2>"Exception caught !"</FONT><FONT size=2> &lt;&lt; std::endl;</DIV>
<DIV>std::cerr &lt;&lt; excep &lt;&lt; std::endl;</DIV>
<DIV>}</DIV>
<DIV></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::VTKImageExport&lt; InputImageType &gt; ExportFilterType;</DIV>
<DIV>ExportFilterType::Pointer itkExporter = ExportFilterType::New(); </DIV>
<DIV>itkExporter-&gt;SetInput(reader-&gt;GetOutput()); </DIV>
<DIV></FONT><FONT color=#008000 size=2>// Create the vtkImageImport and connect it to the itk::VTKImageExport instance.</DIV></FONT><FONT size=2>
<DIV>vtkImageImport* vtkImporter = vtkImageImport::New(); </DIV>
<DIV>ConnectPipelines(itkExporter, vtkImporter);</DIV>
<DIV></DIV>
<DIV>vtkImageShiftScale* shifter = vtkImageShiftScale::New();</DIV>
<DIV>shifter-&gt;SetInput(vtkImporter-&gt;GetOutput());</DIV>
<DIV></FONT><FONT color=#008000 size=2>//shifter-&gt;SetScale(256);</DIV></FONT><FONT size=2>
<DIV>shifter-&gt;SetOutputScalarTypeToUnsignedChar();</DIV>
<DIV></DIV>
<DIV></FONT><FONT color=#008000 size=2>// Define opacity transfer function</DIV></FONT><FONT size=2>
<DIV>vtkPiecewiseFunction *opacityTransferFunction = vtkPiecewiseFunction::New();</DIV>
<DIV>vtkVolume *volume = vtkVolume::New();</DIV>
<DIV>vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();</DIV>
<DIV>vtkVolumeRayCastMapper *VolumeMapper = vtkVolumeRayCastMapper::New();</DIV>
<DIV>vtkVolumeRayCastCompositeFunction *RayCastFunction =vtkVolumeRayCastCompositeFunction::New();</DIV>
<DIV></DIV>
<DIV></FONT><FONT color=#008000 size=2>// Volume property </DIV></FONT><FONT size=2>
<DIV>opacityTransferFunction-&gt;AddPoint(0,0.001);</DIV>
<DIV>opacityTransferFunction-&gt;AddPoint(255,0.2);</DIV>
<DIV>volumeProperty-&gt;SetScalarOpacity(opacityTransferFunction);</DIV>
<DIV>volumeProperty-&gt;SetInterpolationTypeToLinear();</DIV>
<DIV>volumeProperty-&gt;ShadeOff();</DIV>
<DIV></DIV>
<DIV></FONT><FONT color=#008000 size=2>// Volume mapper</DIV></FONT><FONT size=2>
<DIV>VolumeMapper-&gt;SetVolumeRayCastFunction(RayCastFunction);</DIV>
<DIV>VolumeMapper-&gt;SetSampleDistance(1.0);</DIV>
<DIV>VolumeMapper-&gt;SetBlendModeToMaximumIntensity();</DIV>
<DIV></FONT><FONT color=#008000 size=2>//VolumeMapper-&gt;SetInput(vtkImporter-&gt;GetOutput() ); </DIV></FONT><FONT size=2>
<DIV>VolumeMapper-&gt;SetInput(shifter-&gt;GetOutput() ); </DIV>
<DIV></DIV>
<DIV></FONT><FONT color=#008000 size=2>// The volume </DIV></FONT><FONT size=2>
<DIV>volume-&gt;SetMapper(VolumeMapper);</DIV>
<DIV>volume-&gt;SetProperty(volumeProperty);</DIV>
<DIV></DIV>
<DIV></FONT><FONT color=#008000 size=2>// Create a renderer, render window, and render window interactor to display the results.</DIV></FONT><FONT size=2>
<DIV>vtkRenderer *Renderer = vtkRenderer::New();</DIV>
<DIV>vtkRenderWindow *RenWin = vtkRenderWindow::New();</DIV>
<DIV>vtkRenderWindowInteractor *RenWinInterc = vtkRenderWindowInteractor::New();</DIV>
<DIV>RenWin-&gt;AddRenderer(Renderer);</DIV>
<DIV>RenWinInterc-&gt;SetRenderWindow(RenWin);</DIV>
<DIV></FONT><FONT color=#008000 size=2>//Renderer-&gt;AddActor(volume);</DIV></FONT><FONT size=2>
<DIV>Renderer-&gt;AddVolume(volume);</DIV>
<DIV>Renderer-&gt;SetBackground(1,1,1);</DIV>
<DIV>RenWin-&gt;Render();</DIV>
<DIV>RenWinInterc-&gt;Initialize();</DIV>
<DIV>RenWinInterc-&gt;Start();</DIV>
<DIV></FONT><FONT color=#008000 size=2>// Release all VTK components</DIV></FONT><FONT size=2>
<DIV>RenWinInterc-&gt;Delete();</DIV>
<DIV>RenWin-&gt;Delete(); </DIV>
<DIV>Renderer-&gt;Delete();</DIV>
<DIV>volume-&gt;Delete();</DIV>
<DIV>VolumeMapper-&gt;Delete();</DIV>
<DIV>volumeProperty-&gt;Delete();</DIV>
<DIV>opacityTransferFunction-&gt;Delete();</DIV>
<DIV>std::cout &lt;&lt; </FONT><FONT color=#a31515 size=2>"Code end !"</FONT><FONT size=2> &lt;&lt; std::endl;</DIV>
<DIV>std::cin.get();</DIV>
<DIV></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> 0;</DIV>
<DIV>}</DIV></FONT>
<DIV>
<DIV><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN>&nbsp;</DIV>
<DIV><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN>&nbsp;</DIV>
<DIV>
<DIV><SPAN lang=FR style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; mso-ansi-language: FR"><o:p></o:p></SPAN></DIV><BR><BR><BR>--- En date de&nbsp;: <B>Mar 19.8.08, Amy Squillacote <I>&lt;ahs@cfdrc.com&gt;</I></B> a Ã©crit&nbsp;:<BR></DIV></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid">De: Amy Squillacote &lt;ahs@cfdrc.com&gt;<BR>Objet: Re: [vtkusers] Problem with vtk RayCasting: volume to be of pixel type unsigned char or unsigned short<BR>À: sara_meghellati@yahoo.fr<BR>Cc: vtkusers@vtk.org<BR>Date: Mardi 19 Août 2008, 15h21<BR><BR><PRE>Hi Sara,

The vtkFixedPointVolumeRayCastMapper can handle float data, so try using 
it instead of vtkVolumeRayCastMapper. If for some reason you need to use 
vtkVolumeRayCastMapper, you should pass your vtkImageData through a 
vtkImageShiftScale filter to convert it to unsigned char or unsigned 
short, and then pass the output of that filter to the mapper.

- Amy

sara meghellati wrote:
&gt;  
&gt; Hi all,
&gt; I have segmented 3D image using region growing method (using itk) and 
&gt; I want to display the original volume(float type) using vtk. I got an 
&gt; error at run time stating that vtk raycasting requires the volume to 
&gt; be of pixel type unsigned char or unsigned short. I'm converting the 
&gt; vtkimport that I use to unsigned char using the function 
&gt; SetDataScalarTypeToChar() but I still get the error.  The code is bellow.
&gt; Any help is very appreciated.
&gt; Thank you for  your time
&gt; Sara
&gt;  
&gt;  
&gt; #include "itkConfidenceConnectedImageFilter.h"
&gt; #include "itkImage.h"
&gt; #include "itkCastImageFilter.h"
&gt; #include "itkCurvatureFlowImageFilter.h"
&gt; #include "itkImageFileReader.h"
&gt; #include "itkImageFileWriter.h"
&gt; #include "itkVTKImageExport.h"
&gt; #include "itkVTKImageImport.h"
&gt; #include "vtkImageImport.h"
&gt; #include "vtkImageExport.h"
&gt; #include "vtkImageReader.h"
&gt; #include "vtkPiecewiseFunction.h"
&gt; #include "vtkVolumeProperty.h"
&gt; #include "vtkVolumeRayCastMapper.h"
&gt; #include "vtkVolumeTextureMapper3D.h"
&gt; #include "vtkFixedPointVolumeRayCastMapper.h"
&gt; #include "vtkVolumeRayCastCompositeFunction.h"
&gt; #include "vtkVolume.h"
&gt; #include "vtkRenderer.h"
&gt; #include "vtkRenderWindow.h"
&gt; #include "vtkRenderWindowInteractor.h"
&gt; // This function will connect the given itk::VTKImageExport filter to 
&gt; the given vtkImageImport filter.
&gt; template &lt;typename ITK_Exporter, typename VTK_Importer&gt;
&gt; void ConnectPipelines(ITK_Exporter exporter, VTK_Importer* importer)
&gt; {
&gt;
importer-&gt;SetUpdateInformationCallback(exporter-&gt;GetUpdateInformationCallback());
&gt;
importer-&gt;SetPipelineModifiedCallback(exporter-&gt;GetPipelineModifiedCallback());
&gt;
importer-&gt;SetWholeExtentCallback(exporter-&gt;GetWholeExtentCallback());
&gt; importer-&gt;SetSpacingCallback(exporter-&gt;GetSpacingCallback());
&gt; importer-&gt;SetOriginCallback(exporter-&gt;GetOriginCallback());
&gt; importer-&gt;SetScalarTypeCallback(exporter-&gt;GetScalarTypeCallback());
&gt;
importer-&gt;SetNumberOfComponentsCallback(exporter-&gt;GetNumberOfComponentsCallback());
&gt;
importer-&gt;SetPropagateUpdateExtentCallback(exporter-&gt;GetPropagateUpdateExtentCallback());
&gt; importer-&gt;SetUpdateDataCallback(exporter-&gt;GetUpdateDataCallback());
&gt; importer-&gt;SetDataExtentCallback(exporter-&gt;GetDataExtentCallback());
&gt;
importer-&gt;SetBufferPointerCallback(exporter-&gt;GetBufferPointerCallback());
&gt; importer-&gt;SetCallbackUserData(exporter-&gt;GetCallbackUserData());
&gt; }
&gt; int main( )
&gt; {
&gt; //typedef unsigned short InputPixelType;
&gt; typedef float InputPixelType;
&gt; typedef unsigned char OutputPixelType;
&gt; const unsigned int Dimension = 3;
&gt; typedef itk::Image&lt; InputPixelType, Dimension &gt; InputImageType;
&gt; typedef itk::Image&lt; OutputPixelType, Dimension &gt; OutputImageType;
&gt; typedef itk::CastImageFilter&lt; InputImageType, OutputImageType &gt; 
&gt; CastingFilterType;
&gt; typedef itk::ImageFileReader&lt; InputImageType &gt; ReaderType;
&gt; typedef itk::ImageFileWriter&lt; OutputImageType &gt; WriterType;
&gt; typedef itk::CurvatureFlowImageFilter&lt; InputImageType, InputImageType 
&gt; &gt; CurvatureFlowImageFilterType;
&gt; typedef itk::ConfidenceConnectedImageFilter&lt;InputImageType, 
&gt; InputImageType&gt; ConnectedFilterType;
&gt; CastingFilterType::Pointer caster = CastingFilterType::New();
&gt; ReaderType::Pointer reader = ReaderType::New();
&gt; WriterType::Pointer writer = WriterType::New();
&gt; CurvatureFlowImageFilterType::Pointer smoothing = 
&gt; CurvatureFlowImageFilterType::New();
&gt; ConnectedFilterType::Pointer confidenceConnected = 
&gt; ConnectedFilterType::New();
&gt; reader-&gt;SetFileName( "c:/images/Patient01.mhd" );
&gt; writer-&gt;SetFileName(
"c:/images/3DConfidenceConnectedSegmImg.mhd" );
&gt; smoothing-&gt;SetInput( reader-&gt;GetOutput() );
&gt; confidenceConnected-&gt;SetInput( smoothing-&gt;GetOutput() );
&gt; caster-&gt;SetInput( confidenceConnected-&gt;GetOutput() );
&gt; writer-&gt;SetInput( caster-&gt;GetOutput() );
&gt; smoothing-&gt;SetNumberOfIterations( 5 );
&gt; smoothing-&gt;SetTimeStep( 0.125 );
&gt; confidenceConnected-&gt;SetMultiplier( 2.5 );
&gt; confidenceConnected-&gt;SetNumberOfIterations( 2 );
&gt; confidenceConnected-&gt;SetReplaceValue( 255 );
&gt; InputImageType::IndexType index;
&gt; index[0] = atoi( "256" );
&gt; index[1] = atoi( "256" );
&gt; index[2] = atoi( "16" );
&gt; confidenceConnected-&gt;SetSeed( index );
&gt; confidenceConnected-&gt;SetInitialNeighborhoodRadius( 2 );
&gt; try
&gt; {
&gt; writer-&gt;Update();
&gt; }
&gt; catch( itk::ExceptionObject &amp; excep )
&gt; {
&gt; std::cerr &lt;&lt; "Exception caught !" &lt;&lt; std::endl;
&gt; std::cerr &lt;&lt; excep &lt;&lt; std::endl;
&gt; }
&gt; //----------------------------------------------
&gt; // -------------------- vtk Display----------------
&gt; //----------------------------------------------
&gt; typedef itk::VTKImageExport&lt; InputImageType &gt; ExportFilterType;
&gt; ExportFilterType::Pointer itkExporter = ExportFilterType::New();
&gt; itkExporter-&gt;SetInput(reader-&gt;GetOutput());
&gt; vtkImageImport* vtkImporter = vtkImageImport::New();
&gt; ConnectPipelines(itkExporter, vtkImporter);
&gt; vtkImporter-&gt;SetDataScalarTypeToUnsignedChar();
&gt; // Define opacity transfer function
&gt; vtkPiecewiseFunction *opacityTransferFunction = 
&gt; vtkPiecewiseFunction::New();
&gt; vtkVolume *volume = vtkVolume::New();
&gt; vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();
&gt; vtkVolumeRayCastMapper *VolumeMapper = vtkVolumeRayCastMapper::New();
&gt; vtkVolumeRayCastCompositeFunction *RayCastFunction 
&gt; =vtkVolumeRayCastCompositeFunction::New();
&gt; // Volume property
&gt; opacityTransferFunction-&gt;AddPoint(0,0.001);
&gt; opacityTransferFunction-&gt;AddPoint(255,0.2);
&gt; volumeProperty-&gt;SetScalarOpacity(opacityTransferFunction);
&gt; volumeProperty-&gt;SetInterpolationTypeToLinear();
&gt; volumeProperty-&gt;ShadeOff();
&gt; // Volume mapper
&gt; VolumeMapper-&gt;SetVolumeRayCastFunction(RayCastFunction);
&gt; VolumeMapper-&gt;SetSampleDistance(1.0);
&gt; VolumeMapper-&gt;SetBlendModeToMaximumIntensity();
&gt; VolumeMapper-&gt;SetInput(vtkImporter-&gt;GetOutput() );
&gt; // The volume
&gt; volume-&gt;SetMapper(VolumeMapper);
&gt; volume-&gt;SetProperty(volumeProperty);
&gt; // Create a renderer, render window, and render window interactor to 
&gt; display the results.
&gt; vtkRenderer *Renderer = vtkRenderer::New();
&gt; vtkRenderWindow *RenWin = vtkRenderWindow::New();
&gt; vtkRenderWindowInteractor *RenWinInterc = 
&gt; vtkRenderWindowInteractor::New();
&gt; RenWin-&gt;AddRenderer(Renderer);
&gt; RenWinInterc-&gt;SetRenderWindow(RenWin);
&gt; Renderer-&gt;AddVolume(volume);
&gt; Renderer-&gt;SetBackground(1,1,1);
&gt; RenWin-&gt;Render();
&gt; RenWinInterc-&gt;Initialize();
&gt; RenWinInterc-&gt;Start();
&gt; // Release all VTK components
&gt; RenWinInterc-&gt;Delete();
&gt; RenWin-&gt;Delete();
&gt; Renderer-&gt;Delete();
&gt; volume-&gt;Delete();
&gt; VolumeMapper-&gt;Delete();
&gt; volumeProperty-&gt;Delete();
&gt; opacityTransferFunction-&gt;Delete();
&gt;  
&gt; return 0;
&gt; }
&gt;
&gt;
&gt; ------------------------------------------------------------------------
&gt; Envoyé avec Yahoo! Mail 
&gt;
&lt;http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=52423/*http://fr.docs.yahoo.com/mail/overview/index.html&gt;.
&gt; Une boite mail plus intelligente.
&gt; ------------------------------------------------------------------------
&gt;
&gt; _______________________________________________
&gt; This is the private VTK discussion list.
&gt; Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ
&gt; Follow this link to subscribe/unsubscribe:
&gt; http://www.vtk.org/mailman/listinfo/vtkusers
&gt;   

-- 
Amy Squillacote                    Phone: (256) 726-4839
Computer Scientist                 Fax: (256) 726-4806
CFD Research Corporation           Web: http://www.cfdrc.com
215 Wynn Drive, Suite 501
Huntsville, AL  35805


</PRE></BLOCKQUOTE></td></tr></table><br>


      <hr size="1"> 
Envoyé avec <a href="http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=52423/*http://fr.docs.yahoo.com/mail/overview/index.html">Yahoo! Mail</a>.<br>Une boite mail plus intelligente. </a>