<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3020" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2>Hello All,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>I have just started learning VTK recently. My
purpose at this moment is to link VTK to ITK and vice versa in order to read vtk
data (structured points) by VTK, process the data by ITK, then display the
processed data by VTK. I am writing a simple code like attached below. It can be
compiled and built without problem, but a vtkOutputWindow comes up when running
to show an error message saying <BR>"vtkImageData(017D9B40): GetPointer:
Pixel(0, 0, 0) not in current extent...".<BR>But data extent is already set
according to whole exetent. I checked in debug mode that WholeExtent is set to
(0, 127, 0, 127, 0, 114) and DataExtent is the same.<SPAN
class=565013721-06022007> </SPAN>I have totally no idea to solve this
problem.</FONT></DIV>
<DIV><FONT face=Arial size=2>My environment is: WinXP, MS VisualStudio.net 2003,
VTK5.0.2, ITK 3.0.0</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Any help will be greatly appreciated.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Best Regards,<BR>Kaz</FONT></DIV>
<DIV> </DIV><FONT face=Arial size=2>
<DIV><BR>---<BR> vtkStructuredPointsReader *readerVTK =
vtkStructuredPointsReader::New();<BR> vtkContourFilter
*contourFilterVTK = vtkContourFilter::New();<BR> vtkPolyDataMapper
*mapperPolyDataVTK =vtkPolyDataMapper::New();<BR> vtkActor *actorVTK =
vtkActor::New();<BR> vtkImageImport *importerVTK =
vtkImageImport::New();<BR> vtkImageExport *exporterVTK =
vtkImageExport::New();<BR> vtkRenderer *rendererVTK =
vtkRenderer::New();<BR> vtkRenderWindow *renWinVTK =
vtkRenderWindow::New();</DIV>
<DIV> </DIV>
<DIV> typedef itk::Image<short, 3> ImageType3D;<BR> typedef
itk::VTKImageImport<ImageType3D>
itkImageImportType3D;<BR> itkImageImportType3D::Pointer
importer3DITK;<BR> typedef itk::VTKImageExport<ImageType3D>
itkImageExportType3D;<BR> itkImageExportType3D::Pointer
exporter3DITK;<BR> typedef itk::BinaryThresholdImageFilter<ImageType3D,
ImageType3D>
itkBinThresholdFilterType;<BR> itkBinThresholdFilterType::Pointer binThresholdFilterITK;</DIV>
<DIV> </DIV>
<DIV> importer3DITK =
itkImageImportType3D::New();<BR> exporter3DITK =
itkImageExportType3D::New();<BR> binThresholdFilterITK =
itkBinThresholdFilterType::New();<BR> <BR> // read the
data<BR> readerVTK->SetFileName("CT.vtk");<BR> readerVTK->Update();<BR> <BR> //
set to exporter of VTK<BR> exporterVTK->SetInputConnection(
readerVTK->GetOutputPort() );<BR> // send to
ITK<BR> connectVTK2ITK( exporterVTK, importer3DITK );</DIV>
<DIV> </DIV>
<DIV> // image processing by
ITK<BR> binThresholdFilterITK->SetInput( importer3DITK->GetOutput()
);<BR> binThresholdFilterITK->SetOutsideValue( 0
);<BR> binThresholdFilterITK->SetInsideValue( 255
);<BR> binThresholdFilterITK->SetLowerThreshold( 100
);<BR> binThresholdFilterITK->SetUpperThreshold( 200 );</DIV>
<DIV> </DIV>
<DIV> // set to exporter of ITK<BR> exporter3DITK->SetInput(
binThresholdFilterITK->GetOutput() );<BR> // send back to
VTK<BR> connectITK2VTK( exporter3DITK, importerVTK );<BR> <BR> //
processes on imported
data<BR> importerVTK->Update();<BR> importerVTK->SetDataExtentToWholeExtent();<BR> importerVTK->SetDataOrigin(0,
0, 0);</DIV>
<DIV> </DIV>
<DIV> // make surface<BR> contourFilterVTK->SetInput(
importerVTK->GetOutput() );<BR> contourFilterVTK->SetValue(0,
400);</DIV>
<DIV> </DIV>
<DIV> // display<BR> mapperPolyDataVTK->SetInput(
contourFilterVTK->GetOutput()
);<BR> mapperPolyDataVTK->ScalarVisibilityOff();<BR> actorVTK->SetMapper(
mapperPolyDataVTK
);<BR> actorVTK->GetProperty()->SetOpacity(1.0);<BR> actorVTK->GetProperty()->SetDiffuseColor(
1, 1, 1 );<BR> rendererVTK->AddActor( actorVTK
);<BR> renWinVTK->AddRenderer( rendererVTK
);<BR> renWinVTK->Render();<BR>}</DIV>
<DIV> </DIV>
<DIV><BR>void sampleApp2::connectVTK2ITK(vtkImageExport *exporter,
itkImageImportType3D
*importer)<BR>{<BR> importer->SetUpdateInformationCallback (exporter->GetUpdateInformationCallback());<BR> importer->SetPipelineModifiedCallback (exporter->GetPipelineModifiedCallback());<BR> importer->SetWholeExtentCallback (exporter->GetWholeExtentCallback());<BR> importer->SetSpacingCallback (exporter->GetSpacingCallback());<BR> importer->SetOriginCallback (exporter->GetOriginCallback());<BR> importer->SetScalarTypeCallback (exporter->GetScalarTypeCallback());<BR> importer->SetNumberOfComponentsCallback (exporter->GetNumberOfComponentsCallback());<BR> importer->SetPropagateUpdateExtentCallback (exporter->GetPropagateUpdateExtentCallback());<BR> importer->SetUpdateDataCallback (exporter->GetUpdateDataCallback());<BR> importer->SetDataExtentCallback (exporter->GetDataExtentCallback());<BR> importer->SetBufferPointerCallback (exporter->GetBufferPointerCallback());<BR> importer->SetCallbackUserData (exporter->GetCallbackUserData());<BR> return;<BR>}</DIV>
<DIV> </DIV>
<DIV>void sampleApp2::connectITK2VTK(itkImageExportType3D *exporter,
vtkImageImport
*importer)<BR>{<BR> importer->SetUpdateInformationCallback (exporter->GetUpdateInformationCallback());<BR> importer->SetPipelineModifiedCallback (exporter->GetPipelineModifiedCallback());<BR> importer->SetWholeExtentCallback (exporter->GetWholeExtentCallback());<BR> importer->SetSpacingCallback (exporter->GetSpacingCallback());<BR> importer->SetOriginCallback (exporter->GetOriginCallback());<BR> importer->SetScalarTypeCallback (exporter->GetScalarTypeCallback());<BR> importer->SetNumberOfComponentsCallback (exporter->GetNumberOfComponentsCallback());<BR> importer->SetPropagateUpdateExtentCallback (exporter->GetPropagateUpdateExtentCallback());<BR> importer->SetUpdateDataCallback (exporter->GetUpdateDataCallback());<BR> importer->SetDataExtentCallback (exporter->GetDataExtentCallback());<BR> importer->SetBufferPointerCallback (exporter->GetBufferPointerCallback());<BR> importer->SetCallbackUserData (exporter->GetCallbackUserData());<BR> return;<BR>}</FONT></DIV></BODY></HTML>