17 #include "itkVectorImage.h" 18 #include "itkImageFileWriter.h" 20 #include "vtkSmartPointer.h" 21 #include "vtkXMLImageDataReader.h" 22 #include "vtkImageData.h" 25 #include "VTKXMLImageToVectorImageConverterCLP.h" 28 main(
int argc,
char *argv[])
33 const static unsigned int Dimension = 3;
34 typedef double PixelType;
35 typedef itk::VectorImage<PixelType, Dimension> OutputImageType;
36 typedef vtkSmartPointer<vtkXMLImageDataReader> ReaderType;
37 typedef itk::ImageFileWriter<OutputImageType> WriterType;
38 ReaderType reader = ReaderType::New();
39 WriterType::Pointer writer = WriterType::New();
42 reader->SetFileName( _InputFile.c_str() );
45 std::cout <<
"Reading file: " << _InputFile << std::endl;
47 reader->GetOutput()->Register(reader);
51 catch (itk::ExceptionObject & err)
53 std::cerr <<
"ExceptionObject caught!" << std::endl;
54 std::cerr << err << std::endl;
60 ConverterType::Pointer converter = ConverterType::New();
61 converter->SetInputData( reader->GetOutput() );
67 std::cout <<
"Writing file: " << _OutputFile << std::endl;
68 writer->SetInput( converter->GetOutput() );
69 writer->SetFileName( _OutputFile );
72 catch ( itk::ExceptionObject & err )
74 std::cerr <<
"ExceptionObject caught!" << std::endl;
75 std::cerr << err << std::endl;
Convert VTK image data to an ITK image.
int main(int argc, char *argv[])