[Insight-users] need help with VTKImageExport

Richard Beare richard.beare at gmail.com
Tue Jul 12 20:16:56 EDT 2005


Hi everyone,

I'm trying to start my learning about itk by utilizing the file reader
in an old vtk application I have. I've done the following, but get
segmentation faults. I've included explicit calls to Update to trigger
the fault before the visualization pipeline gets involved.

The code is below - I'd appreciate any advice.

I'm using itk 2.0.1 and vtk 4.2.6

    typedef unsigned char CharType;
    typedef itk::Image<CharType, dimensions> itkVolIm;
    typedef itk::ImageFileReader<itkVolIm> itkVolReader;

    typedef itk::VTKImageExport<itkVolIm> vtkBridge;

    itkVolReader::Pointer thisReader;
    vtkBridge::Pointer thisBridge;
    
    // VTK components
    vtkImageImport                    *volumeImporter;
    volumeImporter = vtkImageImport::New();
    thisReader = itkVolReader::New();
    thisBridge = vtkBridge::New();
    thisReader->SetFileName(filename.c_str());
 
    thisBridge->SetInput(thisReader->GetOutput());
    thisBridge->Update();
       volumeImporter->SetUpdateInformationCallback(thisBridge->GetUpdateInformationCallback());
    volumeImporter->SetPipelineModifiedCallback(thisBridge->GetPipelineModifiedCallback());
    volumeImporter->SetWholeExtentCallback(thisBridge->GetWholeExtentCallback());

   volumeImporter->SetSpacingCallback(thisBridge->GetSpacingCallback());

    volumeImporter->SetOriginCallback(thisBridge->GetOriginCallback());
    volumeImporter->SetScalarTypeCallback(thisBridge->GetScalarTypeCallback());
       volumeImporter->SetNumberOfComponentsCallback(thisBridge->GetNumberOfComponentsCallback());
    volumeImporter->SetPropagateUpdateExtentCallback(thisBridge->GetPropagateUpdateExtentCallback());
    volumeImporter->SetUpdateDataCallback(thisBridge->GetUpdateDataCallback());

    volumeImporter->SetDataExtentCallback(thisBridge->GetDataExtentCallback());
    volumeImporter->SetBufferPointerCallback(thisBridge->GetBufferPointerCallback());
    volumeImporter->Update();


More information about the Insight-users mailing list