AW: [vtkusers] converting between itk and vtk
Erbacher, Markus
Markus.Erbacher at med.uni-heidelberg.de
Wed Apr 5 04:48:47 EDT 2006
I have written a two function to connect pipes from itk and vtk. Perhaps it helps. It works fine for me.
template <typename ITK_Exporter, typename VTK_Importer>
static void ConnectPipelines(ITK_Exporter Exporter, VTK_Importer* Importer)
{
Importer->SetUpdateInformationCallback(Exporter->GetUpdateInformationCallback());
Importer->SetPipelineModifiedCallback(Exporter->GetPipelineModifiedCallback());
Importer->SetWholeExtentCallback(Exporter->GetWholeExtentCallback());
Importer->SetSpacingCallback(Exporter->GetSpacingCallback());
Importer->SetOriginCallback(Exporter->GetOriginCallback());
Importer->SetScalarTypeCallback(Exporter->GetScalarTypeCallback());
Importer->SetNumberOfComponentsCallback(Exporter->GetNumberOfComponentsCallback());
Importer->SetPropagateUpdateExtentCallback(Exporter->GetPropagateUpdateExtentCallback());
Importer->SetUpdateDataCallback(Exporter->GetUpdateDataCallback());
Importer->SetDataExtentCallback(Exporter->GetDataExtentCallback());
Importer->SetBufferPointerCallback(Exporter->GetBufferPointerCallback());
Importer->SetCallbackUserData(Exporter->GetCallbackUserData());
}
template <typename VTK_Exporter, typename ITK_Importer>
static void ConnectPipelines(VTK_Exporter* Exporter, ITK_Importer Importer)
{
Importer->SetUpdateInformationCallback(Exporter->GetUpdateInformationCallback());
Importer->SetPipelineModifiedCallback(Exporter->GetPipelineModifiedCallback());
Importer->SetWholeExtentCallback(Exporter->GetWholeExtentCallback());
Importer->SetSpacingCallback(Exporter->GetSpacingCallback());
Importer->SetOriginCallback(Exporter->GetOriginCallback());
Importer->SetScalarTypeCallback(Exporter->GetScalarTypeCallback());
Importer->SetNumberOfComponentsCallback(Exporter->GetNumberOfComponentsCallback());
Importer->SetPropagateUpdateExtentCallback(Exporter->GetPropagateUpdateExtentCallback());
Importer->SetUpdateDataCallback(Exporter->GetUpdateDataCallback());
Importer->SetDataExtentCallback(Exporter->GetDataExtentCallback());
Importer->SetBufferPointerCallback(Exporter->GetBufferPointerCallback());
Importer->SetCallbackUserData(Exporter->GetCallbackUserData());
}
-----Ursprüngliche Nachricht-----
Von: vtkusers-bounces+markus.erbacher=med.uni-heidelberg.de at vtk.org [mailto:vtkusers-bounces+markus.erbacher=med.uni-heidelberg.de at vtk.org] Im Auftrag von Chase Yarbrough
Gesendet: Mittwoch, 5. April 2006 00:50
An: hobbsk at ohiou.edu; vtkusers at vtk.org
Betreff: Re: [vtkusers] converting between itk and vtk
On 4/4/06, Kevin H. Hobbs <kevin.hobbs.1 at ohiou.edu > wrote:
On Mon, 2006-04-03 at 20:16 -0700, Chase Yarbrough wrote:
> Hello,
>
> I need to convert images from VTK to ITK and back to VTK again after
> processing. How can I do this while preserving the origin of my images?
>
> Thanks,
> Chase Yarbrough
Do you want this to happen in the pipeline without saving to files and
reloading?
Yes. Currently I have a version working that saves to files and reloads, but I would prefer to eliminate the extra I/O overhead. I'm using itk::VTKImageImport and vtk::vtkImageExport to connect the pipelines. Connecting the pipelines seems to work at first, but when I run any filters on the new itk image, I get an access violation in itkImageConstIterator::Get().
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
iD8DBQBEMqssqBtEuW+gRPERAi1PAJ4rEHozA61GYE8vjyLG2SZRPO/F8gCfc8xY
pjDEU5/WJonnhTUuZbQ4Kjw=
=Z7NW
-----END PGP SIGNATURE-----
More information about the vtkusers
mailing list