<div>Hi guys. Problem solved. My mistake. </div>
<div> </div>
<div>Thanks.</div>
<div> </div>
<div><font color="#008000" size="2">
<p>/// Define the pixel type</p>
<p>typedef double PixelType;</p>
<p>/// Define the image type and its iterator</p>
<p>typedef itk::Image< PixelType, 3 > ImageType3D;</p>
<p>/// Define writer types </p>
<p>typedef itk::ImageFileWriter< ImageType3D > WriterType3D;</p>
<p>/// Import filter used to write the gabor filter to disk</p>
<p>typedef itk::ImportImageFilter< PixelType, 3 > ImportFilter3D;</p>
<p>typedef itk::VTKImageIO ImageIOType;</p>
<p>int m_dimU = 256;</p>
<p>int m_dimV = 256;</p>
<p>int m_dimW = 128;</p>
<p>const unsigned long int nPixels = m_dimU * m_dimV * m_dimW;</p>
<p>PixelType *buffer = new PixelType[ nPixels ];</p>
<p>// **************</p>
<p>ImportFilter3D::Pointer importFilter = ImportFilter3D::New();</p>
<p>ImportFilter3D::RegionType region;</p>
<p>ImportFilter3D::IndexType start;</p>
<p>start.Fill( 0 ); </p>
<p>region.SetIndex( start );</p>
<p>ImportFilter3D::SizeType size;</p>
<p>size[0] = m_dimU;</p>
<p>size[1] = m_dimV;</p>
<p>size[2] = m_dimW;</p>
<p>region.SetSize( size );</p>
<p>importFilter->SetRegion( region );</p>
<p>double origin[3];</p>
<p>origin[0] = 0.0;</p>
<p>origin[1] = 0.0;</p>
<p>origin[2] = 0.0;</p>
<p>importFilter->SetOrigin( origin );</p>
<p>double spacing[3];</p>
<p>spacing[0] = 1.0;</p>
<p>spacing[1] = 1.0;</p>
<p>spacing[2] = 1.0;</p>
<p>importFilter->SetSpacing( spacing );</p>
<p>importFilter->SetImportPointer( buffer, nPixels, true );</p>
<p>// **************</p>
<p>// Set up the file writer</p>
<p>ImageIOType::Pointer vtkIO = ImageIOType::New();</p>
<p>vtkIO->SetByteOrderToLittleEndian();</p>
<p>vtkIO->SetNumberOfDimensions(3);</p>
<p>vtkIO->SetFileTypeToBinary();</p>
<p> </p>
<p>// **************</p>
<p>WriterType3D::Pointer writerPtr = WriterType3D::New();</p>
<p>writerPtr->SetImageIO( vtkIO );</p>
<p>writerPtr->SetFileName( "C:\\Filter.vtk" );</p>
<p>writerPtr->SetInput( importFilter->GetOutput() );</p>
<p>writerPtr->Update(); </p>
<p>// **************</p></font></div>