[Insight-users] pipeline VTK to ITK and ITK to VTK
Dunham Patrick
pdunham@ulb.ac.be
Fri, 29 Nov 2002 22:24:42 +0100
This is a multi-part message in MIME format.
------=_NextPart_000_006B_01C297F6.1CD252D0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hi Luis,
Here is my test code. (join)
Thanks very much for the help.
----- Original Message -----
From: "Luis Ibanez" <luis.ibanez@kitware.com>
To: "Dunham Patrick" <pdunham@ulb.ac.be>
Cc: <insight-users@public.kitware.com>
Sent: Friday, November 29, 2002 7:26 PM
Subject: Re: [Insight-users] pipeline VTK to ITK and ITK to VTK
> Hi Patrick,
>
> Could you please send me your code ?
>
> I assume it is only a file...
>
> I'll give it a try and see what I can find.
>
> Thanks
>
> Luis
>
> =============================================
> Dunham Patrick wrote:
>
> > Hi Luis,
> > I try my code without vtkImageReader but with a vtkImageNoiseSource and
> > there is no more error message.
> > So it seems that is the reader who is the problem. But I don't have any
idea
> > > about how to make it work.
> > >
> > > And I try to isolate the two part of the pipeline and the error come
> with
> > > the ITK to VTK part.
> > >
> > > Thanks for any help.
> > >
> > >
> > >
> >
> >
> >
> >
>
------=_NextPart_000_006B_01C297F6.1CD252D0
Content-Type: application/octet-stream;
name="essai.cpp"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="essai.cpp"
#include <itkCommand.h>
#include <itkImage.h>
#include <itkImageFileReader.h>
#include <itkVTKImageExport.h>
#include <itkVTKImageImport.h>
#include <vtkITKUtility.h>
#include <vtkImageImport.h>
#include <vtkImageExport.h>
#include <vtkImageReader.h>
#include <vtkImageReslice.h>
#include <vtkImageMapper.h>
#include <vtkActor2D.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
int main()
{
vtkImageReader *reader = vtkImageReader::New();
vtkImageMapper *mapper = vtkImageMapper::New();
vtkActor2D *actor = vtkActor2D::New();
vtkRenderer *ren = vtkRenderer::New();
vtkRenderWindow *renwin = vtkRenderWindow::New();
vtkImageImport *vtkImporter = vtkImageImport::New();
vtkImageExport *vtkExporter = vtkImageExport::New();
//vtk pipeline
reader->SetFilePrefix("C:\\ConvertDicom\\Dicom\\test");
reader->SetFilePattern("%s%d.4");
reader->SetDataExtent(0, 511, 0, 511, 1, 52);
vtkExporter->SetInput(reader->GetOutput());
//vtk pipeline
//itk pipeline
typedef itk::Image<float, 2> ImageType;
typedef itk::VTKImageImport<ImageType> ImageImportType;
typedef itk::VTKImageExport<ImageType> ImageExportType;
ImageImportType::Pointer itkImporter = ImageImportType::New();
ImageExportType::Pointer itkExporter = ImageExportType::New();
itkExporter->SetInput(itkImporter->GetOutput());
ConnectPipelines(vtkExporter, itkImporter);
ConnectPipelines(itkExporter, vtkImporter);
//itk pipeline
//vtk pipeline
//mapper->SetInput(vtkImporter->GetOutput());
mapper->SetInput(reader->GetOutput());
actor->SetMapper(mapper);
ren->AddActor2D(actor);
renwin->AddRenderer(ren);
renwin->Render();
//vtk pipeline
reader->Delete();
mapper->Delete();
actor->Delete();
ren->Delete();
renwin->Delete();
vtkImporter->Delete();
vtkExporter->Delete();
int x;
std::cout <<"burp";
std::cin >>x;
return 0;
}
------=_NextPart_000_006B_01C297F6.1CD252D0--