[Insight-users] 4D itkImage to vtkImageData

Antoine DUCHAMPS antoine.duchamps at gmail.com
Wed Apr 8 10:41:35 EDT 2009


Hi All,

I have a 4D DWI sequence 128 x 128 x 41 x 60 in size (xsize x ysize x
zsize x number of gradient orientations). I need to read it and convert
it to VTKImageData in order to estimate the tensors with slicer. I tried
to use itkImageToVTKImageFilter.h as shown in the code below but the
resulting vtkImageData contains only one scalar component (see the
output of connector -> GetOutput() -> Print(std::cout); ), whereas I
would have expected 60 (one for each gradient direction). Is this the
expected behavior or I'm doing something wrong? How is coded the 4th
dimension?

NOTE: The sequence I'm using for testing is in a single nii file, which
is passed as argument in the command line.

Thanks! ,

Antoine

--

#include "itkOrientedImage.h"
#include "itkImageFileReader.h"
#include "itkImageFileReader.h"
#include "itkImageToVTKImageFilter.h"


int main( int argc, char ** argv )

{
  typedef unsigned short      PixelType;
  const   unsigned int        Dimension = 4;

  typedef itk::OrientedImage< PixelType, Dimension >   ImageType;
  typedef itk::ImageFileReader< ImageType >    ReaderType;
  typedef itk::ImageToVTKImageFilter< ImageType > ConnectorType;
  
  ReaderType::Pointer reader = ReaderType::New();
  ConnectorType::Pointer connector = ConnectorType::New();
    
  reader->SetFileName(argv[1]);
  reader->Update();
  connector -> SetInput(reader->GetOutput());
  connector -> Update();
  connector -> GetOutput() -> Print(std::cout);

  return 0;
}


--

vtkImageData (0x1b49ac0)
  Debug: Off
  Modified Time: 216
  Reference Count: 1
  Registered Events: (none)
  Source: (none)
  Information: 0x1b49c30
  Data Released: False
  Global Release Data: Off
  UpdateTime: 217
  Release Data: Off
  UpdateExtent: Not Initialized
  UpdateExtent: 0, 127, 0, 127, 0, 40
  Update Number Of Pieces: 1
  Update Piece: 0
  Update Ghost Level: 0
  WholeExtent: 0, 127, 0, 127, 0, 40
  ExtentTranslator: (0x1b43de0)
  RequestExactExtent: Off
   Field Data:
    Debug: Off
    Modified Time: 196
    Reference Count: 1
    Registered Events: (none)
    Number Of Arrays: 0
    Number Of Components: 0
    Number Of Tuples: 0
  Number Of Points: 671744
  Number Of Cells: 645160
  Cell Data:
    Debug: Off
    Modified Time: 203
    Reference Count: 1
    Registered Events: (none)
    Number Of Arrays: 0
    Number Of Components: 0
    Number Of Tuples: 0
    Copy Tuple Flags: ( 1 1 1 1 1 0 1 )
    Interpolate Flags: ( 1 1 1 1 1 0 0 )
    Pass Through Flags: ( 1 1 1 1 1 1 1 )
    Scalars: (none)
    Vectors: (none)
    Normals: (none)
    TCoords: (none)
    Tensors: (none)
    GlobalIds: (none)
    PedigreeIds: (none)
  Point Data:
    Debug: Off
    Modified Time: 215
    Reference Count: 1
    Registered Events: (none)
    Number Of Arrays: 1
    Array 0 name = NULL
    Number Of Components: 1
    Number Of Tuples: 671744
    Copy Tuple Flags: ( 1 1 1 1 1 0 1 )
    Interpolate Flags: ( 1 1 1 1 1 0 0 )
    Pass Through Flags: ( 1 1 1 1 1 1 1 )
    Scalars: 
      Debug: Off
      Modified Time: 212
      Reference Count: 1
      Registered Events: (none)
      Name: (none)
      Data type: unsigned short
      Size: 671744
      MaxId: 671743
      NumberOfComponents: 1
      Information: 0
      Name: (none)
      Number Of Components: 1
      Number Of Tuples: 671744
      Size: 671744
      MaxId: 671743
      LookupTable: (none)
      Array: 0x7f6bebeee010
    Vectors: (none)
    Normals: (none)
    TCoords: (none)
    Tensors: (none)
    GlobalIds: (none)
    PedigreeIds: (none)
  Bounds: 
    Xmin,Xmax: (-50.1938, 197.853)
    Ymin,Ymax: (121.044, 369.091)
    Zmin,Zmax: (-100.059, 39.9414)
  Compute Time: 0
  ScalarType: 5
  NumberOfScalarComponents: 1
  Spacing: (1.95312, 1.95312, 3.5)
  Origin: (-50.1938, 121.044, -100.059)
  Dimensions: (128, 128, 41)
  Increments: (0, 0, 0)
  Extent: (0, 127, 0, 127, 0, 40)

 




More information about the Insight-users mailing list