[Insight-users] ITK Vector Field to VTK

Reinhard Hameeteman reinhard.afstuderen at gmail.com
Mon Aug 15 11:31:30 EDT 2005


The VTK Image Data is below.
I'm not really sure if this is seen as a vector image:
Point Data
 Scalars
 Number Of Components: 3
but
Vectors: (none)

Because the class description of VTKImageExport states that
"Currently VTKImageExport does not support pixel types with multiple
components"  I figured this caused the single component in my vtk
image: all glyph vectors pointing in the same direction.

I tried to visualise the field as follows (with the type defenitions
included for your information):

typedef itk::Vector<float, 3>           VectorType;
typedef itk::Image<VectorType, 3> DeformationFieldType;
typedef itk::ImageToVTKImageFilter
               <DeformationFieldType > ITK2VTKAdaptorFilterType;

  m_DeformationField = DeformationFieldType::New();
// Calculation of the field
  
  m_ITK2VTKAdaptor  = ITK2VTKAdaptorFilterType::New();
  m_ITKVTKAdaptor->SetInput( m_DeformationField  );

  m_ExtractVOI  = vtkExtractVOI::New();
  m_ExtractVOI->SetInput( m_ITK2VTKAdaptor->GetOutput() );
  m_ExtractVOI->SetVOI( -1000, 1000, -1000, 1000, 30,30 );
  m_ExtractVOI->SetSampleRate( 4,4,4 );

  vtkArrowSource* vector = vtkArrowSource::New();
  m_VectorGlyph->SetInput( m_ExtractVOI->GetOutput() );
  m_VectorGlyph->SetSource( vector->GetOutput() );
  m_VectorMapper->SetInput( m_VectorGlyph->GetOutput() );
  m_VectorActor->SetMapper( m_VectorMapper );


vtkImageData (031F5EC0)
  Debug: Off
  Modified Time: 5528
  Reference Count: 1
  Registered Events: (none)
  Source: 031F5DA8
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  MaximumNumberOfPieces: -1
  PipelineMTime: 5520
  UpdateTime: 5529
  UpdateExtent: Not Initialized
  Update Number Of Pieces: 1
  Update Piece: 0
  Update Ghost Level: 0
  RequestExactExtent: Off
   UpdateExtent: 0, 49, 0, 49, 0, 49
  WholeExtent: 0, 49, 0, 49, 0, 49
  Field Data:
    Debug: Off
    Modified Time: 5515
    Reference Count: 1
    Registered Events: (none)
    Number Of Arrays: 0
    Number Of Components: 0
    Number Of Tuples: 0
  Locality: 0
  NumberOfConsumers: 0
  ExtentTranslator: (031D32F0)
  MaximumNumberOfPieces: -1
  Number Of Points: 125000
  Number Of Cells: 117649
  Cell Data:
    Debug: Off
    Modified Time: 5517
    Reference Count: 1
    Registered Events: (none)
    Number Of Arrays: 0
    Number Of Components: 0
    Number Of Tuples: 0
    Copy Flags: ( 1 1 1 1 1 )
    Scalars: (none)
    Vectors: (none)
    Normals: (none)
    TCoords: (none)
    Tensors: (none)
  Point Data:
    Debug: Off
    Modified Time: 5527
    Reference Count: 1
    Registered Events: (none)
    Number Of Arrays: 1
    Array 0 name = NULL
    Number Of Components: 3
    Number Of Tuples: 125000
    Copy Flags: ( 1 1 1 1 1 )
    Scalars:
      Debug: Off
      Modified Time: 5524
      Reference Count: 1
      Registered Events: (none)
      Name: (none)
      Number Of Components: 3
      Number Of Tuples: 125000
      Size: 375000
      MaxId: 374999
      LookupTable: (none)
      Array: 0A800044
    Vectors: (none)
    Normals: (none)
    TCoords: (none)
    Tensors: (none)
  Bounds:
    Xmin,Xmax: (-140.532, -104.165)
    Ymin,Ymax: (-47.5429, -11.1757)
    Zmin,Zmax: (11.537, 158.537)
  Compute Time: 0
  Release Data: Off
  ScalarType: 10
  NumberOfScalarComponents: 3
  Spacing: (0.742188, 0.742188, 3)
  Origin: (-140.532, -47.5429, 11.537)
  Dimensions: (50, 50, 50)
  Increments: (3, 150, 7500)
  Extent: (0, 49, 0, 49, 0, 49)
  WholeExtent: (0, 49, 0, 49, 0, 49)

2005/8/15, Karthik Krishnan <Karthik.Krishnan at kitware.com>:
> 
> 
> Reinhard Hameeteman wrote:
> 
> >Hi,
> >
> >Is it possible to export a vector image defined as:
> >
> >typedef itk::Vector<float, 3>           VectorType;
> >typedef itk::Image<VectorType, 3> DeformationFieldType;
> >
> >to VTK?
> >
> >I can save the vector field and read it in paraview, but I want the
> >visualisation in my own application and using itkImageToVTKImageFilter
> >I only get a scalar (x-component?) in the vtk image.
> >
> >
> >
> I've exported data from ITK to VTK with image pixel types of Vector<
> double, 3 >, using the ImageToVTKImageFilter before and I am quite
> certain it works.
> 
> Incidentally, there was a bug in the itkVTKImageIO.cxx that caused bogus
> to be written out when writing multi-component images, but that would
> only affect you if you were writing out VTK images from ITK and reading
> them with VTK or vice versa.
> 
> Can you print out the vtkImageData that you get after exporting to VTK ?
> 
> >Reinhard
> >_______________________________________________
> >Insight-users mailing list
> >Insight-users at itk.org
> >http://www.itk.org/mailman/listinfo/insight-users
> >
> >
> >
>


More information about the Insight-users mailing list