I have a program that uses ITK to read in a 3D Analyze format (.hdr, .img) image, uses the itkImageToVTKImageFilter, and writes two images out, one using a vtkXMLImageDataWriter, and the other using a vtkPolyDataWriter (after the image was passed through a vtkContourFilter). The code snippet is pasted below.
<br><br>I then use another program to display these images. The polydata is surface rendered and the XML image is rendered as 3 orthogonal images (transverse, sagittal, and coronal). I have noticed that the polydata (X, Y, Z) locations returned from picking do not correspond to the same X, Y, Z locations in the orthogonal views.
<br><br>Is there a way that I can retrieve the transformation that has taken place somewhere between reading in the image and writing it back out as vtkPolyData so that I have a 2D-3D correspondence?<br><br>Any help is greatly appreciated, Thanks a bunch!
<br>-Jake<br><br>========================<br>...<br> typedef unsigned char PixelType;<br> const unsigned int Dimension = 3;<br><br> typedef itk::Image< PixelType, Dimension > ImageType;<br> typedef itk::ImageFileReader< ImageType > ReaderType;
<br> typedef itk::ImageToVTKImageFilter< ImageType > ConnectorFilterType;<br><br> ReaderType::Pointer reader = ReaderType::New();<br> ConnectorFilterType::Pointer connector = ConnectorFilterType::New();<br><br>
reader->SetFileName( argv[1] );<br> reader->Update();<br><br> connector->SetInput( reader->GetOutput() );<br><br> vtkXMLImageDataWriter * writer = vtkXMLImageDataWriter::New();<br> writer->SetInput( connector->GetOutput() );
<br> writer->SetFileName( argv[2] );<br> writer->Write();<br> writer->Delete();<br><br> vtkContourFilter * filter = vtkContourFilter::New();<br> filter->SetInput( connector->GetOutput() );<br> filter->SetValue( 0, 1 );
<br><br> vtkPolyDataWriter * pwriter = vtkPolyDataWriter::New();<br> pwriter->SetFileName( argv[3] );<br> pwriter->SetInput( filter->GetOutput() );<br> pwriter->Write();<br> pwriter->Delete();<br><br> filter->Delete();
<br>...<br>========================<br>